From bc29c589f42a6654f2f3914e6443d3f72cb047c7 Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Mon, 13 May 2024 12:39:13 +0300 Subject: [PATCH] SpeedDial hydration fixes --- components/lib/speeddial/SpeedDial.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/components/lib/speeddial/SpeedDial.vue b/components/lib/speeddial/SpeedDial.vue index 2ac7381c7..f194ba0c0 100644 --- a/components/lib/speeddial/SpeedDial.vue +++ b/components/lib/speeddial/SpeedDial.vue @@ -72,6 +72,9 @@ import Tooltip from 'primevue/tooltip'; import { DomHandler, UniqueComponentId } from 'primevue/utils'; import BaseSpeedDial from './BaseSpeedDial.vue'; +// Set fix value for SSR. +const Math_PI = 3.14159265358979; + export default { name: 'SpeedDial', extends: BaseSpeedDial, @@ -362,7 +365,7 @@ export default { const radius = this.radius || length * 20; if (type === 'circle') { - const step = (2 * Math.PI) / length; + const step = (2 * Math_PI) / length; return { left: `calc(${radius * Math.cos(step * index)}px + ${$dt('item.diff.x', '0px').variable})`, @@ -370,7 +373,7 @@ export default { }; } else if (type === 'semi-circle') { const direction = this.direction; - const step = Math.PI / (length - 1); + const step = Math_PI / (length - 1); const x = `calc(${radius * Math.cos(step * index)}px + ${$dt('item.diff.x', '0px').variable})`; const y = `calc(${radius * Math.sin(step * index)}px + ${$dt('item.diff.y', '0px').variable})`; @@ -385,7 +388,7 @@ export default { } } else if (type === 'quarter-circle') { const direction = this.direction; - const step = Math.PI / (2 * (length - 1)); + const step = Math_PI / (2 * (length - 1)); const x = `calc(${radius * Math.cos(step * index)}px + ${$dt('item.diff.x', '0px').variable})`; const y = `calc(${radius * Math.sin(step * index)}px + ${$dt('item.diff.y', '0px').variable})`;