mirror of
https://github.com/jlfwong/speedscope.git
synced 2024-11-22 22:14:25 +03:00
Fix weird zoom wrapping issue
This commit is contained in:
parent
9fdcb8ed1d
commit
7da9a14c2c
@ -8,7 +8,7 @@ import { Flamechart } from './flamechart'
|
||||
import * as regl from 'regl'
|
||||
import { vec3, ReglCommand, ReglCommandConstructor } from 'regl'
|
||||
|
||||
import { Rect, Vec2, AffineTransform } from './math'
|
||||
import { Rect, Vec2, AffineTransform, clamp } from './math'
|
||||
import { atMostOnceAFrame } from "./utils";
|
||||
import { rectangleBatchRenderer, RectangleBatchRendererProps } from "./rectangle-batch-renderer"
|
||||
import { FlamechartMinimapView } from "./flamechart-minimap-view"
|
||||
@ -403,7 +403,6 @@ export class FlamechartPanZoomView extends ReloadableComponent<FlamechartPanZoom
|
||||
|
||||
const physicalCenter = this.logicalToPhysicalViewSpace().transformPosition(logicalViewSpaceCenter)
|
||||
const configSpaceCenter = this.configSpaceToPhysicalViewSpace().inverseTransformPosition(physicalCenter)
|
||||
|
||||
if (!configSpaceCenter) return
|
||||
|
||||
if (multiplier < 1 && this.configSpaceViewportRect.width() <= this.minConfigSpaceViewportRectWidth()) {
|
||||
@ -473,6 +472,8 @@ export class FlamechartPanZoomView extends ReloadableComponent<FlamechartPanZoom
|
||||
multiplier = 1 + (ev.deltaY / 40)
|
||||
}
|
||||
|
||||
multiplier = clamp(multiplier, 0.1, 10.0)
|
||||
|
||||
this.zoom(new Vec2(ev.offsetX, ev.offsetY), multiplier)
|
||||
} else if (this.interactionLock !== 'zoom') {
|
||||
this.pan(new Vec2(ev.deltaX, ev.deltaY))
|
||||
|
@ -161,7 +161,9 @@ export class Flamechart {
|
||||
this.minFrameWidth = Infinity
|
||||
for (let layer of this.layers) {
|
||||
for (let frame of layer) {
|
||||
this.minFrameWidth = Math.min(this.minFrameWidth, frame.end - frame.start)
|
||||
const width = frame.end - frame.start
|
||||
if (!width) continue
|
||||
this.minFrameWidth = Math.min(this.minFrameWidth, width)
|
||||
}
|
||||
}
|
||||
this.selectFrameColors(profile)
|
||||
|
Loading…
Reference in New Issue
Block a user