From b3dbb41619d8ceaa1fc135aa377b3f12d0a6bace Mon Sep 17 00:00:00 2001 From: Tom Beckmann Date: Fri, 11 Feb 2022 18:57:38 +0100 Subject: [PATCH] core: allow customizing objectInterface while dropping for droppee --- packages/Sandblocks-Core/SBBlock.class.st | 6 ++++++ packages/Sandblocks-Core/SBCursorInsert.class.st | 1 + packages/Sandblocks-Core/SBDragHelper.class.st | 5 ++++- packages/Sandblocks-Core/SBSuggestionMenu.class.st | 8 +++++--- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/Sandblocks-Core/SBBlock.class.st b/packages/Sandblocks-Core/SBBlock.class.st index 518cc4ae..432985bb 100644 --- a/packages/Sandblocks-Core/SBBlock.class.st +++ b/packages/Sandblocks-Core/SBBlock.class.st @@ -1857,6 +1857,12 @@ SBBlock >> objectInterface [ ^ self parentSandblock objectInterfaceNear: self at: #replace ] +{ #category : #'object interface' } +SBBlock >> objectInterfaceForDrop: aBlock near: anotherBlock at: aSymbol [ + + ^ self objectInterfaceNear: anotherBlock at: aSymbol +] + { #category : #'object interface' } SBBlock >> objectInterfaceNear: aBlock at: aSymbol [ diff --git a/packages/Sandblocks-Core/SBCursorInsert.class.st b/packages/Sandblocks-Core/SBCursorInsert.class.st index 1474878e..ac3e722a 100644 --- a/packages/Sandblocks-Core/SBCursorInsert.class.st +++ b/packages/Sandblocks-Core/SBCursorInsert.class.st @@ -145,6 +145,7 @@ SBCursorInsert >> enterWith: aCursor [ command suggestions ifNotEmpty: [:s | aCursor editor suggestionMenu suggestions: s; + focusOnOpen: false; openNear: aCursor requestor: command] ] diff --git a/packages/Sandblocks-Core/SBDragHelper.class.st b/packages/Sandblocks-Core/SBDragHelper.class.st index f5fdf214..df5fa96c 100644 --- a/packages/Sandblocks-Core/SBDragHelper.class.st +++ b/packages/Sandblocks-Core/SBDragHelper.class.st @@ -274,7 +274,10 @@ SBDragHelper >> mouseMove: anEvent [ ifFalse: [ self closestAdjacentTo: anEvent position in: blockAtCursor do: [:adjacent :before | (morph - convertedFor: (blockAtCursor objectInterfaceNear: adjacent at: (before ifTrue: [#before] ifFalse: [#after])) + convertedFor: (blockAtCursor + objectInterfaceForDrop: morph + near: adjacent + at: (before ifTrue: [#before] ifFalse: [#after])) do: [:res | {#insert. blockAtCursor. adjacent. before. res}]) ifNil: [{#replace. blockAtCursor}]]]]] ifNil: [#(#none nil)]. diff --git a/packages/Sandblocks-Core/SBSuggestionMenu.class.st b/packages/Sandblocks-Core/SBSuggestionMenu.class.st index 5bc9449a..8947d60d 100644 --- a/packages/Sandblocks-Core/SBSuggestionMenu.class.st +++ b/packages/Sandblocks-Core/SBSuggestionMenu.class.st @@ -177,9 +177,11 @@ SBSuggestionMenu >> initialize [ focusShortcut := SBEditor anyShortcutForAction: #focusSuggestions. self scroller - addMorphBack: (focusHint := SBStringMorph new contents: (focusShortcut - ifNotNil: ['Use ', (focusShortcut displayString, ' to focus')] - ifNil: ['Hover to focus'])); + addMorphBack: (focusHint := SBStringMorph new + contents: (focusShortcut + ifNotNil: ['Use ', (focusShortcut displayString, ' to focus')] + ifNil: ['Hover to focus']); + opacity: 0.6); addMorphBack: container ]