File tree Expand file tree Collapse file tree
packages/app-frontend/src/features/timeline Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import { dimColor, boostColor } from '@front/util/color'
2929
3030const LAYER_SIZE = 16
3131const GROUP_SIZE = 6
32+ const MIN_CAMERA_SIZE = 10
3233
3334installUnsafeEval (PIXI )
3435
@@ -733,13 +734,20 @@ export default defineComponent({
733734 function drawTimeGrid () {
734735 if (! timeGrid .visible || ! app .view .width ) return
735736
736- const ratio = (endTime .value - startTime .value ) / app .view .width
737+ const size = endTime .value - startTime .value
738+ const ratio = size / app .view .width
737739 let timeInterval = 10
738740 let width = timeInterval / ratio
739741
740- while (width < 20 ) {
741- timeInterval *= 10
742- width *= 10
742+ if (size <= MIN_CAMERA_SIZE * 3 ) {
743+ // Every ms
744+ timeInterval = 1
745+ width = timeInterval / ratio
746+ } else {
747+ while (width < 20 ) {
748+ timeInterval *= 10
749+ width *= 10
750+ }
743751 }
744752
745753 const offset = startTime .value % timeInterval / ratio
@@ -798,8 +806,8 @@ export default defineComponent({
798806 const center = size * centerRatio + startTime .value
799807
800808 let newSize = size + event .deltaY / viewWidth * size * 2
801- if (newSize < 10 ) {
802- newSize = 10
809+ if (newSize < MIN_CAMERA_SIZE ) {
810+ newSize = MIN_CAMERA_SIZE
803811 }
804812
805813 let start = center - newSize * centerRatio
You can’t perform that action at this time.
0 commit comments