Skip to content

Commit

Permalink
core: fix popup opening in local space of scrolled blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
tom95 committed Sep 22, 2023
1 parent e9dcb06 commit 49d2185
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/Sandblocks-Core/Morph.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ Morph >> blocksAt: aPoint do: aBlock [
(self isSandblock and: [self bounds containsPoint: aPoint]) ifTrue: [aBlock value: self]
]

{ #category : #'*Sandblocks-Core-geometry-override' }
Morph >> boundsInEditor [

^ self sandblockEditor transformToEditorSpace: self bounds from: self
]

{ #category : #'*Sandblocks-Core-layout' }
Morph >> calculateSizeForWidth: aNumber [

Expand Down
7 changes: 7 additions & 0 deletions packages/Sandblocks-Core/SBBlock.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,12 @@ SBBlock >> blockFor: anObject withInterfaces: aCollection ifOpen: aBlock ifClose
ifNone: anotherBlock
]

{ #category : #layout }
SBBlock >> boundsInEditor [

^ self sandblockEditor transformToEditorSpace: self bounds from: self
]

{ #category : #actions }
SBBlock >> browse [
<action>
Expand Down Expand Up @@ -1176,6 +1182,7 @@ SBBlock >> ensureVisible [
(method ~= self and: [method notNil and: [self visibleInWorld not]]) ifTrue: [method ensureExpanded].

self isInWorld ifTrue: [ | show |
self allOwnersDo: #fullBounds.
show := self fullBounds.
"FIXME: for insert cursors, the block bounds are not relevant but this does not belong here (assumption of selection that is not in ensureVisible)"
self sandblockEditor cursor mode = #insert ifFalse: [
Expand Down
6 changes: 6 additions & 0 deletions packages/Sandblocks-Core/SBEditor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,12 @@ SBEditor >> togglePalette [
paletteContainer selectionChanged: self selection]
]

{ #category : #'as yet unclassified' }
SBEditor >> transformToEditorSpace: aRectangle from: aMorph [

^ (aMorph bounds: aRectangle in: (aMorph ownerSatisfying: [:o | o owner = self canvas scroller])) rounded
]

{ #category : #accessing }
SBEditor >> trash [

Expand Down
2 changes: 1 addition & 1 deletion packages/Sandblocks-Core/SBPopup.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ SBPopup >> showBelow: aBlock closeOnDeselect: aBoolean [
editor := aBlock sandblockEditor.
self assert: editor notNil.
aBlock ensureLayouted.
self position: aBlock bottomLeft.
self position: aBlock boundsInEditor bottomLeft rounded.
editor openMorph: self.

aBoolean ifTrue: [
Expand Down

0 comments on commit 49d2185

Please sign in to comment.