Skip to content

Commit 738256e

Browse files
committed
Modification - SlicerPreview - Remove useless method
1 parent a6b9496 commit 738256e

File tree

1 file changed

+11
-25
lines changed

1 file changed

+11
-25
lines changed

src/atoms/SlicerPreview.vue

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -230,21 +230,6 @@ const end = computed({
230230
}
231231
});
232232
233-
onMounted(() => {
234-
const updateWidth = () => {
235-
if (!zoomWrapper.value) return;
236-
wrapperWidth.value = zoomWrapper.value.getBoundingClientRect().width;
237-
};
238-
updateWidth();
239-
240-
const onWinResize = throttle(updateWidth, 50);
241-
window.addEventListener('resize', onWinResize);
242-
243-
onBeforeUnmount(() => {
244-
window.removeEventListener('resize', onWinResize);
245-
});
246-
});
247-
248233
let _commitTimeout = null;
249234
250235
function commitImmediately() {
@@ -370,16 +355,17 @@ const resizeObserver = ref(null);
370355
onMounted(() => {
371356
if (hasMinimap.value) {
372357
const handleResize = throttle(() => {
373-
if (!minimapWrapper.value) return;
374-
const { width, height } = useResponsive({ chart: minimapWrapper.value });
375-
const W = Math.max(0, Math.round(width));
376-
const H = Math.max(0, Math.round(height - 47));
377-
378-
if (W !== svgMinimap.value.width || H !== svgMinimap.value.height) {
379-
svgMinimap.value.width = W;
380-
svgMinimap.value.height = H;
381-
}
382-
}, 50);
358+
if (!minimapWrapper.value) return;
359+
const { width, height } = useResponsive({ chart: minimapWrapper.value });
360+
361+
const W = Math.max(0, Math.round(width));
362+
const H = Math.max(0, Math.round(height - 47));
363+
364+
if (W !== svgMinimap.value.width || H !== svgMinimap.value.height) {
365+
svgMinimap.value.width = W;
366+
svgMinimap.value.height = H;
367+
}
368+
}, 0);
383369
384370
resizeObserver.value = new ResizeObserver(handleResize);
385371
resizeObserver.value.observe(minimapWrapper.value);

0 commit comments

Comments
 (0)