44 <s-tooltip align =" right" >
55 <s-icon-button
66 slot =" trigger"
7- @click =" emitter.emit('require-full-update')"
7+ @click =" emitter.emit('require-full-update', 'manual' )"
88 >
99 <SIconRefresh />
1010 </s-icon-button >
@@ -27,15 +27,17 @@ import SIconRefresh from "@/ui/icons/refresh.vue";
2727import SIconWarn from " @/ui/icons/warn.vue" ;
2828
2929import { onMounted , ref , watch } from " vue" ;
30- import { cloneDeep , throttle } from " lodash-es" ;
30+ import { throttle } from " lodash-es" ;
3131import type { FunctionPlotDatum } from " function-plot" ;
3232import { getFnType } from " ../consts" ;
33- const { data, width, height } = defineProps <{
34- data: FunctionPlotDatum [];
33+ const { width, height } = defineProps <{
3534 width: number ;
3635 height: number ;
3736}>();
3837
38+ import { useProfile } from " @/states" ;
39+ const profile = useProfile ();
40+
3941import emitter from " @/mitt" ;
4042const fullUpdateState = defineModel <boolean >();
4143
@@ -55,9 +57,10 @@ function findError(graphData: FunctionPlotDatum[]) {
5557onMounted (async () => {
5658 const functionPlot = (await import (" function-plot" )).default ;
5759 watch (
58- [() => width , () => height , () => data ],
60+ [() => width , () => height , profile ],
5961 throttle (() => {
60- const graphData = cloneDeep (data );
62+ if (import .meta .env .DEV ) console .log (" graph update" );
63+ const graphData = profile .getOriginalData ();
6164 const flag = findError (graphData );
6265 if (flag ) {
6366 errorMsg .value = ` Invalid input in function ${flag + 1 } ` ;
@@ -67,20 +70,19 @@ onMounted(async () => {
6770 plotRef .value &&
6871 functionPlot ({
6972 target: plotRef .value ,
70- data : <FunctionPlotDatum []>(
71- // (flag ? graphData.slice(0, flag) : graphData)
72- graphData
73- ),
73+ data: <FunctionPlotDatum []>graphData ,
7474 width: width - 20 ,
7575 height: height - 20 ,
76+ annotations: profile .getOriginalAnnotaion (),
7677 });
7778 if (fullUpdateState .value ) {
7879 fullUpdateState .value = false ;
79- emitter .emit (" require-post-update" );
80+ emitter .emit (" require-post-update" , " once after error " );
8081 } else errorMsg .value = undefined ;
8182 } catch (e ) {
8283 // console.log(e);
83- if (! fullUpdateState .value ) emitter .emit (" require-full-update" );
84+ if (! fullUpdateState .value )
85+ emitter .emit (" require-full-update" , " error" );
8486 errorMsg .value = (e as Error ).message ;
8587 }
8688 }, 200 ),
@@ -104,13 +106,17 @@ onMounted(async () => {
104106 transition : filter 1ms ;
105107}
106108
109+ :root {
110+ --graph-filter : invert (100% ) hue-rotate (180deg ) contrast (0.8 ) brightness (1.3 );
111+ }
112+
107113@media (prefers-color-scheme: dark) {
108114 s-page .auto #graphRender {
109- filter : invert ( 100 % ) hue-rotate ( 180 deg ) brightness ( 133 % );
115+ filter : var ( --graph-filter );
110116 }
111117}
112118s-page .dark #graphRender {
113- filter : invert ( 100 % ) hue-rotate ( 180 deg ) brightness ( 133 % );
119+ filter : var ( --graph-filter );
114120}
115121
116122.onresize #graphRender {
0 commit comments