'From Squeak3.2alpha of 2 October 2001 [latest update: #4432] on 16 October 2001 at 2:43:48 pm'! "Change Set: FixMojo-ar Date: 16 October 2001 Author: Andreas Raab Fixes the problem with transforms in adoptMojo."! !SketchMorph methodsFor: 'e-toy support' stamp: 'ar 10/16/2001 14:42'! acquirePlayerSimilarTo: aSketchMorphsPlayer "Retrofit into the receiver a player derived from the existing scripted player of a different morph. Works only between SketchMorphs. Maddeningly complicated, as usual, by the TransformationMorph architecture. There are still cases where this operation results in a slight shift in the position of the recipient -- consult the preamble to the adoptMojo update for details. Fixes invited!!" | myName myTop itsTop newTop newSketch | myTop _ self topRendererOrSelf. aSketchMorphsPlayer belongsToUniClass ifFalse: [^ self beep]. itsTop _ aSketchMorphsPlayer costume. (itsTop renderedMorph isKindOf: SketchMorph) ifFalse: [^ self beep]. newTop _ itsTop veryDeepCopy. "May be a sketch or a tranformation" myName _ myTop externalName. "Snag before the replacement is added to the world, because otherwise that could affect this" newSketch _ newTop renderedMorph. newSketch form: self form. newSketch scalePoint: self scalePoint. newSketch bounds: self bounds. myTop owner addMorph: newTop after: myTop. newTop heading ~= myTop heading ifTrue: "avoids annoying round-off error in what follows" [newTop player setHeading: myTop heading]. (newTop isFlexMorph and: [myTop == self]) ifTrue: [newTop removeFlexShell]. newTop _ newSketch topRendererOrSelf. newTop bounds: self bounds. (newTop isFlexMorph and:[myTop isFlexMorph]) ifTrue:[ "Note: This completely dumps the above #bounds: information. We need to recompute the bounds based on the transform." newTop transform: myTop transform copy. newTop computeBounds]. newTop setNameTo: myName. myTop delete! !