Re: Zooming by defining rectangle and changing viewbox atttributes

Mr. Ferraiolo,
I have been verifying the 'currentScale' and 'currentTranslate' attributes and as you expected they are not yet implemented in the Adobe plug-in (Build 94).
In terms of and changing the viewbox attribute to accomplish zoom-in, it is working really well, but only one time ! 
My problem is when I am already zoomed-in and try to draw a new rectangle, the
rectangle is not drawn exactly where I click. 

I will put this on hold until the next draft comes in with changes !

Thanks again for your time and your efforts to make SVG work for everybody !

Dany Bouchard
DBx Geomatics
38 de l'Orbite
Hull, Québec
Canada
J9A 3C7
Téléphone/Telephone: 819.743.3870
Télécopieur/Fax: 819.775.3264
Courrier électronique/Email: db@dbxgeomatics.com
Page Web/Web site: http://www.dbxgeomatics.com/home.asp

  ----- Original Message ----- 
  From: Jon Ferraiolo 
  To: Dany Bouchard 
  Cc: www-svg@w3.org 
  Sent: Saturday, June 24, 2000 1:43 PM
  Subject: Re: Zooming by defining rectangle and changing viewbox atttributes


  Dany,
  Sorry, I only have time to take a quick look at your SVG file.

  The recommended way to control zooming through scripting is via the 'currentScale' and 'currentTranslate' attributes on the SVGSVGElement interface (corresponds to 'svg' elements). Here is the URL from the March 3 spec: http://www.w3.org/TR/2000/03/WD-SVG-20000303/struct.html#InterfaceSVGSVGElement. I have extracted the description of these two DOM attributes:

  float currentScale 
  In certain interactive environments, the user can zoom and pan into the current SVG document fragment. The attribute indicates the current scale factor relative to the initial view to take into account user zooming. DOM attributes currentScale and currentTranslate are equivalent to the 2x3 matrix [a b c d e f] = [currentScale 0 0 currentScale currentTranslate.x currentTranslate.y] 
  SVGPoint currentTranslate 
  The corresponding translation factor that takes into account user zooming and panning. 

  I'm not sure whether Adobe or anyone else has implemented these DOM attributes yet. My guess is "no". Also, be warned that a new public draft may be coming soon, and there might be changes in this area.

  A cheap trick for accomplishing zooming which will indeed work with the current version of the Adobe SVG Viewer or anyone else who supports the Core DOM facilities from DOM 1 is to just stuff in new values for the 'viewBox' attribute on the outermost SVG. For example, try out your file with each of the following two 'svg' elements at the top of your file:

  < svg xml:space="preserve" width="450" height="314" enableZoomAndPanControls="false" viewBox="0 0 450 450" >

  < svg xml:space="preserve" width="450" height="314" enableZoomAndPanControls="false" viewBox="50 50 250 250" >

  You'll see that the second 'svg' element above has the effect of zooming in on the drawing.

  I didn't have time to look at your code which attempts to interactively draw a zooming rectangle.

  Also, 'g' element doesn't have attributes 'width' and 'height'.

  Jon Ferraiolo
  SVG Editor
  Adobe Systems Incorporated

  At 09:33 PM 6/23/00 -0400, Dany Bouchard wrote: 

    Following a few examples on this list and in other places, I have tryied to implement custom zooming functions using javascript and the DOM.
    I think I am almost there, there is only one problem. When the viewbox of the main svg document is changed (after defining the first rectangle) , the references that I use in javascript to draw the rectangle don't match with the view of the document. How can I ensure that subsequent drawing occurs in the current view of the document ? I think I am forgetting something here ! Hopefully someone can help !
    I have placed a version of the svg document at www.dbxgeomatics.com/zoomtest2.svg so that you can see what I am referring to.

    Thanks in advance.

    Dany Bouchard
    DBx Geomatics
    38 de l'Orbite
    Hull, Québec
    Canada
    J9A 3C7
    Téléphone/Telephone: 819.743.3870
    Télécopieur/Fax: 819.775.3264
    Courrier électronique/Email: db@dbxgeomatics.com
    Page Web/Web site: http://www.dbxgeomatics.com/home.asp

Received on Saturday, 24 June 2000 14:29:50 UTC