Am 19.03.2010, 16:33 Uhr, schrieb Werner F. Bruhin <[email protected]>:

> My questions:
> - what would I need to do to be able to move individual elements, i.e.
> move the double stacked rack independently from the single stacked one?
> Does this have to do with the group hierarchy?

Yes, partly. If you move a parent node, the child nodes will move  
accordingly. The default object move mode (the "joystick" symbol in the  
fc2 toolbar) always moves the object you clicked on. I.e. if you click the  
frame and move it, the whole rack will move. If you click a circle, only  
the circle will move. You can take a look at the fc2 demo, especially the  
"Customized GUI mode" tutorial. Your gui mode would probably check if the  
node you are dragging is a bottle and if it is, it would move the rack  
parent node
instead.
GUI modes are basically just input event handlers as outlined in the  
tutorial.

> - is there something obvious which could be done to speed the creation
> of a rack up a bit?

There's an optimized version of the rtree used in fc2 in svn, but it fails  
when I start dragging the rack node. In general fc2 is slow with many  
objects right now. This is partly due to the automatic "property changed"  
tracking on all kinds of objects, another part is owed to the general  
flexibility in fc2 and finally python might also be too slow for this.  
Currently I am using a custom C++ library if I need to draw and manipulate  
many objects.

> - in the real world I would like to "append" an element to whatever
> exists, so instead of hard coding "202" on line 137 I would like to get
> the "right" edge position of the right most element - actually it could
> be the right edge of the canvas - what is the right method to call to
> get this information?

You can access node.boundingBox (node bounding box in world space),  
node.localBoundingBox (bounding box in local space) or  
node.boundingBoxRecursive (bounding box of this node and all its children  
in worldspace).

> - each bottle (red/blue circle) needs have some additional information
> attached - in my old version I have a "ShapeMixin" would this be the
> right approach too?

FC2 supports creating your own model classes. This can be a class like  
Bottle with all the data for instance. Then you can register a presenter  
for this model class (e.g. a Circle presenter for a Bottle model). This  
way you deal only with bottle objects which are then presented. You don't  
have to keep the Bottles and Circles in sync really.

For the moment being you can cut this short though by just doing  
node.model.vintage = 1957.

> Sorry if some of this is a bit basic - I am still fighting to get to
> grips with all of this.

Hehe, no problem. FC2 is also not completely bug-free or feature complete.  
For instance I planned to add the alignment thing you talked about to the  
code, but this has not happened for the reason stated in my last mail.

-Matthias
_______________________________________________
FloatCanvas mailing list
[email protected]
http://paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to