-
boundsActivity [control defaults]
self flushMovementVector.
self sensor waitNoButton
-
clickActivity [control defaults]
self flushMovementVector.
self model clickAt: self mouse2dPoint.
self sensor waitNoButton
-
mouseMovedEvent: event [events]
self viewHasCursor
ifTrue:
[| state |
state := self model buttonState.
state isNil ifTrue: [JunCursors crossCursor show].
state = #pick ifTrue: [Cursor normal show].
state = #grab ifTrue: [JunCursors handCursor show].
state = #drag ifTrue: [JunCursors quartersCursor show].
state = #focus ifTrue: [JunCursors glassCursor show]]
ifFalse: [Cursor normal show].
^nil
-
nibColor [private]
^ColorValue magenta
-
nibWidth [private]
^3
-
pencilActivity [control defaults]
| mouse gc pointCollection current previous index array4 array3 array2 points viewSize |
self flushMovementVector.
mouse := self sensor.
gc := self view graphicsContext.
gc paint: self nibColor.
gc lineWidth: self nibWidth.
gc capStyle: gc class capRound.
gc joinStyle: gc class joinRound.
pointCollection := OrderedCollection new: 1024.
current := previous := mouse cursorPoint.
pointCollection add: current.
index := 1.
array4 := Array new: 4.
array3 := Array new: 3.
array2 := Array new: 2.
self view displayOn: gc
dotBox: ((current extent: 1 @ 1) expandedBy: (self nibWidth // 2 max: 0)).
[mouse redButtonPressed] whileTrue:
[current := mouse cursorPoint.
((current = previous) not and: [(current dist: previous) >= 8])
ifTrue:
[pointCollection add: current.
index := index + 1.
index >= 4
ifTrue:
[array4 at: 1 put: (pointCollection at: index - 3).
array4 at: 2 put: (pointCollection at: index - 2).
array4 at: 3 put: (pointCollection at: index - 1).
array4 at: 4 put: (pointCollection at: index).
points := array4]
ifFalse:
[index >= 3
ifTrue:
[array3 at: 1 put: (pointCollection at: index - 2).
array3 at: 2 put: (pointCollection at: index - 1).
array3 at: 3 put: (pointCollection at: index).
points := array3]
ifFalse:
[array2 at: 1 put: (pointCollection at: index - 1).
array2 at: 2 put: (pointCollection at: index).
points := array2]].
gc displayPolyline: points.
previous := current].
Processor yield].
viewSize := self view bounds width max: self view bounds height.
(pointCollection first dist: pointCollection last) > (viewSize / 2)
ifTrue:
[gc displayPolyline: pointCollection.
self sensor shiftDown
ifFalse: [self model pencilOpenedPointCollection: pointCollection from: self].
self view redisplay]
ifFalse:
[pointCollection first = pointCollection last
ifFalse: [pointCollection add: pointCollection first].
gc displayPolyline: pointCollection.
self sensor shiftDown
ifFalse: [self model pencilClosedPointCollection: pointCollection from: self].
self view redisplay]
-
redButtonActivity [control defaults]
| state |
state := self model buttonState.
state = #pick
ifTrue:
[(self model pickButton respondsTo: #selectedSelector)
ifTrue:
[| symbol |
symbol := self model pickButton selectedSelector.
symbol = #pickNormal
ifTrue: [^Cursor normal showWhile: [self pickActivity]].
symbol = #pickBounds
ifTrue: [^JunCursors crossCursor showWhile: [self boundsActivity]].
symbol = #pickPencil
ifTrue: [^JunCursors pencilCursor showWhile: [self pencilActivity]]]
ifFalse: [^Cursor normal showWhile: [self pickActivity]]].
state = #grab
ifTrue: [^JunCursors handCursor showWhile: [self grabActivity]].
state = #drag
ifTrue: [^JunCursors quartersCursor showWhile: [self dragActivity]].
state = #focus
ifTrue: [^JunCursors glassCursor showWhile: [self focusActivity]].
^Cursor bull showWhile: [self clickActivity]
-
yellowButtonActivity [control defaults]
super yellowButtonActivity ifNil: [^nil].
"self model is3d
ifTrue:
[| state |
self
assert:
[state := self model buttonState.
state = #grab ifFalse: [self model buttonState: #grab]]
do: [JunCursors handCursor showWhile: [self grabActivity]]
ensure: [self model buttonState: state]]."
^self processMenuAt: self sensor globalCursorPoint centered: true