Levente Uzonyi uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ul.1393.mcz ==================== Summary ==================== Name: Morphic-ul.1393 Author: ul Time: 5 February 2018, 9:11:37.44438 pm UUID: a9608a85-3f47-45e1-9316-fabd23e326d1 Ancestors: Morphic-tpr.1392 - avoid multiple #halo sends in some methods sending #halo to Morphs - minor improvement to Morph>>updateDropShadowCache's performance - removed a sender of #fixTemps - use ByteArray literals instead of Arrays =============== Diff against Morphic-tpr.1392 =============== Item was changed: ----- Method: BalloonMorph class>>getVertices: (in category 'private') ----- getVertices: bounds "Construct vertices for a balloon up and to left of anchor" | corners | + corners := bounds corners atAll: #[1 4 3 2]. - corners := bounds corners atAll: #(1 4 3 2). ^ (Array with: corners first + (0 - bounds width // 2 @ 0) with: corners first + (0 - bounds width // 4 @ (bounds height // 2))) , corners! Item was changed: ----- Method: HandMorph>>halo: (in category 'halo handling') ----- halo: newHalo "Set halo associated with this hand" + | oldHalo | + (oldHalo := self halo) == newHalo ifTrue: [ ^self ]. + oldHalo ifNotNil: [ oldHalo delete ]. - oldHalo := self halo. - (oldHalo isNil or:[oldHalo == newHalo]) ifFalse:[oldHalo delete]. newHalo ifNil:[self removeProperty: #halo] ifNotNil:[self setProperty: #halo toValue: newHalo]! Item was changed: ----- Method: HandMorph>>removeHalo (in category 'halo handling') ----- removeHalo "remove the receiver's halo (if any)" + + self halo ifNotNil: [ :halo | + halo delete. + self removeProperty: #halo ]! - | halo | - halo := self halo. - halo - ifNil: [^ self]. - halo delete. - self removeProperty: #halo! Item was changed: ----- Method: HandMorph>>selectedObject (in category 'selected object') ----- selectedObject "answer the selected object for the hand or nil is none" + + ^self halo ifNotNil: [ :halo | halo target renderedMorph ]! - | halo | - halo := self halo. - halo isNil - ifTrue: [^ nil]. - ^ halo target renderedMorph! Item was changed: ----- Method: HandMorph>>spawnMagicHaloFor: (in category 'halo handling') ----- spawnMagicHaloFor: aMorph + + self halo ifNotNil: [ :halo | + halo target == aMorph ifTrue:[ ^self ] ]. - (self halo notNil and:[self halo target == aMorph]) ifTrue:[^self]. aMorph addMagicHaloFor: self.! Item was changed: ----- Method: Morph>>removeHalo (in category 'halos and balloon help') ----- removeHalo "remove the surrounding halo (if any)" + + self halo ifNotNil: [ self primaryHand removeHalo ]! - self halo isNil - ifFalse: [self primaryHand removeHalo]! Item was changed: ----- Method: Morph>>updateDropShadowCache (in category 'drawing') ----- updateDropShadowCache + | shadowOffset shadowBounds offset form canvas drawBlock localBounds mask maskCanvas | + (shadowOffset := self shadowOffset) isRectangle + ifTrue: [ + shadowBounds := 0@0 corner: (self bounds outsetBy: shadowOffset) extent. + offset := 0@0. + localBounds := shadowOffset topLeft extent: self extent ] + ifFalse: [ + | extent | + extent := self extent. + shadowBounds := 0@0 corner: extent + shadowOffset abs. + offset := shadowOffset max: 0@0. + localBounds := (shadowOffset negated max: 0@0) extent: extent ]. - | shadowBounds offset form canvas drawBlock localBounds mask maskCanvas | - shadowBounds := self shadowOffset isRectangle - ifTrue: [0@0 corner: (self bounds outsetBy: self shadowOffset) extent] - ifFalse: [0@0 corner: self extent + self shadowOffset abs]. - offset := self shadowOffset isRectangle - ifTrue: [0@0] - ifFalse: [self shadowOffset max: 0@0]. - localBounds := self shadowOffset isRectangle - ifTrue: [self shadowOffset topLeft extent: self extent] - ifFalse: [(self shadowOffset negated max: 0@0) extent: self extent]. form := Form extent: shadowBounds extent depth: Display depth. canvas := form getCanvas. drawBlock := self useSoftDropShadow ifFalse: [ [:c | self wantsRoundedCorners ifTrue: [c fillRoundRect: localBounds radius: self cornerRadius fillStyle: self shadowColor] ifFalse: [c fillRectangle: localBounds fillStyle: self shadowColor]]] ifTrue: [ [:c | self wantsRoundedCorners ifTrue: [0 to: 9 do: [:i | c fillRoundRect: (shadowBounds insetBy: i) radius: (self cornerRadius max: 20) -i fillStyle: (self shadowColor alpha: self shadowColor alpha * (i+1))]] ifFalse: [0 to: 9 do: [:i | c fillRoundRect: (shadowBounds insetBy: i) radius: 20-i fillStyle: (self shadowColor alpha: self shadowColor alpha * (i+1))]]]]. canvas translateBy: offset during: [ :shadowCanvas | drawBlock value: shadowCanvas]. "Support transparent morph colors without having the shadow to shine through.." mask := Form extent: shadowBounds extent depth: Display depth. maskCanvas := mask getCanvas. self wantsRoundedCorners ifTrue: [maskCanvas fillRoundRect: (localBounds insetBy: self borderWidth) radius: self cornerRadius fillStyle: Color black] ifFalse: [maskCanvas fillRectangle: (localBounds insetBy: self borderWidth) fillStyle: Color black]. mask displayOn: form at: 0@0 rule: Form erase. self setProperty: #dropShadow toValue: form.! Item was changed: ----- Method: SelectionMorph>>justDroppedInto:event: (in category 'dropping/grabbing') ----- justDroppedInto: newOwner event: evt "This message is sent to a dropped morph after it has been dropped on -- and been accepted by -- a drop-sensitive morph" selectedItems isEmpty ifTrue: ["Hand just clicked down to draw out a new selection" ^ self extendByHand: evt hand]. dupLoc ifNotNil: [dupDelta := self position - dupLoc]. selectedItems reverseDo: [:m | WorldState addDeferredUIMessage: [m referencePosition: (newOwner localPointToGlobal: m referencePosition). newOwner handleDropMorph: + (DropEvent new setPosition: evt cursorPoint contents: m hand: evt hand)]]. - (DropEvent new setPosition: evt cursorPoint contents: m hand: evt hand)] fixTemps]. selectedItems := nil. self removeHalo. + self halo ifNotNil: [ :halo | halo visible: false ]. - self halo ifNotNil: [self halo visible: false]. self delete. evt wasHandled: true! |
Free forum by Nabble | Edit this page |