Hilaire Fernandes wrote:
How do you turn image dropped in the image as ImageMorph?
Inspect the SketchMorph and do it: ImageMorph new image: originalForm;openInWorld
Or file in this change set that adds a menu item that toggles SketchMorphs scalability.
Karl
Hilaire
2008/4/22, karl karl.ramberg@comhem.se:
Hilaire Fernandes wrote:
A simple pedagogical activity about measure for primary school students. http://swiki.ofset.org:8000/super/337 You need to install Squeakland: http://www.squeakland.org/
Eventually I would like to be able to lock the resize of the sticker.
Hilaire
My French is really horrible but I recognize animal names :-) If you use ImageMorphs they will not resize.
Karl
'From etoys3.0 of 24 February 2008 [latest update: #1985] on 22 April 2008 at 4:47:36 pm'! "Change Set: UnscalableSketch Date: 22 April 2008 Author: Karl Ramberg
Adds a menu item to toggle scalability if a picture"!
Morph subclass: #SketchMorph instanceVariableNames: 'originalForm rotationStyle scalePoint framesToDwell rotatedForm unscalable ' classVariableNames: '' poolDictionaries: '' category: 'Morphic-Basic'!
!SketchMorph methodsFor: 'geometry' stamp: '<no author> 4/22/2008 16:21'! extent: newExtent "Change my scale to fit myself into the given extent. Avoid extents where X or Y is zero." unscalable ifNotNil:[ unscalable ifTrue:[^self]]. (newExtent y = 0 or: [ newExtent x = 0 ]) ifTrue: [ ^self ]. self extent = newExtent ifTrue:[^self]. scalePoint _ newExtent asFloatPoint / (originalForm extent max: 1@1). self layoutChanged. ! !
!SketchMorph methodsFor: 'menu' stamp: 'kfr 4/22/2008 16:36'! toggleUnscalable ^self unscalable: (self unscalable not)! !
!SketchMorph methodsFor: 'menu' stamp: 'kfr 4/22/2008 16:30'! unscalable unscalable ifNil:[unscalable _ false]. ^unscalable! !
!SketchMorph methodsFor: 'menu' stamp: 'kfr 4/22/2008 16:42'! unscalableString ^ (self unscalable ifTrue: ['<yes>'] ifFalse: ['<no>']) , 'unscalable image' translated! !
!SketchMorph methodsFor: 'menu' stamp: 'kfr 4/22/2008 16:29'! unscalable: aBoolean unscalable _ aBoolean! !
!SketchMorph methodsFor: 'menus' stamp: 'kfr 4/22/2008 16:43'! addToggleItemsToHaloMenu: aCustomMenu "Add toggle-items to the halo menu"
super addToggleItemsToHaloMenu: aCustomMenu. aCustomMenu addUpdating: #unscalableString target: self action: #toggleUnscalable. (Smalltalk includesKey: #B3DRenderEngine) ifTrue: [ aCustomMenu addUpdating: #useInterpolationString target: self action: #toggleInterpolation. ]. ! !
SketchMorph removeSelector: #unscaleable! Morph subclass: #SketchMorph instanceVariableNames: 'originalForm rotationStyle scalePoint framesToDwell rotatedForm unscalable' classVariableNames: '' poolDictionaries: '' category: 'Morphic-Basic'!