[editor: moving to the appropriate forum…]
I have a few questions about the dojogfx surface:
1) Is there a way to zoom a surface?
2) Is there any way to dynamically recreate a surface? I want to avoid destroying and recreating it.
Thanks!
[editor: moving to the appropriate forum…]
I have a few questions about the dojogfx surface:
1) Is there a way to zoom a surface?
2) Is there any way to dynamically recreate a surface? I want to avoid destroying and recreating it.
Thanks!
Quick answers.
1) Not directly. But what I tend to do is create a surface and then immediately create a group as a "viewbox", something like this:
var g = s.createGroup();
// ... later on in your code
g.createPath(...);
g.createSomeOtherShape(...);
// and finally
g.setTransform(dojox.gfx.matrix.scale(zoomFactor, zoomFactor));
The idea is that you place all of your shapes inside of this group, and then use the scale transform to do your zooming. This is the way dojox.sketch works.
2) Dynamically recreate a surface? What are you trying to do, clear out all the shapes and reset the dimensions?
You can use [surface].setDimensions to resize the surface, and you can use [surface].clear() to wipe the entire contents of the surface. Would this work for your situation?
There is a shortcut for
There is a shortcut for isotropic scaling:
If only one scale factor is supplied it is assumed to be isotropic, for the anisotropic zoom two scale factors are required. The same works for scaleAt() function (see docs for details).
Thanks Eugene...
...I'm so used to keeping my options open that I forgot you can pass one parameter to it :)
Thanks for the tips... When
Thanks for the tips...
When I call [surface].setDimensions (x, y), will the objects that I added to the surface still remain on the surface? I'm finding that it isn't...unless what I'm seeing is an IE issue b/c I do recall seeing that there is a bug in IE when using setDimensions.
Thanks!
Does the test
Does the test (http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/gfx/tests/test_...) work for you? If not, what browser, and what renderer do you use?
Thanks! This test example
Thanks! This test example looks great in IE and firefox.
Moving a surface
I have a surface that contains shapes and I would like to move the entire surface when a user clicks on it to drag it. I was able to get this to work in firefox (but not in IE) by importing dojo.dnd.Moveable and then by adding this as a script in my code:
dojo.addOnLoad(function(){
new dojo.dnd.Moveable("graph");
})
Has anyone run into problems trying to get the surface to move in IE? I also noticed that gfx has a moveable file that you can import --> dojox.gfx.move.
Thanks!