mirror of
https://github.com/google/blockly.git
synced 2026-01-08 17:40:09 +01:00
chore: use prettier instead of clang-format (#7014)
* chore: add and configure prettier * chore: remove clang-format * chore: remove clang-format config * chore: lint additional ts files * chore: fix lint errors in blocks * chore: add prettier-ignore where needed * chore: ignore js blocks when formatting * chore: fix playground html syntax * chore: fix yaml spacing from merge * chore: convert text blocks to use arrow functions * chore: format everything with prettier * chore: fix lint unused imports in blocks
This commit is contained in:
committed by
GitHub
parent
af991f5e1b
commit
88ff901a72
242
core/gesture.ts
242
core/gesture.ts
@@ -37,7 +37,6 @@ import {WorkspaceCommentSvg} from './workspace_comment_svg.js';
|
||||
import {WorkspaceDragger} from './workspace_dragger.js';
|
||||
import type {WorkspaceSvg} from './workspace_svg.js';
|
||||
|
||||
|
||||
/**
|
||||
* Note: In this file "start" refers to pointerdown
|
||||
* events. "End" refers to pointerup events.
|
||||
@@ -65,19 +64,19 @@ export class Gesture {
|
||||
* The bubble that the gesture started on, or null if it did not start on a
|
||||
* bubble.
|
||||
*/
|
||||
private startBubble: IBubble|null = null;
|
||||
private startBubble: IBubble | null = null;
|
||||
|
||||
/**
|
||||
* The field that the gesture started on, or null if it did not start on a
|
||||
* field.
|
||||
*/
|
||||
private startField: Field|null = null;
|
||||
private startField: Field | null = null;
|
||||
|
||||
/**
|
||||
* The block that the gesture started on, or null if it did not start on a
|
||||
* block.
|
||||
*/
|
||||
private startBlock: BlockSvg|null = null;
|
||||
private startBlock: BlockSvg | null = null;
|
||||
|
||||
/**
|
||||
* The block that this gesture targets. If the gesture started on a
|
||||
@@ -85,14 +84,14 @@ export class Gesture {
|
||||
* gesture started in the flyout, this is the root block of the block group
|
||||
* that was clicked or dragged.
|
||||
*/
|
||||
private targetBlock: BlockSvg|null = null;
|
||||
private targetBlock: BlockSvg | null = null;
|
||||
|
||||
/**
|
||||
* The workspace that the gesture started on. There may be multiple
|
||||
* workspaces on a page; this is more accurate than using
|
||||
* Blockly.common.getMainWorkspace().
|
||||
*/
|
||||
protected startWorkspace_: WorkspaceSvg|null = null;
|
||||
protected startWorkspace_: WorkspaceSvg | null = null;
|
||||
|
||||
/**
|
||||
* Whether the pointer has at any point moved out of the drag radius.
|
||||
@@ -109,19 +108,19 @@ export class Gesture {
|
||||
private boundEvents: browserEvents.Data[] = [];
|
||||
|
||||
/** The object tracking a bubble drag, or null if none is in progress. */
|
||||
private bubbleDragger: BubbleDragger|null = null;
|
||||
private bubbleDragger: BubbleDragger | null = null;
|
||||
|
||||
/** The object tracking a block drag, or null if none is in progress. */
|
||||
private blockDragger: IBlockDragger|null = null;
|
||||
private blockDragger: IBlockDragger | null = null;
|
||||
|
||||
/**
|
||||
* The object tracking a workspace or flyout workspace drag, or null if none
|
||||
* is in progress.
|
||||
*/
|
||||
private workspaceDragger: WorkspaceDragger|null = null;
|
||||
private workspaceDragger: WorkspaceDragger | null = null;
|
||||
|
||||
/** The flyout a gesture started in, if any. */
|
||||
private flyout: IFlyout|null = null;
|
||||
private flyout: IFlyout | null = null;
|
||||
|
||||
/** Boolean for sanity-checking that some code is only called once. */
|
||||
private calledUpdateIsDragging = false;
|
||||
@@ -140,7 +139,7 @@ export class Gesture {
|
||||
private isMultiTouch_ = false;
|
||||
|
||||
/** A map of cached points used for tracking multi-touch gestures. */
|
||||
private cachedPoints = new Map<string, Coordinate|null>();
|
||||
private cachedPoints = new Map<string, Coordinate | null>();
|
||||
|
||||
/**
|
||||
* This is the ratio between the starting distance between the touch points
|
||||
@@ -154,7 +153,7 @@ export class Gesture {
|
||||
private startDistance = 0;
|
||||
|
||||
/** Boolean for whether or not the workspace supports pinch-zoom. */
|
||||
private isPinchZoomEnabled: boolean|null = null;
|
||||
private isPinchZoomEnabled: boolean | null = null;
|
||||
|
||||
/**
|
||||
* The owner of the dropdownDiv when this gesture first starts.
|
||||
@@ -162,7 +161,7 @@ export class Gesture {
|
||||
* act on their events, and some fields care about who owns
|
||||
* the dropdown.
|
||||
*/
|
||||
currentDropdownOwner: Field|null = null;
|
||||
currentDropdownOwner: Field | null = null;
|
||||
|
||||
/**
|
||||
* @param e The event that kicked off this gesture.
|
||||
@@ -170,7 +169,9 @@ export class Gesture {
|
||||
* reference to it.
|
||||
*/
|
||||
constructor(
|
||||
e: PointerEvent, private readonly creatorWorkspace: WorkspaceSvg) {
|
||||
e: PointerEvent,
|
||||
private readonly creatorWorkspace: WorkspaceSvg
|
||||
) {
|
||||
this.mostRecentEvent = e;
|
||||
|
||||
/**
|
||||
@@ -235,15 +236,18 @@ export class Gesture {
|
||||
* @returns True if the drag just exceeded the drag radius for the first time.
|
||||
*/
|
||||
private updateDragDelta(currentXY: Coordinate): boolean {
|
||||
this.currentDragDeltaXY =
|
||||
Coordinate.difference(currentXY, (this.mouseDownXY));
|
||||
this.currentDragDeltaXY = Coordinate.difference(
|
||||
currentXY,
|
||||
this.mouseDownXY
|
||||
);
|
||||
|
||||
if (!this.hasExceededDragRadius) {
|
||||
const currentDragDelta = Coordinate.magnitude(this.currentDragDeltaXY);
|
||||
|
||||
// The flyout has a different drag radius from the rest of Blockly.
|
||||
const limitRadius =
|
||||
this.flyout ? config.flyoutDragRadius : config.dragRadius;
|
||||
const limitRadius = this.flyout
|
||||
? config.flyoutDragRadius
|
||||
: config.dragRadius;
|
||||
|
||||
this.hasExceededDragRadius = currentDragDelta > limitRadius;
|
||||
return this.hasExceededDragRadius;
|
||||
@@ -270,8 +274,10 @@ export class Gesture {
|
||||
throw new Error(`Cannot update dragging from the flyout because the ' +
|
||||
'flyout's target workspace is undefined`);
|
||||
}
|
||||
if (!this.flyout.isScrollable() ||
|
||||
this.flyout.isDragTowardWorkspace(this.currentDragDeltaXY)) {
|
||||
if (
|
||||
!this.flyout.isScrollable() ||
|
||||
this.flyout.isDragTowardWorkspace(this.currentDragDeltaXY)
|
||||
) {
|
||||
this.startWorkspace_ = this.flyout.targetWorkspace;
|
||||
this.startWorkspace_.updateScreenCalculationsIfScrolled();
|
||||
// Start the event group now, so that the same event group is used for
|
||||
@@ -347,13 +353,14 @@ export class Gesture {
|
||||
private updateIsDraggingWorkspace() {
|
||||
if (!this.startWorkspace_) {
|
||||
throw new Error(
|
||||
'Cannot update dragging the workspace because the ' +
|
||||
'start workspace is undefined');
|
||||
'Cannot update dragging the workspace because the ' +
|
||||
'start workspace is undefined'
|
||||
);
|
||||
}
|
||||
|
||||
const wsMovable = this.flyout ?
|
||||
this.flyout.isScrollable() :
|
||||
this.startWorkspace_ && this.startWorkspace_.isDraggable();
|
||||
const wsMovable = this.flyout
|
||||
? this.flyout.isScrollable()
|
||||
: this.startWorkspace_ && this.startWorkspace_.isDraggable();
|
||||
if (!wsMovable) return;
|
||||
|
||||
this.workspaceDragger = new WorkspaceDragger(this.startWorkspace_);
|
||||
@@ -390,10 +397,15 @@ export class Gesture {
|
||||
/** Create a block dragger and start dragging the selected block. */
|
||||
private startDraggingBlock() {
|
||||
const BlockDraggerClass = registry.getClassFromOptions(
|
||||
registry.Type.BLOCK_DRAGGER, this.creatorWorkspace.options, true);
|
||||
registry.Type.BLOCK_DRAGGER,
|
||||
this.creatorWorkspace.options,
|
||||
true
|
||||
);
|
||||
|
||||
this.blockDragger =
|
||||
new BlockDraggerClass!((this.targetBlock), (this.startWorkspace_));
|
||||
this.blockDragger = new BlockDraggerClass!(
|
||||
this.targetBlock,
|
||||
this.startWorkspace_
|
||||
);
|
||||
this.blockDragger!.startDrag(this.currentDragDeltaXY, this.healStack);
|
||||
this.blockDragger!.drag(this.mostRecentEvent, this.currentDragDeltaXY);
|
||||
}
|
||||
@@ -402,20 +414,26 @@ export class Gesture {
|
||||
private startDraggingBubble() {
|
||||
if (!this.startBubble) {
|
||||
throw new Error(
|
||||
'Cannot update dragging the bubble because the start ' +
|
||||
'bubble is undefined');
|
||||
'Cannot update dragging the bubble because the start ' +
|
||||
'bubble is undefined'
|
||||
);
|
||||
}
|
||||
if (!this.startWorkspace_) {
|
||||
throw new Error(
|
||||
'Cannot update dragging the bubble because the start ' +
|
||||
'workspace is undefined');
|
||||
'Cannot update dragging the bubble because the start ' +
|
||||
'workspace is undefined'
|
||||
);
|
||||
}
|
||||
|
||||
this.bubbleDragger =
|
||||
new BubbleDragger(this.startBubble, this.startWorkspace_);
|
||||
this.bubbleDragger = new BubbleDragger(
|
||||
this.startBubble,
|
||||
this.startWorkspace_
|
||||
);
|
||||
this.bubbleDragger.startBubbleDrag();
|
||||
this.bubbleDragger.dragBubble(
|
||||
this.mostRecentEvent, this.currentDragDeltaXY);
|
||||
this.mostRecentEvent,
|
||||
this.currentDragDeltaXY
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -428,11 +446,13 @@ export class Gesture {
|
||||
doStart(e: PointerEvent) {
|
||||
if (!this.startWorkspace_) {
|
||||
throw new Error(
|
||||
'Cannot start the touch gesture becauase the start ' +
|
||||
'workspace is undefined');
|
||||
'Cannot start the touch gesture becauase the start ' +
|
||||
'workspace is undefined'
|
||||
);
|
||||
}
|
||||
this.isPinchZoomEnabled = this.startWorkspace_.options.zoomOptions &&
|
||||
this.startWorkspace_.options.zoomOptions.pinch;
|
||||
this.isPinchZoomEnabled =
|
||||
this.startWorkspace_.options.zoomOptions &&
|
||||
this.startWorkspace_.options.zoomOptions.pinch;
|
||||
|
||||
if (browserEvents.isTargetInput(e)) {
|
||||
this.cancel();
|
||||
@@ -491,15 +511,33 @@ export class Gesture {
|
||||
* @internal
|
||||
*/
|
||||
bindMouseEvents(e: PointerEvent) {
|
||||
this.boundEvents.push(browserEvents.conditionalBind(
|
||||
document, 'pointerdown', null, this.handleStart.bind(this),
|
||||
/* opt_noCaptureIdentifier */ true));
|
||||
this.boundEvents.push(browserEvents.conditionalBind(
|
||||
document, 'pointermove', null, this.handleMove.bind(this),
|
||||
/* opt_noCaptureIdentifier */ true));
|
||||
this.boundEvents.push(browserEvents.conditionalBind(
|
||||
document, 'pointerup', null, this.handleUp.bind(this),
|
||||
/* opt_noCaptureIdentifier */ true));
|
||||
this.boundEvents.push(
|
||||
browserEvents.conditionalBind(
|
||||
document,
|
||||
'pointerdown',
|
||||
null,
|
||||
this.handleStart.bind(this),
|
||||
/* opt_noCaptureIdentifier */ true
|
||||
)
|
||||
);
|
||||
this.boundEvents.push(
|
||||
browserEvents.conditionalBind(
|
||||
document,
|
||||
'pointermove',
|
||||
null,
|
||||
this.handleMove.bind(this),
|
||||
/* opt_noCaptureIdentifier */ true
|
||||
)
|
||||
);
|
||||
this.boundEvents.push(
|
||||
browserEvents.conditionalBind(
|
||||
document,
|
||||
'pointerup',
|
||||
null,
|
||||
this.handleUp.bind(this),
|
||||
/* opt_noCaptureIdentifier */ true
|
||||
)
|
||||
);
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
@@ -530,8 +568,10 @@ export class Gesture {
|
||||
* @internal
|
||||
*/
|
||||
handleMove(e: PointerEvent) {
|
||||
if ((this.isDragging() && Touch.shouldHandleEvent(e)) ||
|
||||
!this.isMultiTouch()) {
|
||||
if (
|
||||
(this.isDragging() && Touch.shouldHandleEvent(e)) ||
|
||||
!this.isMultiTouch()
|
||||
) {
|
||||
this.updateFromEvent(e);
|
||||
if (this.workspaceDragger) {
|
||||
this.workspaceDragger.drag(this.currentDragDeltaXY);
|
||||
@@ -539,7 +579,9 @@ export class Gesture {
|
||||
this.blockDragger.drag(this.mostRecentEvent, this.currentDragDeltaXY);
|
||||
} else if (this.bubbleDragger) {
|
||||
this.bubbleDragger.dragBubble(
|
||||
this.mostRecentEvent, this.currentDragDeltaXY);
|
||||
this.mostRecentEvent,
|
||||
this.currentDragDeltaXY
|
||||
);
|
||||
}
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
@@ -618,8 +660,8 @@ export class Gesture {
|
||||
const pointers = Array.from(this.cachedPoints.keys());
|
||||
// If two pointers are down, store info
|
||||
if (pointers.length === 2) {
|
||||
const point0 = (this.cachedPoints.get(pointers[0]))!;
|
||||
const point1 = (this.cachedPoints.get(pointers[1]))!;
|
||||
const point0 = this.cachedPoints.get(pointers[0])!;
|
||||
const point1 = this.cachedPoints.get(pointers[1])!;
|
||||
this.startDistance = Coordinate.distance(point0, point1);
|
||||
this.isMultiTouch_ = true;
|
||||
e.preventDefault();
|
||||
@@ -653,23 +695,28 @@ export class Gesture {
|
||||
private handlePinch(e: PointerEvent) {
|
||||
const pointers = Array.from(this.cachedPoints.keys());
|
||||
// Calculate the distance between the two pointers
|
||||
const point0 = (this.cachedPoints.get(pointers[0]))!;
|
||||
const point1 = (this.cachedPoints.get(pointers[1]))!;
|
||||
const point0 = this.cachedPoints.get(pointers[0])!;
|
||||
const point1 = this.cachedPoints.get(pointers[1])!;
|
||||
const moveDistance = Coordinate.distance(point0, point1);
|
||||
const scale = moveDistance / this.startDistance;
|
||||
|
||||
if (this.previousScale > 0 && this.previousScale < Infinity) {
|
||||
const gestureScale = scale - this.previousScale;
|
||||
const delta = gestureScale > 0 ? gestureScale * ZOOM_IN_MULTIPLIER :
|
||||
gestureScale * ZOOM_OUT_MULTIPLIER;
|
||||
const delta =
|
||||
gestureScale > 0
|
||||
? gestureScale * ZOOM_IN_MULTIPLIER
|
||||
: gestureScale * ZOOM_OUT_MULTIPLIER;
|
||||
if (!this.startWorkspace_) {
|
||||
throw new Error(
|
||||
'Cannot handle a pinch because the start workspace ' +
|
||||
'is undefined');
|
||||
'Cannot handle a pinch because the start workspace ' + 'is undefined'
|
||||
);
|
||||
}
|
||||
const workspace = this.startWorkspace_;
|
||||
const position = browserEvents.mouseToSvg(
|
||||
e, workspace.getParentSvg(), workspace.getInverseScreenCTM());
|
||||
e,
|
||||
workspace.getParentSvg(),
|
||||
workspace.getInverseScreenCTM()
|
||||
);
|
||||
workspace.zoom(position.x, position.y, delta);
|
||||
}
|
||||
this.previousScale = scale;
|
||||
@@ -700,7 +747,7 @@ export class Gesture {
|
||||
* @returns The current touch point coordinate
|
||||
* @internal
|
||||
*/
|
||||
getTouchPoint(e: PointerEvent): Coordinate|null {
|
||||
getTouchPoint(e: PointerEvent): Coordinate | null {
|
||||
if (!this.startWorkspace_) {
|
||||
return null;
|
||||
}
|
||||
@@ -733,7 +780,9 @@ export class Gesture {
|
||||
Touch.longStop();
|
||||
if (this.bubbleDragger) {
|
||||
this.bubbleDragger.endBubbleDrag(
|
||||
this.mostRecentEvent, this.currentDragDeltaXY);
|
||||
this.mostRecentEvent,
|
||||
this.currentDragDeltaXY
|
||||
);
|
||||
} else if (this.blockDragger) {
|
||||
this.blockDragger.endDrag(this.mostRecentEvent, this.currentDragDeltaXY);
|
||||
} else if (this.workspaceDragger) {
|
||||
@@ -777,8 +826,9 @@ export class Gesture {
|
||||
handleWsStart(e: PointerEvent, ws: WorkspaceSvg) {
|
||||
if (this.gestureHasStarted) {
|
||||
throw Error(
|
||||
'Tried to call gesture.handleWsStart, ' +
|
||||
'but the gesture had already been started.');
|
||||
'Tried to call gesture.handleWsStart, ' +
|
||||
'but the gesture had already been started.'
|
||||
);
|
||||
}
|
||||
this.setStartWorkspace(ws);
|
||||
this.mostRecentEvent = e;
|
||||
@@ -792,7 +842,8 @@ export class Gesture {
|
||||
*/
|
||||
private fireWorkspaceClick(ws: WorkspaceSvg) {
|
||||
eventUtils.fire(
|
||||
new (eventUtils.get(eventUtils.CLICK))(null, ws.id, 'workspace'));
|
||||
new (eventUtils.get(eventUtils.CLICK))(null, ws.id, 'workspace')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -805,8 +856,9 @@ export class Gesture {
|
||||
handleFlyoutStart(e: PointerEvent, flyout: IFlyout) {
|
||||
if (this.gestureHasStarted) {
|
||||
throw Error(
|
||||
'Tried to call gesture.handleFlyoutStart, ' +
|
||||
'but the gesture had already been started.');
|
||||
'Tried to call gesture.handleFlyoutStart, ' +
|
||||
'but the gesture had already been started.'
|
||||
);
|
||||
}
|
||||
this.setStartFlyout(flyout);
|
||||
this.handleWsStart(e, flyout.getWorkspace());
|
||||
@@ -822,8 +874,9 @@ export class Gesture {
|
||||
handleBlockStart(e: PointerEvent, block: BlockSvg) {
|
||||
if (this.gestureHasStarted) {
|
||||
throw Error(
|
||||
'Tried to call gesture.handleBlockStart, ' +
|
||||
'but the gesture had already been started.');
|
||||
'Tried to call gesture.handleBlockStart, ' +
|
||||
'but the gesture had already been started.'
|
||||
);
|
||||
}
|
||||
this.setStartBlock(block);
|
||||
this.mostRecentEvent = e;
|
||||
@@ -839,8 +892,9 @@ export class Gesture {
|
||||
handleBubbleStart(e: PointerEvent, bubble: IBubble) {
|
||||
if (this.gestureHasStarted) {
|
||||
throw Error(
|
||||
'Tried to call gesture.handleBubbleStart, ' +
|
||||
'but the gesture had already been started.');
|
||||
'Tried to call gesture.handleBubbleStart, ' +
|
||||
'but the gesture had already been started.'
|
||||
);
|
||||
}
|
||||
this.setStartBubble(bubble);
|
||||
this.mostRecentEvent = e;
|
||||
@@ -863,8 +917,8 @@ export class Gesture {
|
||||
private doFieldClick() {
|
||||
if (!this.startField) {
|
||||
throw new Error(
|
||||
'Cannot do a field click because the start field is ' +
|
||||
'undefined');
|
||||
'Cannot do a field click because the start field is ' + 'undefined'
|
||||
);
|
||||
}
|
||||
|
||||
// Only show the editor if the field's editor wasn't already open
|
||||
@@ -882,8 +936,8 @@ export class Gesture {
|
||||
if (this.flyout && this.flyout.autoClose) {
|
||||
if (!this.targetBlock) {
|
||||
throw new Error(
|
||||
'Cannot do a block click because the target block is ' +
|
||||
'undefined');
|
||||
'Cannot do a block click because the target block is ' + 'undefined'
|
||||
);
|
||||
}
|
||||
if (this.targetBlock.isEnabled()) {
|
||||
if (!eventUtils.getGroup()) {
|
||||
@@ -895,12 +949,16 @@ export class Gesture {
|
||||
} else {
|
||||
if (!this.startWorkspace_) {
|
||||
throw new Error(
|
||||
'Cannot do a block click because the start workspace ' +
|
||||
'is undefined');
|
||||
'Cannot do a block click because the start workspace ' +
|
||||
'is undefined'
|
||||
);
|
||||
}
|
||||
// Clicks events are on the start block, even if it was a shadow.
|
||||
const event = new (eventUtils.get(eventUtils.CLICK))(
|
||||
this.startBlock, this.startWorkspace_.id, 'block');
|
||||
this.startBlock,
|
||||
this.startWorkspace_.id,
|
||||
'block'
|
||||
);
|
||||
eventUtils.fire(event);
|
||||
}
|
||||
this.bringBlockToFront();
|
||||
@@ -948,8 +1006,9 @@ export class Gesture {
|
||||
setStartField<T>(field: Field<T>) {
|
||||
if (this.gestureHasStarted) {
|
||||
throw Error(
|
||||
'Tried to call gesture.setStartField, ' +
|
||||
'but the gesture had already been started.');
|
||||
'Tried to call gesture.setStartField, ' +
|
||||
'but the gesture had already been started.'
|
||||
);
|
||||
}
|
||||
if (!this.startField) {
|
||||
this.startField = field as Field;
|
||||
@@ -1063,10 +1122,14 @@ export class Gesture {
|
||||
* @returns Whether this gesture was a click on a field.
|
||||
*/
|
||||
private isFieldClick(): boolean {
|
||||
const fieldClickable =
|
||||
this.startField ? this.startField.isClickable() : false;
|
||||
return fieldClickable && !this.hasExceededDragRadius &&
|
||||
(!this.flyout || !this.flyout.autoClose);
|
||||
const fieldClickable = this.startField
|
||||
? this.startField.isClickable()
|
||||
: false;
|
||||
return (
|
||||
fieldClickable &&
|
||||
!this.hasExceededDragRadius &&
|
||||
(!this.flyout || !this.flyout.autoClose)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1077,7 +1140,7 @@ export class Gesture {
|
||||
*/
|
||||
private isWorkspaceClick(): boolean {
|
||||
const onlyTouchedWorkspace =
|
||||
!this.startBlock && !this.startBubble && !this.startField;
|
||||
!this.startBlock && !this.startBubble && !this.startField;
|
||||
return onlyTouchedWorkspace && !this.hasExceededDragRadius;
|
||||
}
|
||||
|
||||
@@ -1092,8 +1155,9 @@ export class Gesture {
|
||||
* @internal
|
||||
*/
|
||||
isDragging(): boolean {
|
||||
return !!this.workspaceDragger || !!this.blockDragger ||
|
||||
!!this.bubbleDragger;
|
||||
return (
|
||||
!!this.workspaceDragger || !!this.blockDragger || !!this.bubbleDragger
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1129,7 +1193,7 @@ export class Gesture {
|
||||
* @returns The dragger that is currently in use or null if no drag is in
|
||||
* progress.
|
||||
*/
|
||||
getCurrentDragger(): WorkspaceDragger|BubbleDragger|IBlockDragger|null {
|
||||
getCurrentDragger(): WorkspaceDragger | BubbleDragger | IBlockDragger | null {
|
||||
return this.blockDragger ?? this.workspaceDragger ?? this.bubbleDragger;
|
||||
}
|
||||
|
||||
@@ -1140,7 +1204,7 @@ export class Gesture {
|
||||
*/
|
||||
static inProgress(): boolean {
|
||||
const workspaces = common.getAllWorkspaces();
|
||||
for (let i = 0, workspace; workspace = workspaces[i]; i++) {
|
||||
for (let i = 0, workspace; (workspace = workspaces[i]); i++) {
|
||||
// Not actually necessarily a WorkspaceSvg, but it doesn't matter b/c
|
||||
// we're just checking if the property exists. Theoretically we would
|
||||
// want to use instanceof, but that causes a circular dependency.
|
||||
|
||||
Reference in New Issue
Block a user