Zoom on cursor | Issue #940 (#2319)

This commit is contained in:
João Forja 2020-11-04 17:49:15 +00:00 committed by GitHub
parent facde7ace0
commit 566e6a5ede
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 912 additions and 357 deletions

View file

@ -3,7 +3,7 @@ import { Avatar } from "../components/Avatar";
import { register } from "./register";
import { getClientColors, getClientInitials } from "../clients";
import { Collaborator } from "../types";
import { normalizeScroll } from "../scene";
import { centerScrollOn } from "../scene/scroll";
export const actionGoToCollaborator = register({
name: "goToCollaborator",
@ -16,8 +16,14 @@ export const actionGoToCollaborator = register({
return {
appState: {
...appState,
scrollX: normalizeScroll(appState.width / 2 - point.x),
scrollY: normalizeScroll(appState.height / 2 - point.y),
...centerScrollOn({
scenePoint: point,
viewportDimensions: {
width: appState.width,
height: appState.height,
},
zoom: appState.zoom,
}),
// Close mobile menu
openMenu: appState.openMenu === "canvas" ? null : appState.openMenu,
},