[squeak-dev] The Inbox: MorphicExtras-kfr.340.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Dec 3 11:06:51 UTC 2022
A new version of MorphicExtras was added to project The Inbox:
http://source.squeak.org/inbox/MorphicExtras-kfr.340.mcz
==================== Summary ====================
Name: MorphicExtras-kfr.340
Author: kfr
Time: 3 December 2022, 12:06:49.470695 pm
UUID: 8756d7d9-da81-754e-b457-1a55cd46e07f
Ancestors: MorphicExtras-kfr.339
Change to make color picker cursor scale to right size.
=============== Diff against MorphicExtras-kfr.339 ===============
Item was changed:
----- Method: PaintBoxMorph>>eyedropper:action:cursor:evt: (in category 'actions') -----
eyedropper: aButton action: aSelector cursor: aCursor evt: evt
"Take total control and pick up a color!!!!"
+ | pt feedbackColor delay big |
- | pt feedbackColor delay |
delay := Delay forMilliseconds: 10.
aButton state: #on.
tool ifNotNil: [tool state: #off].
currentCursor := aCursor.
+ big := CursorWithAlpha extent: aCursor extent depth: 32.
+ (aCursor asCursorForm magnifyBy: 1) displayOn: big.
+ big offset: (aCursor offset - 0.5 min: 0 at 0 max: big extent negated) asIntegerPoint.
+ evt hand showTemporaryCursor: big.
- evt hand showTemporaryCursor: currentCursor
- hotSpotOffset: 6 negated @ 4 negated.
"<<<< the form was changed a bit??"
feedbackColor := Display colorAt: Sensor cursorPoint.
colorMemory align: colorMemory bounds topRight
with: colorMemoryThin bounds topRight.
self addMorphFront: colorMemory.
"Full color picker"
[Sensor anyButtonPressed] whileFalse:
+ [pt := Sensor cursorPoint - (13 at 9).
- [pt := Sensor cursorPoint.
"deal with the fact that 32 bit displays may have garbage in the
alpha bits"
feedbackColor := Display depth = 32
ifTrue:
[Color colorFromPixelValue: ((Display pixelValueAt: pt) bitOr: 16rFF000000)
depth: 32]
ifFalse: [Display colorAt: pt].
"the hand needs to be drawn"
evt hand position: pt.
currentColor ~= feedbackColor ifTrue: [
currentColor := feedbackColor.
self showColor ].
self refreshWorld.
delay wait].
"Now wait for the button to be released."
[Sensor anyButtonPressed] whileTrue:
[ pt := Sensor cursorPoint.
"the hand needs to be drawn"
evt hand position: pt.
self refreshWorld.
delay wait].
+ evt hand showTemporaryCursor: nil hotSpotOffset: 4 negated @ 0.
- evt hand showTemporaryCursor: nil hotSpotOffset: 0 @ 0.
self currentColor: feedbackColor evt: evt.
colorMemory delete.
tool ifNotNil:
[tool state: #on.
currentCursor := tool arguments third].
aButton state: #off
!
More information about the Squeak-dev
mailing list
|