Skip to content

Commit

Permalink
refactor: Remove block and workspace drag surfaces (#6758)
Browse files Browse the repository at this point in the history
* refactor: Remove BlockDragSurface.

* refactor: Remove WorkspaceDragSurfaceSvg.

* chore: Remove drag surface-related CSS.

* chore: Removed unused variable in block_dragger.ts.

* chore: Remove references to drag surfaces in comments.

* refactor: Only track icons with visible bubbles for position updates during a drag.

* fix: Remove rendundant condition.

* fix: Remove arg inadvertently reintroduced in merge
  • Loading branch information
gonfunko authored Jan 20, 2023
1 parent 5ee2c49 commit 332c0fd
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 790 deletions.
245 changes: 0 additions & 245 deletions core/block_drag_surface.ts

This file was deleted.

15 changes: 4 additions & 11 deletions core/block_dragger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class BlockDragger implements IBlockDragger {
}

/**
* Start dragging a block. This includes moving it to the drag surface.
* Start dragging a block.
*
* @param currentDragDeltaXY How far the pointer has moved from the position
* at mouse down, in pixel units.
Expand Down Expand Up @@ -124,10 +124,6 @@ export class BlockDragger implements IBlockDragger {
this.disconnectBlock_(healStack, currentDragDeltaXY);
}
this.draggingBlock_.setDragging(true);
// For future consideration: we may be able to put moveToDragSurface inside
// the block dragger, which would also let the block not track the block
// drag surface.
this.draggingBlock_.moveToDragSurface();
}

/**
Expand Down Expand Up @@ -221,16 +217,11 @@ export class BlockDragger implements IBlockDragger {

const preventMove = !!this.dragTarget_ &&
this.dragTarget_.shouldPreventMove(this.draggingBlock_);
let newLoc: Coordinate;
let delta: Coordinate|null = null;
if (preventMove) {
newLoc = this.startXY_;
} else {
if (!preventMove) {
const newValues = this.getNewLocationAfterDrag_(currentDragDeltaXY);
delta = newValues.delta;
newLoc = newValues.newLocation;
}
this.draggingBlock_.moveOffDragSurface(newLoc);

if (this.dragTarget_) {
this.dragTarget_.onDrop(this.draggingBlock_);
Expand Down Expand Up @@ -442,6 +433,8 @@ function initIconData(block: BlockSvg): IconPositionData[] {
for (let i = 0, descendant; descendant = descendants[i]; i++) {
const icons = descendant.getIcons();
for (let j = 0; j < icons.length; j++) {
// Only bother to track icons whose bubble is visible.
if (!icons[j].isVisible()) continue;
const data = {
// Coordinate with x and y properties (workspace
// coordinates).
Expand Down
Loading

0 comments on commit 332c0fd

Please sign in to comment.