
On 7/4/07, Maximilian Albert <Anhalter42@...173...> wrote:
The first two handles can be used to arbitrarily resize the box inside the XY-plane, the third one obviously resizes it in the direction of the Z axis. When Shift is being pressed, the movement temporarily becomes constrained to a single axis for the first two handles and switches to occuring inside the XY plane for the third handle. (Try it, this is more intuitive than it sounds.)
Thatnks, it's very cool to play with!
It is possible to switch between these two variants using the corresponding toggle buttons in the 3D box toolbar showing three/four knots, respectively. These buttons are for convenience only and will disappear once the definitive behaviour is settled.
OK, I'll try both and let you know what I think on this...
Next I am going to attack the style issues Bulia mentioned in one of his last emails (sorry that this has lied idle in the meantime). Alternatively, I could implement draggable vanishing points first. Bulia, what do you think is more important?
Whatever itches you most :)
Some more things:
Apart from the shape of the sides' paths, the 3Dbox must also control the z-order of these paths in the group. Depending on which way the box is turned, the 3 sides that face the viewer must be on top of the z-order and the 3 others must be at bottom. If I "rotate" the box by dragging vanishing points, this must be adjusted accordingly.
Your tool cannot select its own 3d box because it, like most other tools, disregards groups (i.e. enters groups) on click, including its own 3d box groups. Fix this in the click handler of the tool.
Also your tool somehow eats middle-button drags, so panning and shift-middle-button zooming do not work (try them in other tools).
- After resizing the box, undo (Ctrl-Z) correctly undoes the change of
size but the corresponding handle remains at the altered position. How can I make the handle undo-aware, too?
You need to register a listener for your box. See for example how it's done in rect-context.cpp. When selection changes, it destroys old knotholder; if the new selection contains a rect, it creates new knotholder and adds listener with ec_shape_repr_events. That listener responds to the attribute changed event (which may be caused by undo, among other things) and calls ec_shape_event_attr_changed which updates the knotholder. Note however that you can only listen one repr, i.e. either the group or any one side, so for this to work on the entire box, you need to watch the root <g> but also you need to change some attribute on it whenever you change your box (and not only change the sides), otherwise the listener won't fire. For example, add some attribute on <g> which in condensed form records the 3D position/dimensions of the entire box. This may later prove helpful in other situations too.
- Toggling the state of a vanishing point is not undo-able either. How
can I change that? Do I need to register the corresponding action somewhere?
Does this change any repr in the document? If it does not you cannot undo it - the undo system is only for changes in the document, not in the UI. And of course don't forget to do sp_document_done whenever you are finished with some document change.
- With the 3D box tool active, clicking on an already created but
currently unselected box only selects a single face instead of the whole box.
See above, just change one argument in your sp_event_context_find_item call.