[FIX][BUG]Picking up morphs with the hand.

Karl Ramberg karl.ramberg at chello.se
Fri Aug 8 09:07:06 UTC 2003



Andreas Raab wrote:
> 
> > 20% speedup on grabbing and dropping sounds nice to me. Morphic needs
> > all the help it can get and minimizing sluggishness is a good thing.
> > I tried Andreas code and there are no selector named allAreasOutside:.
> > I replaced with areasOutside: and that crashed horribly.
> > What is the intended behavior of allAreasOutside: ?
> 
> Try #allAreasOutside:do: like the code said.
Ok, worldDamageRects is a collection, not a rect.

worldDamageRects do:[:i| i  allAreasOutsideList: handDamageRects 
                        do:[:rect| allDamage add: rect]].

Karl
-------------- next part --------------
'From Squeak3.6beta of ''4 July 2003'' [latest update: #5387] on 8 August 2003 at 11:03:10 am'!

!WorldState methodsFor: 'update cycle' stamp: 'kfr 8/8/2003 11:02'!
displayWorld: aWorld submorphs: submorphs
	"Update this world's display."

	| deferredUpdateMode worldDamageRects handsToDraw handDamageRects allDamage |

	submorphs do: [:m | m fullBounds]. "force re-layout if needed"
	self checkIfUpdateNeeded ifFalse: [^ self].  "display is already up-to-date"

	deferredUpdateMode _ self doDeferredUpdatingFor: aWorld.
	deferredUpdateMode ifFalse: [self assuredCanvas].
	canvas roundCornersOf: aWorld during:[
		worldDamageRects _ self drawWorld: aWorld submorphs: submorphs invalidAreasOn: canvas.  "repair world's damage on canvas"
		"self handsDo:[:h| h noticeDamageRects: worldDamageRects]."
		handsToDraw _ self selectHandsToDrawForDamage: worldDamageRects.
		handDamageRects _ handsToDraw collect: [:h | h savePatchFrom: canvas].
		allDamage _ OrderedCollection new.
worldDamageRects do:[:i| i  allAreasOutsideList: handDamageRects 
                        do:[:rect| allDamage add: rect]].
allDamage addAll: handDamageRects.
		
		handsToDraw reverseDo: [:h | canvas fullDrawMorph: h].  "draw hands onto world canvas"
	].
	"*make this true to flash damaged areas for testing*"
	Preferences debugShowDamage ifTrue: [aWorld flashRects: allDamage color: Color black].
  " Preferences debugShowDamage ifTrue: [Preferences setPreference: #debugShowDamage toValue: false. worldDamageRects  inspect. handDamageRects inspect]."
	canvas finish.
	"quickly copy altered rects of canvas to Display:"
	deferredUpdateMode
		ifTrue: [self forceDamageToScreen: allDamage]
		ifFalse: [canvas showAt: aWorld viewBox origin invalidRects: allDamage].
	handsToDraw do: [:h | h restoreSavedPatchOn: canvas].  "restore world canvas under hands"
	Display deferUpdates: false; forceDisplayUpdate.
! !



More information about the Squeak-dev mailing list