fix: view mode cursor adjustments (#3809)

This commit is contained in:
connorhanafee 2021-07-09 18:00:13 -04:00 committed by GitHub
parent e7cbb859f0
commit 5fabc57277
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 70 additions and 3 deletions

View file

@ -343,7 +343,7 @@ class App extends React.Component<AppProps, AppState> {
style={{
width: canvasDOMWidth,
height: canvasDOMHeight,
cursor: "grabbing",
cursor: CURSOR_TYPE.GRAB,
}}
width={canvasWidth}
height={canvasHeight}
@ -1610,7 +1610,9 @@ class App extends React.Component<AppProps, AppState> {
private onKeyUp = withBatchedUpdates((event: KeyboardEvent) => {
if (event.key === KEYS.SPACE) {
if (this.state.elementType === "selection") {
if (this.state.viewModeEnabled) {
setCursor(this.canvas, CURSOR_TYPE.GRAB);
} else if (this.state.elementType === "selection") {
resetCursor(this.canvas);
} else {
setCursorForShape(this.canvas, this.state.elementType);
@ -2235,6 +2237,8 @@ class App extends React.Component<AppProps, AppState> {
this.canvas,
isTextElement(hitElement) ? CURSOR_TYPE.TEXT : CURSOR_TYPE.CROSSHAIR,
);
} else if (this.state.viewModeEnabled) {
setCursor(this.canvas, CURSOR_TYPE.GRAB);
} else if (isOverScrollBar) {
setCursor(this.canvas, CURSOR_TYPE.AUTO);
} else if (
@ -2472,7 +2476,11 @@ class App extends React.Component<AppProps, AppState> {
lastPointerUp = null;
isPanning = false;
if (!isHoldingSpace) {
setCursorForShape(this.canvas, this.state.elementType);
if (this.state.viewModeEnabled) {
setCursor(this.canvas, CURSOR_TYPE.GRAB);
} else {
setCursorForShape(this.canvas, this.state.elementType);
}
}
this.setState({
cursorButton: "up",