Skip to content

Commit

Permalink
core: fix issues with nested scrollers
Browse files Browse the repository at this point in the history
  • Loading branch information
tom95 committed Oct 16, 2023
1 parent 667ffcc commit e079450
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
8 changes: 5 additions & 3 deletions packages/Sandblocks-Core/SBBlock.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2676,9 +2676,11 @@ SBBlock >> selectLast [
<multiSelectAction>
<inputAction>

self containingFloat lastDeepChild
select;
startInputAtEnd
| last |
last := nil.
self containingFloat cursorPositionsDo: [:c | c isText ifTrue: [last := c]].

last ifNotNil: [self sandblockEditor cursorPosition: last]
]

{ #category : #'as yet unclassified' }
Expand Down
10 changes: 8 additions & 2 deletions packages/Sandblocks-Core/SBCursorSelect.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ SBCursorSelect >> block: aBlock [
{ #category : #'as yet unclassified' }
SBCursorSelect >> bounds [

^ self block bounds expandBy: 4
^ self block bounds expandBy: self outset
]

{ #category : #'as yet unclassified' }
Expand All @@ -43,7 +43,7 @@ SBCursorSelect >> drawOn: aCanvas in: aRectangle color: aColor [
self block borderVertices
ifNotNil: [:v |
aCanvas
drawPolygon: v
drawPolygon: (v collect: [:p | p translateBy: aRectangle origin + self outset - self block position])
color: nil
borderWidth: self block frameSize
borderColor: aColor]
Expand Down Expand Up @@ -113,6 +113,12 @@ SBCursorSelect >> moveHorizontal: aNumber wordWise: aBoolean [
^ self adjacentPosition: aNumber in: self block sandblockEditor
]

{ #category : #'as yet unclassified' }
SBCursorSelect >> outset [

^ 4
]

{ #category : #'as yet unclassified' }
SBCursorSelect >> printOn: aStream [

Expand Down
2 changes: 1 addition & 1 deletion packages/Sandblocks-Core/SBEditorCanvas.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ SBEditorCanvas >> currentPosition [
{ #category : #'geometry testing' }
SBEditorCanvas >> defaultColor [

^ (self sandblockEditor ifNotNil: [:editor | editor colorPolicy ifNotNil: [:c | c colorForEditor: self]]) ifNil: [Color white]
^ (self sandblockEditor ifNotNil: [:editor | editor colorPolicy ifNotNil: [:c | c colorForEditor: editor]]) ifNil: [Color white]
]

{ #category : #drawing }
Expand Down
6 changes: 3 additions & 3 deletions packages/Sandblocks-Core/SBMoveDecorator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ SBMoveDecorator >> mouseUp: anEvent [

{ #category : #stepping }
SBMoveDecorator >> panWhenNearEdge [

| noScrollRectangle movement canvasExtent canvas |
self morph sandblockEditor isSingleArtefactView ifTrue: [^ self].
(self morph sandblockEditor isSingleArtefactView or: [self morph parentSandblock ~= self morph sandblockEditor]) ifTrue: [^ self].

canvas := self morph sandblockEditor canvas.
canvasExtent := canvas extent.
noScrollRectangle := (canvas targetPosition extent: canvasExtent) insetBy: canvasExtent / SBPreferences edgePanZone.

movement := ((noScrollRectangle vectorToPoint: lastDragPosition) * SBPreferences edgePanSpeed / canvasExtent) asIntegerPoint.
movement := ((noScrollRectangle vectorToPoint: lastDragPosition) * SBPreferences edgePanSpeed / canvasExtent) asIntegerPoint.
self morph sandblockEditor moveViewport: movement negated.
self morph position: self morph position + movement.
lastDragPosition := lastDragPosition + movement
Expand Down

0 comments on commit e079450

Please sign in to comment.