Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1592.mcz ==================== Summary ==================== Name: Morphic-mt.1592 Author: mt Time: 22 November 2019, 5:38:54.489669 pm UUID: 7611ae0c-a1d0-ea42-84c5-0d2474fe2643 Ancestors: Morphic-mt.1591 Move rotation-specific stuff from Etoys to Morphic. It is used in Morphic anyway. #heading, #heading: #rotationDegrees, #rotationDegrees: #referencePosition, #referencePosition: #forwardDirection, #forwardDirection: =============== Diff against Morphic-mt.1591 =============== Item was added: + ----- Method: CircleMorph>>heading (in category 'rotate scale and flex') ----- + heading + "Overwritten to store the angle in #forwardDirection." + + ^ self rotationDegrees! Item was changed: + ----- Method: CircleMorph>>heading: (in category 'rotate scale and flex') ----- - ----- Method: CircleMorph>>heading: (in category 'geometry eToy') ----- heading: newHeading + "Overwritten to store the angle in #forwardDirection." + - "Set the receiver's heading (in eToy terms). - Note that circles never use flex shells." self rotationDegrees: newHeading.! Item was changed: + ----- Method: MatrixTransformMorph>>heading (in category 'rotate scale and flex') ----- - ----- Method: MatrixTransformMorph>>heading (in category 'geometry eToy') ----- heading "Return the receiver's heading (in eToy terms)" ^ self forwardDirection + self innerAngle! Item was added: + ----- Method: MatrixTransformMorph>>heading: (in category 'rotate scale and flex') ----- + heading: newHeading + "Set the receiver's heading (in eToy terms)" + self rotateBy: ((newHeading - self forwardDirection) - self innerAngle).! Item was changed: + ----- Method: MatrixTransformMorph>>setDirectionFrom: (in category 'rotate scale and flex') ----- - ----- Method: MatrixTransformMorph>>setDirectionFrom: (in category 'geometry eToy') ----- setDirectionFrom: aPoint | delta degrees | delta := (self transformFromWorld globalPointToLocal: aPoint) - super rotationCenter. degrees := delta degrees + 90.0. self forwardDirection: (degrees \\ 360) rounded. ! Item was changed: + ----- Method: Morph>>forwardDirection (in category 'rotate scale and flex') ----- - ----- Method: Morph>>forwardDirection (in category 'accessing') ----- forwardDirection + "Return the receiver's offset to distinguish #heading from #rotationDegrees." + + ^ self valueOfProperty: #forwardDirection ifAbsent: [0.0]! - "Return the receiver's forward direction (in eToy terms)" - ^self valueOfProperty: #forwardDirection ifAbsent:[0.0]! Item was added: + ----- Method: Morph>>forwardDirection: (in category 'rotate scale and flex') ----- + forwardDirection: newDirection + + self setProperty: #forwardDirection toValue: newDirection.! Item was added: + ----- Method: Morph>>heading (in category 'rotate scale and flex') ----- + heading + "Answer the current heading, which is #rotationDegrees relative to the #forwardDirection." + + ^ self rotationDegrees + self forwardDirection! Item was added: + ----- Method: Morph>>heading: (in category 'rotate scale and flex') ----- + heading: newHeading + + self rotationDegrees: (newHeading - self forwardDirection).! Item was changed: ----- Method: Morph>>rotationDegrees (in category 'rotate scale and flex') ----- rotationDegrees - "Default implementation." + self isFlexed ifFalse: [^ 0.0]. + self owner in: [:flexShell | ^ flexShell rotationDegrees].! - ^ 0.0 - ! Item was added: + ----- Method: Morph>>rotationDegrees: (in category 'rotate scale and flex') ----- + rotationDegrees: degrees + + self isFlexed ifFalse: [self addFlexShell]. + self owner in: [:flexShell | flexShell rotationDegrees: degrees].! Item was added: + ----- Method: Morph>>setDirectionFrom: (in category 'rotate scale and flex') ----- + setDirectionFrom: aPoint + | delta degrees | + delta := (self transformFromWorld globalPointToLocal: aPoint) - self referencePosition. + degrees := delta degrees + 90.0. + self forwardDirection: (degrees \\ 360) rounded. + ! Item was added: + ----- Method: PolygonMorph>>heading (in category 'rotate scale and flex') ----- + heading + "Overwritten to store the angle in #forwardDirection." + + ^ self rotationDegrees! Item was added: + ----- Method: PolygonMorph>>heading: (in category 'rotate scale and flex') ----- + heading: newHeading + "Overwritten to store the angle in #forwardDirection." + + self rotationDegrees: newHeading.! Item was changed: + ----- Method: PolygonMorph>>rotationDegrees: (in category 'rotate scale and flex') ----- - ----- Method: PolygonMorph>>rotationDegrees: (in category 'halo control') ----- rotationDegrees: degrees | flex center | (center := self valueOfProperty: #referencePosition) ifNil: [self setProperty: #referencePosition toValue: (center := self bounds center)]. flex := (MorphicTransform offset: center negated) withAngle: (degrees - self forwardDirection) degreesToRadians. self setVertices: (vertices collect: [:v | (flex transform: v) - flex offset]). self forwardDirection: degrees. ! Item was added: + ----- Method: SketchMorph>>heading: (in category 'rotate scale and flex') ----- + heading: newHeading + "If not rotating normally, change forward direction rather than heading" + rotationStyle == #normal ifTrue:[^super heading: newHeading]. + self isFlexed + ifTrue:[self forwardDirection: newHeading - owner rotationDegrees] + ifFalse:[self forwardDirection: newHeading]. + self layoutChanged! Item was removed: - ----- Method: TransformationMorph>>degreesOfFlex (in category 'geometry eToy') ----- - degreesOfFlex - "Return any rotation due to flexing" - ^ self rotationDegrees! Item was changed: + ----- Method: TransformationMorph>>forwardDirection (in category 'rotate scale and flex') ----- - ----- Method: TransformationMorph>>forwardDirection (in category 'accessing') ----- forwardDirection "Return the rendee's forward direction. If I have no rendee then return 0.0 degrees " | rendee | ( rendee := self renderedMorph) == self ifTrue: [ ^ 0.0 ] . ^ rendee forwardDirection! Item was changed: + ----- Method: TransformationMorph>>forwardDirection: (in category 'rotate scale and flex') ----- - ----- Method: TransformationMorph>>forwardDirection: (in category 'geometry eToy') ----- forwardDirection: degrees "If we have a rendee set its forward direction. Else do nothing." | rendee | ( rendee := self renderedMorph) == self ifTrue: [ ^ self ] . ^rendee forwardDirection: degrees! Item was changed: + ----- Method: TransformationMorph>>heading (in category 'rotate scale and flex') ----- - ----- Method: TransformationMorph>>heading (in category 'geometry eToy') ----- heading "End recusion when necessary." | rendee | (rendee := self renderedMorph) == self ifTrue: [ ^0.0 ] . ^ rendee heading! Item was changed: + ----- Method: TransformationMorph>>heading: (in category 'rotate scale and flex') ----- - ----- Method: TransformationMorph>>heading: (in category 'geometry eToy') ----- heading: newHeading "If we have a rendee set its heading. Else do nothing." | rendee | ( rendee := self renderedMorph) == self ifTrue: [ ^ self ] . ^rendee heading: newHeading! Item was changed: ----- Method: TransformationMorph>>rotationDegrees (in category 'rotate scale and flex') ----- rotationDegrees + "Overwritten because we can directly inform about the rotation." + ^ self angle radiansToDegrees negated! Item was changed: + ----- Method: TransformationMorph>>rotationDegrees: (in category 'rotate scale and flex') ----- - ----- Method: TransformationMorph>>rotationDegrees: (in category 'accessing') ----- rotationDegrees: degrees + "Overwritten because we know how to rotate our submorphs." + self adjustAfter:[self angle: degrees degreesToRadians negated]! Item was changed: + ----- Method: TransformationMorph>>setDirectionFrom: (in category 'rotate scale and flex') ----- - ----- Method: TransformationMorph>>setDirectionFrom: (in category 'geometry eToy') ----- setDirectionFrom: aPoint | delta degrees inner | inner := self renderedMorph. inner == self ifTrue:[^self]. delta := (inner transformFromWorld globalPointToLocal: aPoint) - inner referencePosition. degrees := delta degrees + 90.0. self forwardDirection: (degrees \\ 360) rounded. ! |
Just when you're moving things from Etoys into Morphic, what's about the other way around?
In Morph category classification: Wouldn't #demandsBoolean belong into Etoys? What was #modalTile for and is it obsolete now? Then all the #is*Tile selectors: Shouldn't they be moved into an Etoys extension category and their senders too? That looks terribly coupled ...
Best, Christoph Von: Squeak-dev <[hidden email]> im Auftrag von [hidden email] <[hidden email]>
Gesendet: Freitag, 22. November 2019 17:39:01 An: [hidden email]; [hidden email] Betreff: [squeak-dev] The Trunk: Morphic-mt.1592.mcz Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1592.mcz ==================== Summary ==================== Name: Morphic-mt.1592 Author: mt Time: 22 November 2019, 5:38:54.489669 pm UUID: 7611ae0c-a1d0-ea42-84c5-0d2474fe2643 Ancestors: Morphic-mt.1591 Move rotation-specific stuff from Etoys to Morphic. It is used in Morphic anyway. #heading, #heading: #rotationDegrees, #rotationDegrees: #referencePosition, #referencePosition: #forwardDirection, #forwardDirection: =============== Diff against Morphic-mt.1591 =============== Item was added: + ----- Method: CircleMorph>>heading (in category 'rotate scale and flex') ----- + heading + "Overwritten to store the angle in #forwardDirection." + + ^ self rotationDegrees! Item was changed: + ----- Method: CircleMorph>>heading: (in category 'rotate scale and flex') ----- - ----- Method: CircleMorph>>heading: (in category 'geometry eToy') ----- heading: newHeading + "Overwritten to store the angle in #forwardDirection." + - "Set the receiver's heading (in eToy terms). - Note that circles never use flex shells." self rotationDegrees: newHeading.! Item was changed: + ----- Method: MatrixTransformMorph>>heading (in category 'rotate scale and flex') ----- - ----- Method: MatrixTransformMorph>>heading (in category 'geometry eToy') ----- heading "Return the receiver's heading (in eToy terms)" ^ self forwardDirection + self innerAngle! Item was added: + ----- Method: MatrixTransformMorph>>heading: (in category 'rotate scale and flex') ----- + heading: newHeading + "Set the receiver's heading (in eToy terms)" + self rotateBy: ((newHeading - self forwardDirection) - self innerAngle).! Item was changed: + ----- Method: MatrixTransformMorph>>setDirectionFrom: (in category 'rotate scale and flex') ----- - ----- Method: MatrixTransformMorph>>setDirectionFrom: (in category 'geometry eToy') ----- setDirectionFrom: aPoint | delta degrees | delta := (self transformFromWorld globalPointToLocal: aPoint) - super rotationCenter. degrees := delta degrees + 90.0. self forwardDirection: (degrees \\ 360) rounded. ! Item was changed: + ----- Method: Morph>>forwardDirection (in category 'rotate scale and flex') ----- - ----- Method: Morph>>forwardDirection (in category 'accessing') ----- forwardDirection + "Return the receiver's offset to distinguish #heading from #rotationDegrees." + + ^ self valueOfProperty: #forwardDirection ifAbsent: [0.0]! - "Return the receiver's forward direction (in eToy terms)" - ^self valueOfProperty: #forwardDirection ifAbsent:[0.0]! Item was added: + ----- Method: Morph>>forwardDirection: (in category 'rotate scale and flex') ----- + forwardDirection: newDirection + + self setProperty: #forwardDirection toValue: newDirection.! Item was added: + ----- Method: Morph>>heading (in category 'rotate scale and flex') ----- + heading + "Answer the current heading, which is #rotationDegrees relative to the #forwardDirection." + + ^ self rotationDegrees + self forwardDirection! Item was added: + ----- Method: Morph>>heading: (in category 'rotate scale and flex') ----- + heading: newHeading + + self rotationDegrees: (newHeading - self forwardDirection).! Item was changed: ----- Method: Morph>>rotationDegrees (in category 'rotate scale and flex') ----- rotationDegrees - "Default implementation." + self isFlexed ifFalse: [^ 0.0]. + self owner in: [:flexShell | ^ flexShell rotationDegrees].! - ^ 0.0 - ! Item was added: + ----- Method: Morph>>rotationDegrees: (in category 'rotate scale and flex') ----- + rotationDegrees: degrees + + self isFlexed ifFalse: [self addFlexShell]. + self owner in: [:flexShell | flexShell rotationDegrees: degrees].! Item was added: + ----- Method: Morph>>setDirectionFrom: (in category 'rotate scale and flex') ----- + setDirectionFrom: aPoint + | delta degrees | + delta := (self transformFromWorld globalPointToLocal: aPoint) - self referencePosition. + degrees := delta degrees + 90.0. + self forwardDirection: (degrees \\ 360) rounded. + ! Item was added: + ----- Method: PolygonMorph>>heading (in category 'rotate scale and flex') ----- + heading + "Overwritten to store the angle in #forwardDirection." + + ^ self rotationDegrees! Item was added: + ----- Method: PolygonMorph>>heading: (in category 'rotate scale and flex') ----- + heading: newHeading + "Overwritten to store the angle in #forwardDirection." + + self rotationDegrees: newHeading.! Item was changed: + ----- Method: PolygonMorph>>rotationDegrees: (in category 'rotate scale and flex') ----- - ----- Method: PolygonMorph>>rotationDegrees: (in category 'halo control') ----- rotationDegrees: degrees | flex center | (center := self valueOfProperty: #referencePosition) ifNil: [self setProperty: #referencePosition toValue: (center := self bounds center)]. flex := (MorphicTransform offset: center negated) withAngle: (degrees - self forwardDirection) degreesToRadians. self setVertices: (vertices collect: [:v | (flex transform: v) - flex offset]). self forwardDirection: degrees. ! Item was added: + ----- Method: SketchMorph>>heading: (in category 'rotate scale and flex') ----- + heading: newHeading + "If not rotating normally, change forward direction rather than heading" + rotationStyle == #normal ifTrue:[^super heading: newHeading]. + self isFlexed + ifTrue:[self forwardDirection: newHeading - owner rotationDegrees] + ifFalse:[self forwardDirection: newHeading]. + self layoutChanged! Item was removed: - ----- Method: TransformationMorph>>degreesOfFlex (in category 'geometry eToy') ----- - degreesOfFlex - "Return any rotation due to flexing" - ^ self rotationDegrees! Item was changed: + ----- Method: TransformationMorph>>forwardDirection (in category 'rotate scale and flex') ----- - ----- Method: TransformationMorph>>forwardDirection (in category 'accessing') ----- forwardDirection "Return the rendee's forward direction. If I have no rendee then return 0.0 degrees " | rendee | ( rendee := self renderedMorph) == self ifTrue: [ ^ 0.0 ] . ^ rendee forwardDirection! Item was changed: + ----- Method: TransformationMorph>>forwardDirection: (in category 'rotate scale and flex') ----- - ----- Method: TransformationMorph>>forwardDirection: (in category 'geometry eToy') ----- forwardDirection: degrees "If we have a rendee set its forward direction. Else do nothing." | rendee | ( rendee := self renderedMorph) == self ifTrue: [ ^ self ] . ^rendee forwardDirection: degrees! Item was changed: + ----- Method: TransformationMorph>>heading (in category 'rotate scale and flex') ----- - ----- Method: TransformationMorph>>heading (in category 'geometry eToy') ----- heading "End recusion when necessary." | rendee | (rendee := self renderedMorph) == self ifTrue: [ ^0.0 ] . ^ rendee heading! Item was changed: + ----- Method: TransformationMorph>>heading: (in category 'rotate scale and flex') ----- - ----- Method: TransformationMorph>>heading: (in category 'geometry eToy') ----- heading: newHeading "If we have a rendee set its heading. Else do nothing." | rendee | ( rendee := self renderedMorph) == self ifTrue: [ ^ self ] . ^rendee heading: newHeading! Item was changed: ----- Method: TransformationMorph>>rotationDegrees (in category 'rotate scale and flex') ----- rotationDegrees + "Overwritten because we can directly inform about the rotation." + ^ self angle radiansToDegrees negated! Item was changed: + ----- Method: TransformationMorph>>rotationDegrees: (in category 'rotate scale and flex') ----- - ----- Method: TransformationMorph>>rotationDegrees: (in category 'accessing') ----- rotationDegrees: degrees + "Overwritten because we know how to rotate our submorphs." + self adjustAfter:[self angle: degrees degreesToRadians negated]! Item was changed: + ----- Method: TransformationMorph>>setDirectionFrom: (in category 'rotate scale and flex') ----- - ----- Method: TransformationMorph>>setDirectionFrom: (in category 'geometry eToy') ----- setDirectionFrom: aPoint | delta degrees inner | inner := self renderedMorph. inner == self ifTrue:[^self]. delta := (inner transformFromWorld globalPointToLocal: aPoint) - inner referencePosition. degrees := delta degrees + 90.0. self forwardDirection: (degrees \\ 360) rounded. !
Carpe Squeak!
|
Hi Christoph, yeah, that decision has to be made on a case-by-case basis. It's still a long way to go to improve (or even fix) the modularity issues of Etoys. Still, it's nothing to be worried about for the upcoming 5.3 release. :-) Best, Marcel
|
Free forum by Nabble | Edit this page |