'From etoys3.0 of 28 February 2008 [latest update: #2036] on 20 June 2008 at 12:09:10 pm'! "Change Set: atCursorRefresh-sw Date: 20 June 2008 Author: Scott Wallace TRAC 7325: Makes readouts (in viewers and watchers) of valueAtCursor and firstElement update properly after a specific series of user gestures, detailed in TRAC report 7325, which could manage to defeat a would-be optimization in ThumbnailMorph. Also makes the first-element slot robust in the face of a rotated holder, and bulletproofs #graphicAtCursor against a nil irregularity seen at least once."! !Player methodsFor: 'slot getters/setters' stamp: 'sw 6/20/2008 11:57'! getFirstElement "Answer a player representing the receiver's costume's first submorph. The costume is assumed to be some kind of PasteUpMorph. In case it currently is empty, answer the Dot object as a place-holder." | itsMorphs | ^ (itsMorphs := costume renderedMorph submorphs) notEmpty ifFalse: [costume presenter standardPlayer] ifTrue: [itsMorphs first assuredPlayer]! ! !Player methodsFor: 'slot getters/setters' stamp: 'sw 6/20/2008 11:44'! getGraphicAtCursor "Answer a form depicting the object at the current cursor" | anObject aMorph | anObject _ self getValueFromCostume: #valueAtCursor. ^ (anObject isNil or: [anObject == 0 "weird return from GraphMorph"]) ifTrue: [ScriptingSystem formAtKey: #Paint] ifFalse: [((aMorph _ anObject renderedMorph) isSketchMorph) ifTrue: [aMorph form] ifFalse: [aMorph isPlayfieldLike ifTrue: [aMorph backgroundForm] ifFalse: [aMorph imageForm]]]! ! !ThumbnailMorph methodsFor: 'stepping and presenter' stamp: 'sw 6/20/2008 12:09'! step "Optimization: Don't redraw if we're viewing some kind of SketchMorph and its rotated Form hasn't changed." | viewee f | viewee _ self actualViewee. viewee ifNil: [self stopStepping. ^ self]. viewee isSketchMorph ifTrue: [f := viewee rotatedForm. f == lastSketchForm ifTrue: [^ self]. "The optimization" lastSketchForm _ f] ifFalse: [lastSketchForm := nil]. "Avoids subtle bug if sketchMorph removed and then put back in" self changed ! !