'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: ' 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: [''] ifFalse: ['']) , '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'!