Skip to content

Commit

Permalink
Grab only on borders. More tests. All the things
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Berger committed May 9, 2019
1 parent b8f1ea2 commit 052e9ba
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ addResizeHandles
addHandleAt: #topRight;
addHandleAt: #bottomRight;
addHandleAt: #bottomLeft;
placeHandles;
hasHandles: true]
placeHandles]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
event handling
grabOnBorder: anEvent

(self onBorder: anEvent position) ifTrue:[anEvent hand grabMorph: self content].

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
hasHandles

^ hasHandles
^ self resizeHandles notEmpty
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ initialize
super initialize.
self
color: Color transparent;
resizeHandles: Dictionary new;
hasHandles: false
resizeHandles: Dictionary new
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mouseDown: evt

self ifAnyHandleContains: evt position
do: [:handle | ^ evt hand newMouseFocus: handle].
evt hand grabMorph: self content.
self grabOnBorder: evt.
self updateSelection.
(self content handlesMouseDown: evt)
ifTrue: [^self content mouseDown: evt]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
event handling
onBorder: aPosition

^ ((Rectangle center: self center extent: self extent - (10@10)) containsPoint: aPosition) not.
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ removeResizeHandles

self resizeHandles
do: [:each | each abandon];
removeAll.
self hasHandles: false
removeAll
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"actionForCorner:" : "LB 7/24/2018 13:51",
"addContentMenuItemsTo:" : "WoC 7/24/2018 16:47",
"addHandleAt:" : "LB 7/6/2018 18:07",
"addResizeHandles" : "LM 7/13/2018 14:58",
"addResizeHandles" : "jb 5/9/2019 12:10",
"content" : "MK 7/24/2018 14:08",
"content:" : "MK 7/24/2018 14:08",
"copyChildToHand" : "MK 7/24/2018 14:08",
"createContextMenu" : "WoC 7/24/2018 16:54",
"createHandleOnMove:" : "LM 7/24/2018 17:35",
"defaultContextMenuContent" : "LM 7/13/2018 14:59",
"disablePresentationMode" : "WoC 6/17/2018 18:44",
"dragBottomLeftEvent:" : "LB 7/24/2018 13:49",
"dragBottomLeftEvent:" : "jb 5/9/2019 11:12",
"dragBottomRightEvent:" : "LB 7/24/2018 13:50",
"dragTopLeftEvent:" : "LB 7/24/2018 13:50",
"dragTopRightEvent:" : "LB 7/24/2018 13:50",
Expand All @@ -25,23 +25,24 @@
"extentTopRight:" : "LB 7/6/2018 15:57",
"filterEvent:for:" : "WoC 7/24/2018 16:53",
"grabChild" : "MK 7/24/2018 14:08",
"grabOnBorder:" : "jb 5/9/2019 12:06",
"handleColor" : "LB 7/25/2018 11:08",
"handleLayerNumber" : "MK 5/25/2018 16:26",
"handlesMouseDown:" : "VO 5/8/2019 16:50",
"hasHandles" : "MK 5/18/2018 19:42",
"hasHandles:" : "MK 5/25/2018 17:01",
"hasHandles" : "jb 5/9/2019 12:09",
"ifAnyHandleContains:do:" : "MK 5/25/2018 17:06",
"initialize" : "jb 5/8/2019 17:42",
"initialize" : "jb 5/9/2019 12:10",
"invokeContextMenu" : "WoC 7/24/2018 16:52",
"isMagnetic" : "LB 7/5/2018 21:38",
"magnetizeLayoutFractions:" : "LB 7/25/2018 11:59",
"mouseDown:" : "jb 5/8/2019 18:03",
"mouseDown:" : "jb 5/9/2019 11:06",
"mouseDownPriority" : "jb 5/8/2019 18:01",
"notifySlideRescale:" : "MK 7/24/2018 14:08",
"onBorder:" : "jb 5/9/2019 11:24",
"openMenu:" : "WoC 7/24/2018 16:52",
"placeHandles" : "LB 7/6/2018 18:10",
"rasterResolution" : "WoC 7/25/2018 12:29",
"removeResizeHandles" : "WoC 7/24/2018 17:00",
"removeResizeHandles" : "jb 5/9/2019 12:09",
"removedMorph:" : "LM 7/25/2018 13:00",
"resizeChild" : "LB 7/25/2018 11:58",
"resizeFractionsOf:" : "LB 7/25/2018 12:00",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"commentStamp" : "LM 7/24/2018 17:46",
"instvars" : [
"resizeHandles",
"hasHandles",
"content",
"slideContainer" ],
"name" : "PSContentContainer",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
as yet unclassified
testBorderDragging

| destination |
destination := self morph center + self defaultDragOffset.
self dragndrop: MouseEvent redButton from: self container leftCenter + (1@0) to: self container leftCenter + self defaultDragOffset + (1@0).
self slide fullBounds.

self assert: self morph center equals: destination
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
as yet unclassified
testNoDraggingFromCenter

| previousCenter |
previousCenter := self container center.
self dragndrop: MouseEvent redButton from: self container center to: self container center + self defaultDragOffset.
self slide fullBounds.

self assert: self container center equals: previousCenter
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
running
testOnlyOneContainerHasHandles

| newContainer newMorph |
newMorph := Morph new.
self slide addContent: newMorph.
newContainer := newMorph owner.

self assert: ({self container . newContainer} select: [:aContainer | aContainer hasHandles]) size equals: 1.

self click: MouseEvent redButton at: self morph center.

self assert: ({self container . newContainer} select: [:aContainer | aContainer hasHandles]) size equals: 1.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
"defaultDragOffset" : "MK 7/25/2018 11:50",
"setUp" : "LM 7/25/2018 13:00",
"testAbandonMorphDeletesContainer" : "LM 7/25/2018 12:52",
"testBorderDragging" : "jb 5/9/2019 12:07",
"testContainerResizingAllCorners" : "MK 7/25/2018 11:52",
"testContainerResizingCorner:" : "WoC 7/25/2018 12:18",
"testContextMenu" : "MK 7/25/2018 11:33",
"testDuplicateChild" : "LM 7/25/2018 12:48",
"testGrabbing" : "LM 7/25/2018 12:51",
"testLeavePresentationModeEnablesHandles" : "LB 7/20/2018 14:54",
"testNoDraggingFromCenter" : "jb 5/9/2019 11:54",
"testOnlyOneContainerHasHandles" : "jb 5/9/2019 12:12",
"testPresentationModeRemovesHandle" : "LB 7/20/2018 14:54",
"testRemoveMorphAbandonsContainer" : "LM 7/25/2018 12:52",
"testResizeHandleMagnetic" : "WoC 7/25/2018 12:29",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"does:answerRatio:" : "LM 7/25/2018 11:27",
"does:answerSideRatio:" : "LB 7/20/2018 14:24",
"doubleClick:at:" : "LB 7/20/2018 15:40",
"drag:from:to:" : "WoC 7/24/2018 17:49",
"drag:from:to:" : "jb 5/9/2019 11:34",
"dragndrop:from:to:" : "LB 7/13/2018 18:44",
"hand" : "LM 6/15/2018 18:41",
"keystroke:at:" : "LM 7/25/2018 11:39",
Expand Down

0 comments on commit 052e9ba

Please sign in to comment.