Improve scene editor scrolling speed to be faster/slower according to the zoom level (#3279)

This commit is contained in:
Clément Pasteau
2021-11-23 11:33:21 +01:00
committed by GitHub
parent 9fb36a375f
commit dc19f030fc

View File

@@ -164,12 +164,16 @@ export default class InstancesEditor extends Component<Props> {
});
this.pixiRenderer.view.onwheel = (event: any) => {
const zoomFactor = this.getZoomFactor();
if (this.keyboardShortcuts.shouldZoom()) {
this.zoomOnCursorBy(-event.deltaY / 5000);
} else if (this.keyboardShortcuts.shouldScrollHorizontally()) {
this.viewPosition.scrollBy(-event.deltaY / 10, 0);
const deltaX = event.deltaY / (5 * zoomFactor);
this.viewPosition.scrollBy(-deltaX, 0);
} else {
this.viewPosition.scrollBy(event.deltaX / 10, event.deltaY / 10);
const deltaX = event.deltaX / (5 * zoomFactor);
const deltaY = event.deltaY / (5 * zoomFactor);
this.viewPosition.scrollBy(deltaX, deltaY);
}
if (this.props.onViewPositionChanged) {