ObjectHandles – Multiple Selection and Decorators

I’ve been playing around with a few things in ObjectHandles today. The first is multiple-selection. Last week Vlad Janvarev sent me a patch that got it working for non-rotated objects. I put that in, and spent most of my day today figuring out how to extend it to rotated objects as well (dealing with 3 coordinate spaces at once makes my head hurt!). To try it, press the shift key and select multiple objects on the screen, then you can move, rotate or resize them as a whole.
[kml_flashembed fversion="10.0.0" movie="http://rogue-development.com/uploads/ohv2/ObjectHandles2Example.swf" targetclass="flashmovie" publishmethod="static" width="720" height="600" fvars="undefined"]Get Adobe Flash player

[/kml_flashembed]
View-Source is enabled in it.

It’s not working 100%, and I’m not sure why. If anyone has any ideas, let me know. The broken part is if you rotate 2 objects, then select them both, then resize them really small. At some point they sometimes start getting bigger instead of smaller depending on the rotation. I’m baffled.

The second thing I played with is the idea of “Decorators” that can draw interesting info based on the state of the set of objects either being moved or currently selected. There’s a quick screenshot of a sample one I did below.

This is also in the link above under “Example 8″. This is just a proof of concept for now. If you want to try it, do it before trying the multi-select since the multi-select can leave objects on fractional pixel boundries which won’t line up perfectly.

Neither of these is ready for prime-time yet. The multi-select stuff is creating tons and tons of temporary objects so the GC kicks in periodically freezing the interface. That’ll need a little optimization.

7 Responses to “ObjectHandles – Multiple Selection and Decorators”


  • Thanks Marc, however, if I multi-select two or more object, I was not able to deselect them, could you fix that too?

  • Thanks! This would help, but viewsource is not working. I am curious for the implementation. :-)

    Kind regards
    _____
    Arne

  • James, try “Example 1″… it has multi select and you can deselect by clicking the background.

    That was a bug introduced by compiling under Flex 4 SDK instead of Flex 3, apparently I didn’t fix it in all the examples.

    ArneO,

    Try this: http://rogue-development.com/uploads/ohv2/srcview/index.html
    Looks like the relative link from the blog post screwed up view-source.

  • Works great so far. One problem I am working on is when the parent of the transform is scaled, for instance via a matrix, the objecthandles are scaled as well. In my situation, this is not what i want. It would be nice if the handles exposed a mechanism that allowed me to scale up or down the handles.

  • Jeff, yeah that’s been one problem I haven’t gotten around to solving yet.

    The simplest way would be to create a custom handle that scales itself by 1/(parents scaling).

  • Thanks a lot, Marc. You have improved my piece of code a lot, and it’s really work smoothly (with rotation and external multiple handlers) now. Waiting for next releases :)

  • “Jeff, yeah that’s been one problem I haven’t gotten around to solving yet.

    The simplest way would be to create a custom handle that scales itself by 1/(parents scaling).”

    Marc,

    Doing this worked in that I can get the handles to scale up to the size I need. The problem was that the spacing of the handles was still off. I tried fixing this by changing the perc, offset params on the handle points. I was getting a headache so I dropped it.

    What I am doing instead is that in the parent container I have created a new child that will act as the new container to all of my handles. This container has the same dimensions as the parent. The only difference is that I am doing all of the scaling in this new child. This way I don’t have to change anything in object handles. Another key thing is that my ObjectHandles DataModel is aware of the scale factor and is able to map between scales on the gets/sets of the x,y, width, height.

    Jeff

Comments are currently closed.