Etoys Inbox: Etoys-kfr.158.mcz

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Etoys Inbox: Etoys-kfr.158.mcz

A new version of Etoys was added to project Etoys Inbox:

==================== Summary ====================

Name: Etoys-kfr.158
Author: kfr
Time: 5 January 2014, 9:06:36 pm
UUID: ef47111e-5096-d34a-9621-777c7e4bc04b
Ancestors: Etoys-kfr.151

Turtleform moves by a vektor. Enables continued drawing of graphs with one axis movment of a turtle

=============== Diff against Etoys-kfr.151 ===============

Item was changed:
  ----- Method: PasteUpMorph class>>additionsToViewerCategories (in category '*eToys-scripting') -----
  "Answer a list of (<categoryName> <list of category specs>) pairs that characterize the phrases this kind of morph wishes to add to various Viewer categories."
  ^ # (
  (playfield (
  (command initiatePainting 'Initiate painting of a new object in the standard playfield.')
  (slot mouseX 'The x coordinate of the mouse pointer' Number readWrite Player getMouseX  unused unused)
  (slot mouseY 'The y coordinate of the mouse pointer' Number readWrite Player getMouseY  unused unused)
  (command roundUpStrays 'Bring all out-of-container subparts back into view.')
  (slot graphic 'The graphic shown in the background of this object' Graphic readWrite Player getGraphic Player setGraphic:)
  (command unhideHiddenObjects 'Unhide all hidden objects.')))
  (scripting (
  (command tellAllContents: 'Send a message to all the objects inside the playfield' ScriptName)))
  (collections (
  (slot cursor 'The index of the chosen element' Number readWrite Player getCursor Player setCursorWrapped:)
  (slot count 'How many elements are within me' Number readOnly Player getCount unused unused)
  (slot stringContents 'The characters of the objects inside me, laid end to end' String readOnly Player getStringContents unused unused)
  (slot playerAtCursor 'the object currently at the cursor' Player readWrite Player getValueAtCursor  unused unused)
  (slot firstElement  'The first object in my contents' Player  readWrite Player getFirstElement  Player  setFirstElement:)
  (slot numberAtCursor 'the number at the cursor' Number readWrite Player getNumberAtCursor Player setNumberAtCursor: )
  (slot graphicAtCursor 'the graphic worn by the object at the cursor' Graphic readOnly Player getGraphicAtCursor  unused unused)
  (command tellAllContents: 'Send a message to all the objects inside the playfield' ScriptName)
  (command removeAll 'Remove all elements from the playfield')
  (command shuffleContents 'Shuffle the contents of the playfield')
  (command append: 'Add the object to the end of my contents list.' Player)
  (command prepend: 'Add the object at the beginning of my contents list.' Player)
  (command includeAtCursor: 'Add the object to my contents at my current cursor position' Player)
  (command include: 'Add the object to my contents' Player)
  (#'stack navigation' (
  (command goToNextCardInStack 'Go to the next card')
  (command goToPreviousCardInStack  'Go to the previous card')
  (command goToFirstCardInBackground 'Go to the first card of the current background')
  (command goToFirstCardOfStack 'Go to the first card of the entire stack')
  (command goToLastCardInBackground 'Go to the last card of the current background')
  (command goToLastCardOfStack 'Go to the last card of the entire stack')
  (command deleteCard 'Delete the current card')
  (command insertCard 'Create a new card')))
  "(viewing (
  (slot viewingNormally 'whether contents are viewed normally' Boolean readWrite Player getViewingByIcon Player setViewingByIcon: )))"
  (#'pen trails' (
  (command liftAllPens 'Lift the pens on all the objects in my interior.')
  (command lowerAllPens  'Lower the pens on all the objects in my interior.')
  (command trailStyleForAllPens:  'Set the trail style for pens of all objects within' TrailStyle)
+ (command moveTrailsForm:  'Moves the trails within the playfield using a point. Negative x is motion left and opposite. Negative y is down and opposite ' Point)
- (command moveTrailsForm:  'Moves the trails within the playfield ' Point)
  (command clearTurtleTrails 'Clear all the pen trails in the interior.'))))

Item was changed:
  ----- Method: PasteUpMorph>>moveTrailsForm: (in category '*Etoys-pen') -----
  moveTrailsForm: aPoint
  | newForm down left right up |
  left := up := right := down := 0.
  aPoint x < 0 ifTrue: [left := aPoint x]
  ifFalse:[right := aPoint x negated].
  aPoint y < 0 ifTrue:[up := aPoint y negated]
  ifFalse:[down := aPoint y].
  newForm := Form extent: self extent depth: Display depth.
  turtleTrailsForm ifNotNil: [
  newForm copy: (left@up extent: self extent) from: turtleTrailsForm
  to: (right@down) rule: Form over].
  turtleTrailsForm := newForm.
  turtlePen := nil.
  "Recreate Pen for this form"
  turtlePen ifNil: [turtlePen := Pen newOnForm: turtleTrailsForm].
+ self updateMovedTrailsForm: aPoint.
  self changed!

Item was added:
+ ----- Method: PasteUpMorph>>updateMovedTrailsForm: (in category '*Etoys-pen') -----
+ updateMovedTrailsForm: delta
+ "Update the turtle-trails form using the current positions of all pens i corelation with delta.
+ Best results used in conjunction with Preferences batchPenTrails."
+ | morph oldPoint newPoint removals player tfm deltaPoint |
+ self flag: #bob. "transformations WRONG here"
+ (lastTurtlePositions isNil or: [lastTurtlePositions isEmpty])
+ ifTrue: [^self].
+ removals := OrderedCollection new.
+ lastTurtlePositions associationsDo:
+ [:assoc |
+ player := assoc key.
+ morph := player costume.
+ (player getPenDown and: [morph trailMorph == self])
+ ifTrue:
+ [deltaPoint := (delta x@ delta y negated).
+ oldPoint := assoc value - deltaPoint .
+ tfm := morph owner transformFrom: self.
+ newPoint := tfm localPointToGlobal: morph referencePosition.
+ newPoint = oldPoint
+ ifFalse:
+ [assoc value: newPoint.
+ self
+ drawPenTrailFor: morph
+ from: oldPoint
+ to: newPoint]]
+ ifFalse: [removals add: player]].
+ removals do: [:key | lastTurtlePositions removeKey: key ifAbsent: []]!

Item was changed:
  ----- Method: Player>>moveTrailsForm: (in category 'pen') -----
  moveTrailsForm: aPoint
  "Move the trails form"
  self costume renderedMorph moveTrailsForm: aPoint.!

etoys-dev mailing list
[hidden email]