-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '106-extend-circle-tool' into sprint-2022-cw-20-22
- Loading branch information
Showing
51 changed files
with
187 additions
and
84 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
packages/SketchMorph2-Core.package/M2Canvas.class/instance/isShiftPressed..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
isShiftPressed: aBoolean | ||
isShiftPressed := aBoolean |
3 changes: 3 additions & 0 deletions
3
packages/SketchMorph2-Core.package/M2Canvas.class/instance/isShiftPressed.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
isShiftPressed | ||
^ isShiftPressed ifNil: [isShiftPressed := false] |
3 changes: 2 additions & 1 deletion
3
packages/SketchMorph2-Core.package/M2Canvas.class/instance/keyDown..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
event handling | ||
keyDown: aKeyboardEvent | ||
(self isControlKeyEvent: aKeyboardEvent) ifTrue: [self isCtrlPressed: true] | ||
(self isControlKeyEvent: aKeyboardEvent) ifTrue: [self isCtrlPressed: true]. | ||
(aKeyboardEvent shiftPressed) ifTrue: [self isShiftPressed: true] |
3 changes: 2 additions & 1 deletion
3
packages/SketchMorph2-Core.package/M2Canvas.class/instance/keyUp..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
event handling | ||
keyUp: aKeyboardEvent | ||
(self isControlKeyEvent: aKeyboardEvent) ifTrue: [self isCtrlPressed: false] | ||
(self isControlKeyEvent: aKeyboardEvent) ifTrue: [self isCtrlPressed: false]. | ||
self isShiftPressed: (aKeyboardEvent shiftPressed) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
packages/SketchMorph2-Core.package/M2DrawingComponent.class/instance/drawGeometricCircle.st
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
packages/SketchMorph2-Core.package/M2DrawingComponent.class/instance/drawGeometricEllipse.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
tool selection | ||
drawGeometricEllipse | ||
self context | ||
isErasing: false; | ||
mode: #geometric; | ||
currentGeometricPreviewShape: #ellipse; | ||
currentTool: #drawGeometricEllipse. | ||
self switchMode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
packages/SketchMorph2-Core.package/M2GeometricCircle.class/README.md
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
packages/SketchMorph2-Core.package/M2GeometricCircle.class/class/label.st
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
packages/SketchMorph2-Core.package/M2GeometricCircle.class/methodProperties.json
This file was deleted.
Oops, something went wrong.
Empty file.
2 changes: 1 addition & 1 deletion
2
...etricCircle.class/class/actionSelector.st → ...tricEllipse.class/class/actionSelector.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
accessing | ||
actionSelector | ||
^ #drawGeometricCircle | ||
^ #drawGeometricEllipse |
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
packages/SketchMorph2-Core.package/M2GeometricEllipse.class/class/label.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
label | ||
^ 'Ellipse Tool' |
8 changes: 8 additions & 0 deletions
8
packages/SketchMorph2-Core.package/M2GeometricEllipse.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"class" : { | ||
"actionSelector" : "ms 5/25/2022 00:33", | ||
"icon" : "ms 5/25/2022 00:34", | ||
"isActivatable" : "ms 5/25/2022 00:33", | ||
"label" : "ms 5/25/2022 00:33" }, | ||
"instance" : { | ||
} } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ort.class/instance/drawGeometricCircle.st → ...rt.class/instance/drawGeometricEllipse.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
tool selection | ||
drawGeometricCircle | ||
super drawGeometricCircle. | ||
drawGeometricEllipse | ||
super drawGeometricEllipse. | ||
self currentCursor: Cursor crossHair |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 9 additions & 7 deletions
16
...s/SketchMorph2-Core.package/M2ViewPort.class/instance/resizeTemporaryGeometricMorphAt..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
drawing | ||
resizeTemporaryGeometricMorphAt: aPoint | ||
| extent movementVector minimalSquare position | | ||
| extent movementVector rect offset | | ||
(aPoint > 0 asPoint) ifFalse: [^ self]. | ||
|
||
movementVector := aPoint - self startPoint. | ||
|
||
|
||
extent := movementVector abs. | ||
minimalSquare := (extent x min: extent y) asPoint * (movementVector sign). | ||
|
||
position := (self context currentGeometricPreviewShape = #circle) | ||
ifTrue: [self getCircleOrigin: minimalSquare] | ||
ifFalse: [aPoint min: self startPoint]. | ||
self canvas isShiftPressed ifTrue: [extent := self shiftResizeExtent: extent]. | ||
|
||
rect := Rectangle origin: (aPoint min: self startPoint) extent: extent. | ||
offset := self startPoint - (rect pointNearestTo: self startPoint). | ||
|
||
self temporaryGeometricMorph | ||
position: self canvas position + position; | ||
extent: (extent max: 1 asPoint) | ||
position: self canvas position + rect origin + offset; | ||
extent: (extent) |
10 changes: 10 additions & 0 deletions
10
packages/SketchMorph2-Core.package/M2ViewPort.class/instance/shiftResizeExtent..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
drawing | ||
shiftResizeExtent: extent | ||
| switch minExtent maxSide | | ||
minExtent := extent min: (extent transposed). | ||
maxSide := (extent max: (extent transposed) )x. | ||
switch := Dictionary new. | ||
switch at: #ellipse put: [minExtent]. | ||
switch at: #rectangle put: [minExtent]. | ||
switch at: #triangle put: [maxSide@((3 sqrt)/2*maxSide)]. | ||
^ (switch at: self context currentGeometricPreviewShape ifAbsent: [extent]) value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 8 additions & 1 deletion
9
packages/SketchMorph2-Core.package/MorphicMonet.class/instance/pasteClipboard.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
tooling | ||
pasteClipboard | ||
self importImage: Clipboard clipboardText asString | ||
|
||
(self backend context isInTextMode | ||
or: [(self findMenuItemWith: M2InsertSelection label) isEnabled not]) | ||
ifTrue: [ | ||
self importImage: Clipboard clipboardText asString. | ||
] ifFalse: [ | ||
self clickMenuItemWith: M2InsertSelection label. | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/SketchMorph2-Tests.package/M2DrawingComponentTests.class/class/notFilledEllipse.st
Large diffs are not rendered by default.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...hMorph2-Tests.package/M2DrawingComponentTests.class/class/notFilledEquilateralTriangle.st
Large diffs are not rendered by default.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
packages/SketchMorph2-Tests.package/M2DrawingComponentTests.class/class/notFilledTriangle.st
Large diffs are not rendered by default.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
packages/SketchMorph2-Tests.package/M2DrawingComponentTests.class/instance/holdShift.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
support | ||
holdShift | ||
|
||
self viewPort canvas isShiftPressed: true. |
4 changes: 4 additions & 0 deletions
4
packages/SketchMorph2-Tests.package/M2DrawingComponentTests.class/instance/releaseShift.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
support | ||
releaseShift | ||
|
||
self viewPort canvas isShiftPressed: false. |
6 changes: 4 additions & 2 deletions
6
...-Tests.package/M2DrawingComponentTests.class/instance/testCompareGeometricCircleFilled.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
testing | ||
testCompareGeometricCircleFilled | ||
self | ||
contextFillGeometricModeWithForm: #circle; | ||
contextFillGeometricModeWithForm: #ellipse; | ||
holdShift; | ||
drawFrom: (40 @ 10) to: (80 @ 90); | ||
compareBackendFormWith: #filledCircle | ||
compareBackendFormWith: #filledCircle; | ||
releaseShift |
6 changes: 4 additions & 2 deletions
6
....package/M2DrawingComponentTests.class/instance/testCompareGeometricCircleFilledNarrow.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
testing | ||
testCompareGeometricCircleFilledNarrow | ||
self | ||
contextFillGeometricModeWithForm: #circle; | ||
contextFillGeometricModeWithForm: #ellipse; | ||
holdShift; | ||
drawFrom: (10 @ 80) to: (80 @ 90); | ||
compareBackendFormWith: #filledCircleNarrow | ||
compareBackendFormWith: #filledCircleNarrow; | ||
releaseShift |
6 changes: 4 additions & 2 deletions
6
...sts.package/M2DrawingComponentTests.class/instance/testCompareGeometricCircleNotFilled.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
testing | ||
testCompareGeometricCircleNotFilled | ||
self | ||
contextGeometricModeWithForm: #circle; | ||
contextGeometricModeWithForm: #ellipse; | ||
holdShift; | ||
drawFrom: (40 @ 10) to: (80 @ 90); | ||
compareBackendFormWith: #notFilledCircle | ||
compareBackendFormWith: #notFilledCircle; | ||
releaseShift |
6 changes: 4 additions & 2 deletions
6
...s.package/M2DrawingComponentTests.class/instance/testCompareGeometricCircleOverlapping.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
testing | ||
testCompareGeometricCircleOverlapping | ||
self | ||
contextGeometricModeWithForm: #circle; | ||
contextGeometricModeWithForm: #ellipse; | ||
holdShift; | ||
drawFrom: 10 asPoint to: 40 asPoint. | ||
self context isFillingGeometricForm: true. | ||
self | ||
drawFrom: 20 asPoint to: 80 asPoint; | ||
compareBackendFormWith: #overlappingCircles | ||
compareBackendFormWith: #overlappingCircles; | ||
releaseShift |
6 changes: 6 additions & 0 deletions
6
...ts.package/M2DrawingComponentTests.class/instance/testCompareGeometricEllipseNotFilled.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
testing | ||
testCompareGeometricEllipseNotFilled | ||
self | ||
contextFillGeometricModeWithForm: #ellipse; | ||
drawFrom: (40 @ 10) to: (80 @ 90); | ||
compareBackendFormWith: #notFilledEllipse |
8 changes: 8 additions & 0 deletions
8
...2DrawingComponentTests.class/instance/testCompareGeometricEquilateralTriangleNotFilled.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
testing | ||
testCompareGeometricEquilateralTriangleNotFilled | ||
self | ||
contextFillGeometricModeWithForm: #triangle; | ||
holdShift; | ||
drawFrom: (40 @ 10) to: (80 @ 90); | ||
compareBackendFormWith: #notFilledEquilateralTriangle; | ||
releaseShift |
6 changes: 6 additions & 0 deletions
6
...s.package/M2DrawingComponentTests.class/instance/testCompareGeometricTriangleNotFilled.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
testing | ||
testCompareGeometricTriangleNotFilled | ||
self | ||
contextFillGeometricModeWithForm: #triangle; | ||
drawFrom: (40 @ 10) to: (80 @ 90); | ||
compareBackendFormWith: #notFilledTriangle |
6 changes: 4 additions & 2 deletions
6
...SketchMorph2-Tests.package/M2DrawingComponentTests.class/instance/testSingleUndoAction.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
testing | ||
testSingleUndoAction | ||
self | ||
contextFillGeometricModeWithForm: #circle; | ||
contextFillGeometricModeWithForm: #ellipse; | ||
holdShift; | ||
drawFrom: (40 @ 10) to: (80 @ 90); | ||
drawFrom: (80 @ 10) to: (80 @ 200). | ||
drawFrom: (80 @ 10) to: (80 @ 200); | ||
releaseShift. | ||
self backend undo. | ||
self compareBackendFormWith: #filledCircle |
4 changes: 3 additions & 1 deletion
4
...h2-Tests.package/M2DrawingComponentTests.class/instance/testUncommittedTemporaryCircle.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
testing | ||
testUncommittedTemporaryCircle | ||
self | ||
contextFillGeometricModeWithForm: #circle; | ||
contextFillGeometricModeWithForm: #ellipse; | ||
holdShift; | ||
dragFrom: 40 @ 10 to: 80 @ 90; | ||
compareBackendFormWith: #whiteBackground; | ||
releaseShift; | ||
finishDrawingIfNecessary; | ||
compareBackendFormWith: #filledCircle |
Oops, something went wrong.