From 105585657da75f26739f68abbb060a553afebfcc Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Wed, 28 Feb 2024 19:34:19 +0000 Subject: [PATCH 1/5] fix: shouldPreventMove not being respected --- core/block_dragger.ts | 56 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/core/block_dragger.ts b/core/block_dragger.ts index 8d57344ea2e..c2acb08b64e 100644 --- a/core/block_dragger.ts +++ b/core/block_dragger.ts @@ -71,8 +71,18 @@ export class BlockDragger implements IBlockDragger { /** Whether the block would be deleted if dropped immediately. */ protected wouldDeleteBlock_ = false; + protected startXY_: Coordinate; + /** The parent block at the start of the drag. */ + private startParentConn: RenderedConnection | null = null; + + /** + * The child block at the start of the drag. Only gets set if + * `healStack` is true. + */ + private startChildConn: RenderedConnection | null = null; + /** * @deprecated To be removed in v11. Updating icons is now handled by the * block's `moveDuringDrag` method. @@ -137,6 +147,13 @@ export class BlockDragger implements IBlockDragger { blockAnimation.disconnectUiStop(); if (this.shouldDisconnect_(healStack)) { + this.startParentConn = + this.draggingBlock_.outputConnection?.targetConnection ?? + this.draggingBlock_.previousConnection?.targetConnection; + if (healStack) { + this.startChildConn = + this.draggingBlock_.nextConnection?.targetConnection; + } this.disconnectBlock_(healStack, currentDragDeltaXY); } this.draggingBlock_.setDragging(true); @@ -424,17 +441,10 @@ export class BlockDragger implements IBlockDragger { .getLayerManager() ?.moveOffDragLayer(this.draggingBlock_, layers.BLOCK); this.draggingBlock_.setDragging(false); - if (delta) { - // !preventMove + if (preventMove) { + this.moveToOriginalPosition(); + } else if (delta) { this.updateBlockAfterMove_(); - } else { - // Blocks dragged directly from a flyout may need to be bumped into - // bounds. - bumpObjects.bumpIntoBounds( - this.draggingBlock_.workspace, - this.workspace_.getMetricsManager().getScrollMetrics(true), - this.draggingBlock_, - ); } } // Must dispose after `updateBlockAfterMove_` is called to not break the @@ -445,6 +455,32 @@ export class BlockDragger implements IBlockDragger { eventUtils.setGroup(false); } + /** + * Moves the dragged block back to its original position before the start of + * the drag. Reconnects any parent and child blocks.\ + */ + private moveToOriginalPosition() { + this.startChildConn?.connect(this.draggingBlock_.nextConnection); + if (this.startParentConn) { + switch (this.startParentConn?.type) { + case ConnectionType.INPUT_VALUE: + this.startParentConn?.connect(this.draggingBlock_.outputConnection); + break; + case ConnectionType.NEXT_STATEMENT: + this.startParentConn?.connect(this.draggingBlock_.previousConnection); + } + } else { + this.draggingBlock_.moveTo(this.startXY_, ['drag']); + // Blocks dragged directly from a flyout may need to be bumped into + // bounds. + bumpObjects.bumpIntoBounds( + this.draggingBlock_.workspace, + this.workspace_.getMetricsManager().getScrollMetrics(true), + this.draggingBlock_, + ); + } + } + /** * Calculates the drag delta and new location values after a block is dragged. * From 04d175bed4f84b62fdf1dc8c7e3ecf36ede9f4fe Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 5 Mar 2024 21:50:30 +0000 Subject: [PATCH 2/5] fix: PR comments --- core/block_dragger.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/block_dragger.ts b/core/block_dragger.ts index c2acb08b64e..972c5fa2bea 100644 --- a/core/block_dragger.ts +++ b/core/block_dragger.ts @@ -457,17 +457,17 @@ export class BlockDragger implements IBlockDragger { /** * Moves the dragged block back to its original position before the start of - * the drag. Reconnects any parent and child blocks.\ + * the drag. Reconnects any parent and child blocks. */ private moveToOriginalPosition() { this.startChildConn?.connect(this.draggingBlock_.nextConnection); if (this.startParentConn) { - switch (this.startParentConn?.type) { + switch (this.startParentConn.type) { case ConnectionType.INPUT_VALUE: - this.startParentConn?.connect(this.draggingBlock_.outputConnection); + this.startParentConn.connect(this.draggingBlock_.outputConnection); break; case ConnectionType.NEXT_STATEMENT: - this.startParentConn?.connect(this.draggingBlock_.previousConnection); + this.startParentConn.connect(this.draggingBlock_.previousConnection); } } else { this.draggingBlock_.moveTo(this.startXY_, ['drag']); From 9bc96570e2a470df0743352d8cd0edee3b2b2dd4 Mon Sep 17 00:00:00 2001 From: "Evan W. Patton" Date: Tue, 21 Jan 2025 19:18:49 -0500 Subject: [PATCH 3/5] fix: Insertion marker inline should match original block Change-Id: Iaf0375fe0f30612965730d72836e9fba0a2e61f4 --- core/connection_previewers/insertion_marker_previewer.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/core/connection_previewers/insertion_marker_previewer.ts b/core/connection_previewers/insertion_marker_previewer.ts index 414d8dfe7da..3038502287d 100644 --- a/core/connection_previewers/insertion_marker_previewer.ts +++ b/core/connection_previewers/insertion_marker_previewer.ts @@ -158,6 +158,7 @@ export class InsertionMarkerPreviewer implements IConnectionPreviewer { private createInsertionMarker(origBlock: BlockSvg) { const result = this.workspace.newBlock(origBlock.type); result.setInsertionMarker(true); + result.setInputsInline(origBlock.getInputsInline()); if (origBlock.saveExtraState) { const state = origBlock.saveExtraState(true); if (state && result.loadExtraState) { From e34b8c8b48033fb1981e65c3fc421601af08c703 Mon Sep 17 00:00:00 2001 From: "Evan W. Patton" Date: Tue, 21 Jan 2025 19:22:29 -0500 Subject: [PATCH 4/5] release: v10.5.0-beta.1 Change-Id: Ibb13574e499354033b9ce1858910d85d069eef5b --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a7ac581f02d..d0f30e3f48d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blockly", - "version": "10.4.3", + "version": "10.5.0-beta.1", "description": "Blockly is a library for building visual programming editors.", "keywords": [ "blockly" From b4c6ff0b1bfb5005f678ac05d220bf8015e12f60 Mon Sep 17 00:00:00 2001 From: "Evan W. Patton" Date: Wed, 19 Feb 2025 17:22:59 -0500 Subject: [PATCH 5/5] fix: Address control color and opacity concerns Change-Id: I3d76b3cac3e5a2a4c9a4c6a7a5bfba08f810e5f9 --- core/trashcan.ts | 4 ++-- media/sprites.png | Bin 2595 -> 2653 bytes media/sprites.svg | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/trashcan.ts b/core/trashcan.ts index 42c32ea1f34..b253a6f320d 100644 --- a/core/trashcan.ts +++ b/core/trashcan.ts @@ -736,10 +736,10 @@ const ANIMATION_LENGTH = 80; const ANIMATION_FRAMES = 4; /** The minimum (resting) opacity of the trashcan and lid. */ -const OPACITY_MIN = 0.4; +const OPACITY_MIN = 1.0; /** The maximum (hovered) opacity of the trashcan and lid. */ -const OPACITY_MAX = 0.8; +const OPACITY_MAX = 1.0; /** * The maximum angle the trashcan lid can opens to. At the end of the open diff --git a/media/sprites.png b/media/sprites.png index 20aadb6c4c31f4a46f0a3316241788687c2fc444..18f844bdfdc92096af96fbf2669c032c6e2c2ba3 100644 GIT binary patch literal 2653 zcmcIm=U3AS7EJ;nBoqZyK!H%CZv?~w1TiALy1 zjO>mWdxU6yzN4CxT0eC}@E|jn5D-YX{cnIf1IxURnv$W$&Y|{!KA{ghg71JHJa};K z9?n0+%OmK{xxnDNxtsc@j}}+WjjlOFN=pf0He~nm;~#aG?j=7OA{oB@twD=F zpjfGL=#&K2S;7E0@k#qf-n4&Vy~c8dcKd;{`rWA?O%;cStVVottr3vIpRE2^jo5`j ztBv43&msaLM&1R)pNNR6C%ciijrNFLKQA3H&XxJ$z)C#tcuK(+)x5k7pn}S*D?N%> z*>;;?t`t?0JVL=QHrF9IdUUf8kaP_iahy8q@ycaWhYEf=6t}7ZrrFU|oj}rhwWF11 zO9jE(`f#%zS*m_0^^*-qlV^(WR-Zu0sKm_IYqa#>o$Z~ZxO^H=oZyHCV>E)!1hth4 zbi=X8ARSYd@9mb&>6qqY_jwNtVby8R`r`du1j|;r1mqGi+7=j`T<~uzS`n%kgT7wZ z&o5?GB+q@FhTh@zRAqWYAqQ~+s`;b{!4lop7Ja^jR6>O9b?s23#fm4fWmU#$QFdJ-; z$nQ2r6C~m!Z;3rqPWDC8A4$_1JtL~w$GWHrw8_fqe%gsG=M(AbJo)Yb;TRd_b)8Ir{HdkkFY^lco5%|!-NT%wD!>sh*47}xaidayP;_| z@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^21 zX8BC5m5MiLn;XToil~}jC7ZnQ*cE)uu?O_fTedo6xs>8;QS)9C3?g~8i72Ylr;I@a z4dzU{i1pFOvrH~O$`sKz8kEUvT2Xa))_>7z&4O?EJlduF;zM0t@&OM<+=4OQ-Q+p< zsRW;u9pk1m!hN#=pElj=>t=IkH0j;X!Hy2_C)e)KYQfvWZ$s)Duax!UPf9Era0=o1 zMM%a9Bx^K9yl+;}xXCG~g1Bdp&Uk-5|557e{l7^u%;-{>r+b)}9zMitAApvIrtWbK z^l>e1drh>S7D`V?_o#-3o`!~43zhnhLO_t`HSehZU$~YhA+ui)|NDYnkat*wdx#eh U5s_{tbPxc{jI3}k4Bg2828>m$`2YX_ diff --git a/media/sprites.svg b/media/sprites.svg index 3f09ef3a4d6..aa78ff742ea 100644 --- a/media/sprites.svg +++ b/media/sprites.svg @@ -18,16 +18,16 @@ text-anchor: middle; } .trash { - fill: #888; + fill: #000; } .zoom { fill: none; - stroke: #888; + stroke: #000; stroke-width: 2; stroke-linecap: round; } .zoom>.center { - fill: #888; + fill: #000; stroke-width: 0; }