Skip to content

Commit

Permalink
core: allow customizing objectInterface while dropping for droppee
Browse files Browse the repository at this point in the history
  • Loading branch information
tom95 committed Feb 11, 2022
1 parent bd61eb3 commit b3dbb41
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
6 changes: 6 additions & 0 deletions packages/Sandblocks-Core/SBBlock.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 [

Expand Down
1 change: 1 addition & 0 deletions packages/Sandblocks-Core/SBCursorInsert.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ SBCursorInsert >> enterWith: aCursor [
command suggestions ifNotEmpty: [:s |
aCursor editor suggestionMenu
suggestions: s;
focusOnOpen: false;
openNear: aCursor requestor: command]
]

Expand Down
5 changes: 4 additions & 1 deletion packages/Sandblocks-Core/SBDragHelper.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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)].

Expand Down
8 changes: 5 additions & 3 deletions packages/Sandblocks-Core/SBSuggestionMenu.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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
]

Expand Down

0 comments on commit b3dbb41

Please sign in to comment.