@@ -246,34 +246,32 @@ const chargePointSumCharging = computed(
246246 () => Number (chargePointSumPower .value .value ) > 0 ,
247247);
248248
249- // /////////////////// Set animation speed and size ///////////////////
250-
251- const getCurrentCategory = (value : number ) => {
252- if (Math .abs (value ) >= 5000 ) return ' large' ;
253- if (Math .abs (value ) >= 1500 ) return ' medium' ;
254- return ' small' ;
255- };
256-
257- // helper function to create a computed property for current category
258- const useCurrentCategory = (powerRef : () => ValueObject ) => {
259- return computed (() => getCurrentCategory (Number (powerRef ().value )));
249+ // /////////////////// Set animation speed //////////////////////////
250+
251+ const powerCategory = (powerRef : () => number ) => {
252+ return computed (() => {
253+ const value = powerRef ();
254+ if (Math .abs (value ) >= 5000 ) return ' large' ;
255+ if (Math .abs (value ) >= 1500 ) return ' medium' ;
256+ return ' small' ;
257+ });
260258};
261259
262- const pvCurrentCategory = useCurrentCategory (() => pvPower .value );
263- const batteryCurrentCategory = useCurrentCategory (() => batteryPower .value );
264- const gridCurrentCategory = useCurrentCategory (() => gridPower .value );
265- const homeCurrentCategory = useCurrentCategory (() => homePower .value );
266- const chargePoint1CurrentCategory = useCurrentCategory (
267- () => chargePoint1Power .value ,
260+ const pvPowerCategory = powerCategory (() => pvPower . value .value );
261+ const batteryPowerCategory = powerCategory (() => batteryPower . value .value );
262+ const gridPowerCategory = powerCategory (() => gridPower . value .value );
263+ const homePowerCategory = powerCategory (() => homePower . value .value );
264+ const chargePoint1PowerCategory = powerCategory (
265+ () => chargePoint1Power .value . value ,
268266);
269- const chargePoint2CurrentCategory = useCurrentCategory (
270- () => chargePoint2Power .value ,
267+ const chargePoint2PowerCategory = powerCategory (
268+ () => chargePoint2Power .value . value ,
271269);
272- const chargePoint3CurrentCategory = useCurrentCategory (
273- () => chargePoint3Power .value ,
270+ const chargePoint3PowerCategory = powerCategory (
271+ () => chargePoint3Power .value . value ,
274272);
275- const chargePointSumCurrentCategory = useCurrentCategory (
276- () => chargePointSumPower .value ,
273+ const chargePointSumPowerCategory = powerCategory (
274+ () => chargePointSumPower .value . value ,
277275);
278276
279277// /////////////////////// Diagram components /////////////////////////
@@ -292,7 +290,7 @@ const svgComponents = computed((): FlowComponent[] => {
292290 : ' ' ,
293291 animated: gridConsumption .value ,
294292 animatedReverse: gridFeedIn .value ,
295- currentCategory: gridCurrentCategory .value ,
293+ powerCategory: gridPowerCategory .value ,
296294 },
297295 position: { row: 0 , column: 0 },
298296 label: [' EVU' , absoluteValueObject (gridPower .value ).textValue ],
@@ -306,7 +304,7 @@ const svgComponents = computed((): FlowComponent[] => {
306304 valueLabel: ' ' ,
307305 animated: homeProduction .value ,
308306 animatedReverse: homeConsumption .value ,
309- currentCategory: homeCurrentCategory .value ,
307+ powerCategory: homePowerCategory .value ,
310308 },
311309 position: { row: 0 , column: 2 },
312310 label: [' Haus' , absoluteValueObject (homePower .value ).textValue ],
@@ -321,7 +319,7 @@ const svgComponents = computed((): FlowComponent[] => {
321319 valueLabel: ' fill-success' ,
322320 animated: pvProduction .value ,
323321 animatedReverse: pvConsumption .value ,
324- currentCategory: pvCurrentCategory .value ,
322+ powerCategory: pvPowerCategory .value ,
325323 },
326324 position: { row: 1 , column: 0 },
327325 label: [' PV' , absoluteValueObject (pvPower .value ).textValue ],
@@ -337,7 +335,7 @@ const svgComponents = computed((): FlowComponent[] => {
337335 valueLabel: ' ' ,
338336 animated: batteryDischarging .value ,
339337 animatedReverse: batteryCharging .value ,
340- currentCategory: batteryCurrentCategory .value ,
338+ powerCategory: batteryPowerCategory .value ,
341339 },
342340 position: { row: 1 , column: 2 },
343341 label: [' Speicher' , absoluteValueObject (batteryPower .value ).textValue ],
@@ -356,7 +354,7 @@ const svgComponents = computed((): FlowComponent[] => {
356354 valueLabel: ' ' ,
357355 animated: chargePoint1Discharging .value ,
358356 animatedReverse: chargePoint1Charging .value ,
359- currentCategory: chargePoint1CurrentCategory .value ,
357+ powerCategory: chargePoint1PowerCategory .value ,
360358 },
361359 position: {
362360 row: 2 ,
@@ -379,7 +377,7 @@ const svgComponents = computed((): FlowComponent[] => {
379377 ' fill-' + chargePoint1ConnectedVehicleChargeMode .value .class ,
380378 animated: chargePoint1Discharging .value ,
381379 animatedReverse: chargePoint1Charging .value ,
382- currentCategory: chargePoint1CurrentCategory .value ,
380+ powerCategory: chargePoint1PowerCategory .value ,
383381 },
384382 position: {
385383 row: 3 ,
@@ -403,7 +401,7 @@ const svgComponents = computed((): FlowComponent[] => {
403401 valueLabel: ' ' ,
404402 animated: chargePoint2Discharging .value ,
405403 animatedReverse: chargePoint2Charging .value ,
406- currentCategory: chargePoint2CurrentCategory .value ,
404+ powerCategory: chargePoint2PowerCategory .value ,
407405 },
408406 position: {
409407 row: 2 ,
@@ -427,7 +425,7 @@ const svgComponents = computed((): FlowComponent[] => {
427425 ' fill-' + chargePoint2ConnectedVehicleChargeMode .value .class ,
428426 animated: chargePoint2Discharging .value ,
429427 animatedReverse: chargePoint2Charging .value ,
430- currentCategory: chargePoint2CurrentCategory .value ,
428+ powerCategory: chargePoint2PowerCategory .value ,
431429 },
432430 position: {
433431 row: 3 ,
@@ -451,7 +449,7 @@ const svgComponents = computed((): FlowComponent[] => {
451449 valueLabel: ' ' ,
452450 animated: chargePoint3Discharging .value ,
453451 animatedReverse: chargePoint3Charging .value ,
454- currentCategory: chargePoint3CurrentCategory .value ,
452+ powerCategory: chargePoint3PowerCategory .value ,
455453 },
456454 position: { row: 2 , column: 2 },
457455 label: [
@@ -472,7 +470,7 @@ const svgComponents = computed((): FlowComponent[] => {
472470 ' fill-' + chargePoint3ConnectedVehicleChargeMode .value .class ,
473471 animated: chargePoint3Discharging .value ,
474472 animatedReverse: chargePoint3Charging .value ,
475- currentCategory: chargePoint2CurrentCategory .value ,
473+ powerCategory: chargePoint3PowerCategory .value ,
476474 },
477475 position: {
478476 row: 3 ,
@@ -495,7 +493,7 @@ const svgComponents = computed((): FlowComponent[] => {
495493 valueLabel: ' ' ,
496494 animated: chargePointSumDischarging .value ,
497495 animatedReverse: chargePointSumCharging .value ,
498- currentCategory: chargePointSumCurrentCategory .value ,
496+ powerCategory: chargePointSumPowerCategory .value ,
499497 },
500498 position: { row: 2 , column: 1 },
501499 label: [
@@ -599,7 +597,7 @@ const svgRectWidth = computed(
599597 component.class.base,
600598 { animated: component.class.animated },
601599 { animatedReverse: component.class.animatedReverse },
602- component.class.currentCategory ,
600+ component.class.powerCategory ,
603601 ]"
604602 :d ="
605603 component.class.base !== 'vehicle'
@@ -786,27 +784,17 @@ path.animatedReverse {
786784 animation : dashReverse 1s linear infinite ;
787785}
788786
789- /* path.small {
790- stroke-width: 0.5;
791- }
792- path.medium {
793- stroke-width: 1;
794- }
795- path.large {
796- stroke-width: 1.5;
797- } */
798-
799787path .small.animated ,
800788path .small.animatedReverse {
801- animation-duration : 2 s ;
789+ animation-duration : 3.5 s ;
802790}
803791path .medium.animated ,
804792path .medium.animatedReverse {
805793 animation-duration : 1.5s ;
806794}
807795path .large.animated ,
808796path .large.animatedReverse {
809- animation-duration : 0.75 s ;
797+ animation-duration : 0.6 s ;
810798}
811799
812800path .animated.grid {
0 commit comments