From 7d58d6e10dc63e573ba11a140f5e5d7d4979d27e Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Sun, 9 Oct 2022 14:43:24 +1100 Subject: Enlargen ticks present in larger scale --- src/components/TimeLine.vue | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src/components/TimeLine.vue') diff --git a/src/components/TimeLine.vue b/src/components/TimeLine.vue index 82c2f67..1456598 100644 --- a/src/components/TimeLine.vue +++ b/src/components/TimeLine.vue @@ -8,16 +8,16 @@ {{Math.round(n * 100) / 100}} @@ -242,8 +242,10 @@ function onPointerMove(evt: PointerEvent){ dragDiffY += yDiff; if (dragHandler == 0){ dragHandler = setTimeout(() => { - shiftTimeline(-dragDiffY / props.height); - dragDiffY = 0; + if (Math.abs(dragDiffY) > 2){ + shiftTimeline(-dragDiffY / props.height); + dragDiffY = 0; + } dragHandler = 0; }, 50); } @@ -293,8 +295,12 @@ function onShiftWheel(evt: WheelEvent){ // Styles function tickStyles(tick: number){ let y = (tick - startDate.value) / (endDate.value - startDate.value) * props.height; + let scaleX = 1; + if (scaleIdx > 0 && tick % scales[scaleIdx-1] == 0){ // If the tick exists on the scale directly above this one + scaleX = 2; + } return { - transform: `translate(0, ${y}px)`, + transform: `translate(${props.width/2}px, ${y}px) scale(${scaleX})`, transitionProperty: 'transform', transitionDuration: '300ms', transitionTimingFunction: 'ease-out', -- cgit v1.2.3