[Etoys] [Fix] Horizontal and Vertical Flips
subbukk
subbukk at gmail.com
Fri Nov 9 14:10:15 EST 2007
Hi,
Attached is a patch that adds horizontal and vertical flip commands to the
viewer along with some fixes to the corresponding player commands.
It should now be easy to create sketches with mirror symmetry.
Subbu
-------------- next part --------------
'From etoys2.2 of 3 October 2007 [latest update: #1753] on 6 November 2007 at 12:01:44 am'!
"Change Set: flipfixes
Date: 5 November 2007
Author: kks
Fixed flip methods in Player to invoke these only on SketchMorphs and added commands to viewer"!
!Player methodsFor: 'costume' stamp: 'kks 11/5/2007 23:54'!
flipHorizontal
| cos |
((cos _ self costume renderedMorph) isSketchMorph)
ifTrue:
[cos flipHorizontal]! !
!Player methodsFor: 'costume' stamp: 'kks 11/5/2007 23:54'!
flipVertical
| cos |
((cos _ self costume renderedMorph) isSketchMorph)
ifTrue:
[cos flipVertical]! !
!SketchMorph class methodsFor: 'scripting' stamp: 'kks 11/5/2007 23:43'!
additionsToViewerCategories
"Answer a list of (<categoryName> <list of category specs>) pairs that characterize the phrases this kind of morph wishes to add to various Viewer categories."
^ #((graphics (
(slot graphic 'The picture currently being worn' Graphic readWrite Player getGraphic Player setGraphic:)
(command wearCostumeOf: 'wear the costume of...' Player)
(slot baseGraphic 'The picture originally painted for this object, but can subsequently be changed via menu or script' Graphic readWrite Player getBaseGraphic Player setBaseGraphic:)
(command restoreBaseGraphic 'Make my picture be the one I remember in my baseGraphic')
(slot rotationStyle 'How the picture should change when the heading is modified' RotationStyle readWrite Player getRotationStyle Player setRotationStyle:)
(command flipHorizontal 'Flip left right' Player)
(command flipVertical 'Flip up down' Player)
)))
! !
More information about the Etoys
mailing list