Loading ...
Sorry, an error occurred while loading the content.

Re: script to set 'Original View'

Expand Messages
  • Francis Hemsher
    I m using the below on an app to find the center point of the user s area(dotX,dotY), plus their viewing area(box) rectangle top left and lower right points:
    Message 1 of 16 , Aug 6, 2009
    • 0 Attachment
      I'm using the below on an app to find the center point of the user's area(dotX,dotY), plus their viewing area(box) rectangle top left and lower right points:

      SC=mySVG.currentScale

      var transX=mySVG.currentTranslate.x;
      var transY=mySVG.currentTranslate.y;
      var dotX=(-transX+SvgWidth/2)/SC;
      var dotY=(-transY+SvgHeight/2)/SC;
      //---user's view area rect---
      var boxW=(SvgWidth)/SC;
      var boxH=(SvgHeight)/SC;
      var boxX0=dotX-.5*boxW;
      var boxY0=dotY-.5*boxH;
      var boxX1=dotX+.5*boxW;
      var boxY1=dotY+.5*boxH;

      Could this be saved, as a 'snapshot' prior to when the user zooms/pans via the Ctrl/Alt keys or context menu, and then recalled and used in your application?

      Francis

      --- In svg-developers@yahoogroups.com, "zedkineece" <zedkineece@...> wrote:
      >
      > Hi Francis,
      >
      > Thanks for the quick resonse. I should have been a bit more clearer.
      >
      > I have a set of scripts that pan and zoom. The problem I have is when someone uses the keyboard or context menu to pan and zoom. So I need to grab the original viewbox and height/width attributes to set that original value.
      >
      > Thanks again.
      >
      >
      > --- In svg-developers@yahoogroups.com, "Francis Hemsher" <fhemsher@> wrote:
      > >
      > > Try,
      > > mySVG.currentScale=1
      > > mySVG.currentTranslate.x=0
      > > mySVG.currentTranslate.y=0
      > >
      > > Regards,
      > > Francis
      > >
      > >
      > > --- In svg-developers@yahoogroups.com, "zedkineece" <zedkineece@> wrote:
      > > >
      > > > I am in need of a method to programatically set the SVG back to it's original view. Any ideas are greatly appreciated.
      > > >
      > > > Thanks.
      > > >
      > >
      >
    • Francis Hemsher
      You also may want to consider disabling the context and or alt/ctrl zoom and pan. To disable the context, add the following to the top SVG:
      Message 2 of 16 , Aug 6, 2009
      • 0 Attachment
        You also may want to consider disabling the context and or alt/ctrl zoom and pan.
        To disable the context, add the following to the top SVG:

        onmousedown="evt.preventDefault()" onmouseup="evt.preventDefault()"

        To disable the Ctrl/Alt keys:

        zoomAndPan="disable"

        Francis


        --- In svg-developers@yahoogroups.com, "Francis Hemsher" <fhemsher@...> wrote:
        >
        > I'm using the below on an app to find the center point of the user's area(dotX,dotY), plus their viewing area(box) rectangle top left and lower right points:
        >
        > SC=mySVG.currentScale
        >
        > var transX=mySVG.currentTranslate.x;
        > var transY=mySVG.currentTranslate.y;
        > var dotX=(-transX+SvgWidth/2)/SC;
        > var dotY=(-transY+SvgHeight/2)/SC;
        > //---user's view area rect---
        > var boxW=(SvgWidth)/SC;
        > var boxH=(SvgHeight)/SC;
        > var boxX0=dotX-.5*boxW;
        > var boxY0=dotY-.5*boxH;
        > var boxX1=dotX+.5*boxW;
        > var boxY1=dotY+.5*boxH;
        >
        > Could this be saved, as a 'snapshot' prior to when the user zooms/pans via the Ctrl/Alt keys or context menu, and then recalled and used in your application?
        >
        > Francis
        >
        > --- In svg-developers@yahoogroups.com, "zedkineece" <zedkineece@> wrote:
        > >
        > > Hi Francis,
        > >
        > > Thanks for the quick resonse. I should have been a bit more clearer.
        > >
        > > I have a set of scripts that pan and zoom. The problem I have is when someone uses the keyboard or context menu to pan and zoom. So I need to grab the original viewbox and height/width attributes to set that original value.
        > >
        > > Thanks again.
        > >
        > >
        > > --- In svg-developers@yahoogroups.com, "Francis Hemsher" <fhemsher@> wrote:
        > > >
        > > > Try,
        > > > mySVG.currentScale=1
        > > > mySVG.currentTranslate.x=0
        > > > mySVG.currentTranslate.y=0
        > > >
        > > > Regards,
        > > > Francis
        > > >
        > > >
        > > > --- In svg-developers@yahoogroups.com, "zedkineece" <zedkineece@> wrote:
        > > > >
        > > > > I am in need of a method to programatically set the SVG back to it's original view. Any ideas are greatly appreciated.
        > > > >
        > > > > Thanks.
        > > > >
        > > >
        > >
        >
      • heldermagalhaes
        Hi zedkineece, ... Yup. ;-) ... So this seems to be your problem. Zooming by manipulating those document attributes ( viewBox , height , width ) is generally
        Message 3 of 16 , Oct 20, 2009
        • 0 Attachment
          Hi zedkineece,


          > Thanks for the quick resonse. I should have been a bit more clearer.

          Yup. ;-)


          > I have a set of scripts that pan and zoom. The problem I have is
          > when someone uses the keyboard or context menu to pan and zoom. So
          > I need to grab the original viewbox and height/width attributes to
          > set that original value.

          So this seems to be your problem. Zooming by manipulating those document attributes ('viewBox', 'height', 'width') is generally a bad idea. Note that this is a common mistake (in my opinion): for example, SVG Web is still using that approach for the demos [1] (I've just reported issue 357 [2]), even when the required functionality was already made available (somehow recently, though).

          You should consider using a "true" zoom implementation by manipulating the appropriate properties ('currentScale', 'currentTranslate'). Please take a look at a tightly related demo [3]. Note that SVG Web is also in the process of providing also similar to the demo in the scope of it's effort to help Wikipedia (see issue 291 [4] for more information). :-)


          > Thanks again.

          Hope this helps,
          Helder


          [1] http://codinginparadise.org/projects/svgweb/samples/demo.html
          [2] http://code.google.com/p/svgweb/issues/detail?id=357
          [3] http://heldermagalhaes.com/stuff/svg/demos/SVGObject-HTMLCanvasInteractors/
          [4] http://code.google.com/p/svgweb/issues/detail?id=291
        • Bradley Neuberg
          Thanks Helder! I added currentScale and currentTranslate only recently, so most people had to manipulate the viewBox before. Hopefully things should be easier.
          Message 4 of 16 , Oct 23, 2009
          • 0 Attachment
            Thanks Helder! I added currentScale and currentTranslate only recently, so
            most people had to manipulate the viewBox before. Hopefully things should be
            easier.

            BTW, I have a glitch in the Wikipedia Zoom and Pan prototype that I've had
            trouble tracking down. If you go here:

            http://codinginparadise.org/projects/svgweb-staging/tests/non-licensed/wikipedia/svgzoom/commons-logo.html

            You will see a prototype. If you click the little magnifying glass you can
            then zoom and pan around the Wikipedia Commons logo.

            Here's how to get the bug. First, use your mouse scroll wheel to zoom out
            and have the logo get small. Then click and drag your mouse to pan around.
            You will notice that the logo 'jumps' around and zooms away.

            My zoom and pan logic for the mouse scroll wheel and pan dragging is here:

            http://codinginparadise.org/projects/svgweb-staging/tests/non-licensed/wikipedia/svgzoom/svgzoom.js

            In the methods zoomIn, zoomOut, mouseDown, mouseMove, and mouseUp.

            I'm stumped with this bug. At one point Jeff Schiller and Andreas Neumann at
            the conference were hacking with me and we weren't able to figure it out.
            Any tips is much appreciated :)

            I think you also mentioned a tip once where you said to have all zooming
            take the center of where the user is as well as the origin. That's another
            change I'd like to add to the Zoom and Pan prototype.

            Best,
            Brad

            On Tue, Oct 20, 2009 at 4:40 AM, heldermagalhaes <helder.magalhaes@...
            > wrote:

            >
            >
            > Hi zedkineece,
            >
            >
            > > Thanks for the quick resonse. I should have been a bit more clearer.
            >
            > Yup. ;-)
            >
            > > I have a set of scripts that pan and zoom. The problem I have is
            > > when someone uses the keyboard or context menu to pan and zoom. So
            > > I need to grab the original viewbox and height/width attributes to
            > > set that original value.
            >
            > So this seems to be your problem. Zooming by manipulating those document
            > attributes ('viewBox', 'height', 'width') is generally a bad idea. Note that
            > this is a common mistake (in my opinion): for example, SVG Web is still
            > using that approach for the demos [1] (I've just reported issue 357 [2]),
            > even when the required functionality was already made available (somehow
            > recently, though).
            >
            > You should consider using a "true" zoom implementation by manipulating the
            > appropriate properties ('currentScale', 'currentTranslate'). Please take a
            > look at a tightly related demo [3]. Note that SVG Web is also in the process
            > of providing also similar to the demo in the scope of it's effort to help
            > Wikipedia (see issue 291 [4] for more information). :-)
            >
            > > Thanks again.
            >
            > Hope this helps,
            > Helder
            >
            > [1] http://codinginparadise.org/projects/svgweb/samples/demo.html
            > [2] http://code.google.com/p/svgweb/issues/detail?id=357
            > [3]
            > http://heldermagalhaes.com/stuff/svg/demos/SVGObject-HTMLCanvasInteractors/
            > [4] http://code.google.com/p/svgweb/issues/detail?id=291
            >
            >
            >


            [Non-text portions of this message have been removed]
          • israel_eisenberg
            Hi Brad, Seems like it works also on Opera now (without jumping :)), give it a try: function mouseDown(evt) { dragging = true; var p =
            Message 5 of 16 , Oct 27, 2009
            • 0 Attachment
              Hi Brad,

              Seems like it works also on Opera now (without jumping :)), give it a try:

              function mouseDown(evt) {
              dragging = true;

              var p = svgRoot.createSVGPoint();
              p.x = evt.clientX;
              p.y = evt.clientY;

              //var rootCTM = svgRoot.getCTM();
              //inverseRootCTM = rootCTM.inverse();

              //p = p.matrixTransform(inverseRootCTM);

              mouseOffsetX = p.x - dragX; //- svgRoot.currentTranslate.x;
              mouseOffsetY = p.y - dragY; //- svgRoot.currentTranslate.y;

              evt.preventDefault();
              }

              function mouseMove(evt) {
              if (!dragging) {
              return;
              }

              var p = svgRoot.createSVGPoint();
              p.x = evt.clientX;
              p.y = evt.clientY;

              //p = p.matrixTransform(inverseRootCTM);
              p.x -= mouseOffsetX;
              p.y -= mouseOffsetY;

              dragX = p.x;
              dragY = p.y;

              //svgRoot.currentTranslate.setXY(p.x, p.y);
              svgRoot.currentTranslate.x = p.x;
              svgRoot.currentTranslate.y = p.y;

              evt.preventDefault();
              }

              function mouseUp(evt) {
              mouseOffsetX = 0;
              mouseOffsetY = 0;
              dragging = false;

              evt.preventDefault();
              }

              --- In svg-developers@yahoogroups.com, Bradley Neuberg <bradneuberg@...> wrote:

              > BTW, I have a glitch in the Wikipedia Zoom and Pan prototype that I've had
              > trouble tracking down. If you go here:
              >
              > http://codinginparadise.org/projects/svgweb-staging/tests/non-licensed/wikipedia/svgzoom/commons-logo.html
              >
              > You will see a prototype. If you click the little magnifying glass you can
              > then zoom and pan around the Wikipedia Commons logo.
              >
              > Here's how to get the bug. First, use your mouse scroll wheel to zoom out
              > and have the logo get small. Then click and drag your mouse to pan around.
              > You will notice that the logo 'jumps' around and zooms away.
              >
              > My zoom and pan logic for the mouse scroll wheel and pan dragging is here:
              >
              > http://codinginparadise.org/projects/svgweb-staging/tests/non-licensed/wikipedia/svgzoom/svgzoom.js
              >
              > In the methods zoomIn, zoomOut, mouseDown, mouseMove, and mouseUp.
              >
              > I'm stumped with this bug. At one point Jeff Schiller and Andreas Neumann at
              > the conference were hacking with me and we weren't able to figure it out.
              > Any tips is much appreciated :)
              >
              > I think you also mentioned a tip once where you said to have all zooming
              > take the center of where the user is as well as the origin. That's another
              > change I'd like to add to the Zoom and Pan prototype.
              >
              > Best,
              > Brad
              >
            • Bradley Neuberg
              Thanks Israel! Much appreciated! ... [Non-text portions of this message have been removed]
              Message 6 of 16 , Oct 27, 2009
              • 0 Attachment
                Thanks Israel! Much appreciated!

                On Tue, Oct 27, 2009 at 12:47 PM, israel_eisenberg <owlgems@...>wrote:

                >
                >
                > Hi Brad,
                >
                > Seems like it works also on Opera now (without jumping :)), give it a try:
                >
                > function mouseDown(evt) {
                > dragging = true;
                >
                > var p = svgRoot.createSVGPoint();
                > p.x = evt.clientX;
                > p.y = evt.clientY;
                >
                > //var rootCTM = svgRoot.getCTM();
                > //inverseRootCTM = rootCTM.inverse();
                >
                > //p = p.matrixTransform(inverseRootCTM);
                >
                > mouseOffsetX = p.x - dragX; //- svgRoot.currentTranslate.x;
                > mouseOffsetY = p.y - dragY; //- svgRoot.currentTranslate.y;
                >
                > evt.preventDefault();
                > }
                >
                > function mouseMove(evt) {
                > if (!dragging) {
                > return;
                > }
                >
                > var p = svgRoot.createSVGPoint();
                > p.x = evt.clientX;
                > p.y = evt.clientY;
                >
                > //p = p.matrixTransform(inverseRootCTM);
                > p.x -= mouseOffsetX;
                > p.y -= mouseOffsetY;
                >
                > dragX = p.x;
                > dragY = p.y;
                >
                > //svgRoot.currentTranslate.setXY(p.x, p.y);
                > svgRoot.currentTranslate.x = p.x;
                > svgRoot.currentTranslate.y = p.y;
                >
                > evt.preventDefault();
                > }
                >
                > function mouseUp(evt) {
                > mouseOffsetX = 0;
                > mouseOffsetY = 0;
                > dragging = false;
                >
                > evt.preventDefault();
                >
                > }
                >
                > --- In svg-developers@yahoogroups.com <svg-developers%40yahoogroups.com>,
                > Bradley Neuberg <bradneuberg@...> wrote:
                >
                > > BTW, I have a glitch in the Wikipedia Zoom and Pan prototype that I've
                > had
                > > trouble tracking down. If you go here:
                > >
                > >
                > http://codinginparadise.org/projects/svgweb-staging/tests/non-licensed/wikipedia/svgzoom/commons-logo.html
                > >
                > > You will see a prototype. If you click the little magnifying glass you
                > can
                > > then zoom and pan around the Wikipedia Commons logo.
                > >
                > > Here's how to get the bug. First, use your mouse scroll wheel to zoom out
                > > and have the logo get small. Then click and drag your mouse to pan
                > around.
                > > You will notice that the logo 'jumps' around and zooms away.
                > >
                > > My zoom and pan logic for the mouse scroll wheel and pan dragging is
                > here:
                > >
                > >
                > http://codinginparadise.org/projects/svgweb-staging/tests/non-licensed/wikipedia/svgzoom/svgzoom.js
                > >
                > > In the methods zoomIn, zoomOut, mouseDown, mouseMove, and mouseUp.
                > >
                > > I'm stumped with this bug. At one point Jeff Schiller and Andreas Neumann
                > at
                > > the conference were hacking with me and we weren't able to figure it out.
                > > Any tips is much appreciated :)
                > >
                > > I think you also mentioned a tip once where you said to have all zooming
                > > take the center of where the user is as well as the origin. That's
                > another
                > > change I'd like to add to the Zoom and Pan prototype.
                > >
                > > Best,
                > > Brad
                > >
                >
                >
                >


                [Non-text portions of this message have been removed]
              • israel_eisenberg
                Hi Brad, Earlier script was tested on FireFox 3.5 and Opera 10 but later tests on the WebKits still jumping. Following link tested also on Safari 4 and Chrome
                Message 7 of 16 , Oct 28, 2009
                • 0 Attachment
                  Hi Brad,

                  Earlier script was tested on FireFox 3.5 and Opera 10
                  but later tests on the WebKits still jumping.

                  Following link tested also on Safari 4 and Chrome 3:

                  http://owl3d.com/tests/wikipedia/svgzoom/Commons-logo3.html

                  Respond even if it sucks :)

                  Best,

                  Israel

                  --- In svg-developers@yahoogroups.com, Bradley Neuberg <bradneuberg@...> wrote:
                  >
                  > Thanks Israel! Much appreciated!
                  >
                  > On Tue, Oct 27, 2009 at 12:47 PM, israel_eisenberg <owlgems@...>wrote:
                  >
                  > >
                  > >
                  > > Hi Brad,
                  > >
                  > > Seems like it works also on Opera now (without jumping :)), give it a try:
                  > >
                  > > function mouseDown(evt) {
                  > > dragging = true;
                  > >
                  > > var p = svgRoot.createSVGPoint();
                  > > p.x = evt.clientX;
                  > > p.y = evt.clientY;
                  > >
                  > > //var rootCTM = svgRoot.getCTM();
                  > > //inverseRootCTM = rootCTM.inverse();
                  > >
                  > > //p = p.matrixTransform(inverseRootCTM);
                  > >
                  > > mouseOffsetX = p.x - dragX; //- svgRoot.currentTranslate.x;
                  > > mouseOffsetY = p.y - dragY; //- svgRoot.currentTranslate.y;
                  > >
                  > > evt.preventDefault();
                  > > }
                  > >
                  > > function mouseMove(evt) {
                  > > if (!dragging) {
                  > > return;
                  > > }
                  > >
                  > > var p = svgRoot.createSVGPoint();
                  > > p.x = evt.clientX;
                  > > p.y = evt.clientY;
                  > >
                  > > //p = p.matrixTransform(inverseRootCTM);
                  > > p.x -= mouseOffsetX;
                  > > p.y -= mouseOffsetY;
                  > >
                  > > dragX = p.x;
                  > > dragY = p.y;
                  > >
                  > > //svgRoot.currentTranslate.setXY(p.x, p.y);
                  > > svgRoot.currentTranslate.x = p.x;
                  > > svgRoot.currentTranslate.y = p.y;
                  > >
                  > > evt.preventDefault();
                  > > }
                  > >
                  > > function mouseUp(evt) {
                  > > mouseOffsetX = 0;
                  > > mouseOffsetY = 0;
                  > > dragging = false;
                  > >
                  > > evt.preventDefault();
                  > >
                  > > }
                  > >
                  > > --- In svg-developers@yahoogroups.com <svg-developers%40yahoogroups.com>,
                  > > Bradley Neuberg <bradneuberg@> wrote:
                  > >
                  > > > BTW, I have a glitch in the Wikipedia Zoom and Pan prototype that I've
                  > > had
                  > > > trouble tracking down. If you go here:
                  > > >
                  > > >
                  > > http://codinginparadise.org/projects/svgweb-staging/tests/non-licensed/wikipedia/svgzoom/commons-logo.html
                  > > >
                  > > > You will see a prototype. If you click the little magnifying glass you
                  > > can
                  > > > then zoom and pan around the Wikipedia Commons logo.
                  > > >
                  > > > Here's how to get the bug. First, use your mouse scroll wheel to zoom out
                  > > > and have the logo get small. Then click and drag your mouse to pan
                  > > around.
                  > > > You will notice that the logo 'jumps' around and zooms away.
                  > > >
                  > > > My zoom and pan logic for the mouse scroll wheel and pan dragging is
                  > > here:
                  > > >
                  > > >
                  > > http://codinginparadise.org/projects/svgweb-staging/tests/non-licensed/wikipedia/svgzoom/svgzoom.js
                  > > >
                  > > > In the methods zoomIn, zoomOut, mouseDown, mouseMove, and mouseUp.
                  > > >
                  > > > I'm stumped with this bug. At one point Jeff Schiller and Andreas Neumann
                  > > at
                  > > > the conference were hacking with me and we weren't able to figure it out.
                  > > > Any tips is much appreciated :)
                  > > >
                  > > > I think you also mentioned a tip once where you said to have all zooming
                  > > > take the center of where the user is as well as the origin. That's
                  > > another
                  > > > change I'd like to add to the Zoom and Pan prototype.
                  > > >
                  > > > Best,
                  > > > Brad
                  > > >
                  > >
                  > >
                  > >
                  >
                  >
                  > [Non-text portions of this message have been removed]
                  >
                • Bradley Neuberg
                  Works for me in Webkit/Safari! Doesn t work in Firefox though. ... [Non-text portions of this message have been removed]
                  Message 8 of 16 , Oct 28, 2009
                  • 0 Attachment
                    Works for me in Webkit/Safari! Doesn't work in Firefox though.

                    On Wed, Oct 28, 2009 at 10:58 AM, israel_eisenberg <owlgems@...>wrote:

                    >
                    >
                    > Hi Brad,
                    >
                    > Earlier script was tested on FireFox 3.5 and Opera 10
                    > but later tests on the WebKits still jumping.
                    >
                    > Following link tested also on Safari 4 and Chrome 3:
                    >
                    > http://owl3d.com/tests/wikipedia/svgzoom/Commons-logo3.html
                    >
                    > Respond even if it sucks :)
                    >
                    > Best,
                    >
                    > Israel
                    >
                    >
                    > --- In svg-developers@yahoogroups.com <svg-developers%40yahoogroups.com>,
                    > Bradley Neuberg <bradneuberg@...> wrote:
                    > >
                    > > Thanks Israel! Much appreciated!
                    > >
                    > > On Tue, Oct 27, 2009 at 12:47 PM, israel_eisenberg <owlgems@...>wrote:
                    >
                    > >
                    > > >
                    > > >
                    > > > Hi Brad,
                    > > >
                    > > > Seems like it works also on Opera now (without jumping :)), give it a
                    > try:
                    > > >
                    > > > function mouseDown(evt) {
                    > > > dragging = true;
                    > > >
                    > > > var p = svgRoot.createSVGPoint();
                    > > > p.x = evt.clientX;
                    > > > p.y = evt.clientY;
                    > > >
                    > > > //var rootCTM = svgRoot.getCTM();
                    > > > //inverseRootCTM = rootCTM.inverse();
                    > > >
                    > > > //p = p.matrixTransform(inverseRootCTM);
                    > > >
                    > > > mouseOffsetX = p.x - dragX; //- svgRoot.currentTranslate.x;
                    > > > mouseOffsetY = p.y - dragY; //- svgRoot.currentTranslate.y;
                    > > >
                    > > > evt.preventDefault();
                    > > > }
                    > > >
                    > > > function mouseMove(evt) {
                    > > > if (!dragging) {
                    > > > return;
                    > > > }
                    > > >
                    > > > var p = svgRoot.createSVGPoint();
                    > > > p.x = evt.clientX;
                    > > > p.y = evt.clientY;
                    > > >
                    > > > //p = p.matrixTransform(inverseRootCTM);
                    > > > p.x -= mouseOffsetX;
                    > > > p.y -= mouseOffsetY;
                    > > >
                    > > > dragX = p.x;
                    > > > dragY = p.y;
                    > > >
                    > > > //svgRoot.currentTranslate.setXY(p.x, p.y);
                    > > > svgRoot.currentTranslate.x = p.x;
                    > > > svgRoot.currentTranslate.y = p.y;
                    > > >
                    > > > evt.preventDefault();
                    > > > }
                    > > >
                    > > > function mouseUp(evt) {
                    > > > mouseOffsetX = 0;
                    > > > mouseOffsetY = 0;
                    > > > dragging = false;
                    > > >
                    > > > evt.preventDefault();
                    > > >
                    > > > }
                    > > >
                    > > > --- In svg-developers@yahoogroups.com<svg-developers%40yahoogroups.com><svg-developers%
                    > 40yahoogroups.com>,
                    >
                    > > > Bradley Neuberg <bradneuberg@> wrote:
                    > > >
                    > > > > BTW, I have a glitch in the Wikipedia Zoom and Pan prototype that
                    > I've
                    > > > had
                    > > > > trouble tracking down. If you go here:
                    > > > >
                    > > > >
                    > > >
                    > http://codinginparadise.org/projects/svgweb-staging/tests/non-licensed/wikipedia/svgzoom/commons-logo.html
                    > > > >
                    > > > > You will see a prototype. If you click the little magnifying glass
                    > you
                    > > > can
                    > > > > then zoom and pan around the Wikipedia Commons logo.
                    > > > >
                    > > > > Here's how to get the bug. First, use your mouse scroll wheel to zoom
                    > out
                    > > > > and have the logo get small. Then click and drag your mouse to pan
                    > > > around.
                    > > > > You will notice that the logo 'jumps' around and zooms away.
                    > > > >
                    > > > > My zoom and pan logic for the mouse scroll wheel and pan dragging is
                    > > > here:
                    > > > >
                    > > > >
                    > > >
                    > http://codinginparadise.org/projects/svgweb-staging/tests/non-licensed/wikipedia/svgzoom/svgzoom.js
                    > > > >
                    > > > > In the methods zoomIn, zoomOut, mouseDown, mouseMove, and mouseUp.
                    > > > >
                    > > > > I'm stumped with this bug. At one point Jeff Schiller and Andreas
                    > Neumann
                    > > > at
                    > > > > the conference were hacking with me and we weren't able to figure it
                    > out.
                    > > > > Any tips is much appreciated :)
                    > > > >
                    > > > > I think you also mentioned a tip once where you said to have all
                    > zooming
                    > > > > take the center of where the user is as well as the origin. That's
                    > > > another
                    > > > > change I'd like to add to the Zoom and Pan prototype.
                    > > > >
                    > > > > Best,
                    > > > > Brad
                    > > > >
                    > > >
                    > > >
                    > > >
                    > >
                    > >
                    > > [Non-text portions of this message have been removed]
                    > >
                    >
                    >
                    >


                    [Non-text portions of this message have been removed]
                  • israel_eisenberg
                    Are your FF different than my FF? only reason I can think of is that svgweb is actually not on my page so I couldn t use this: // set up the mouse scroll
                    Message 9 of 16 , Oct 28, 2009
                    • 0 Attachment
                      Are your FF different than my FF? only reason I can think of is
                      that svgweb is actually not on my page so I couldn't use this:

                      // set up the mouse scroll wheel; FF 3.5/Native has an annoying bug
                      // where DOMMouseScroll events do not propagate to OBJECTs under
                      // some situations!
                      if (isFF && svgweb.getHandlerType() == 'native') {
                      hookEvent(svgObject.contentDocument.rootElement, 'mousewheel',
                      MouseWheel);
                      } else {
                      hookEvent('file', 'mousewheel', MouseWheel);
                      }

                      Just grab the mouse parts from my code and hook them in your page,
                      see if it fix FF (it was the first to respond nicely to my code).
                      Talk to you tomorrow, it's 4:30 AM in Bangkok and I am off to zzzzzz

                      Israel


                      --- In svg-developers@yahoogroups.com, Bradley Neuberg <bradneuberg@...> wrote:
                      >
                      > Works for me in Webkit/Safari! Doesn't work in Firefox though.
                      >
                      > On Wed, Oct 28, 2009 at 10:58 AM, israel_eisenberg <owlgems@...>wrote:
                      >
                      > >
                      > >
                      > > Hi Brad,
                      > >
                      > > Earlier script was tested on FireFox 3.5 and Opera 10
                      > > but later tests on the WebKits still jumping.
                      > >
                      > > Following link tested also on Safari 4 and Chrome 3:
                      > >
                      > > http://owl3d.com/tests/wikipedia/svgzoom/Commons-logo3.html
                      > >
                      > > Respond even if it sucks :)
                      > >
                      > > Best,
                      > >
                      > > Israel
                      > >
                      > >
                      > > --- In svg-developers@yahoogroups.com <svg-developers%40yahoogroups.com>,
                      > > Bradley Neuberg <bradneuberg@> wrote:
                      > > >
                      > > > Thanks Israel! Much appreciated!
                      > > >
                      > > > On Tue, Oct 27, 2009 at 12:47 PM, israel_eisenberg <owlgems@>wrote:
                      > >
                      > > >
                      > > > >
                      > > > >
                      > > > > Hi Brad,
                      > > > >
                      > > > > Seems like it works also on Opera now (without jumping :)), give it a
                      > > try:
                      > > > >
                      > > > > function mouseDown(evt) {
                      > > > > dragging = true;
                      > > > >
                      > > > > var p = svgRoot.createSVGPoint();
                      > > > > p.x = evt.clientX;
                      > > > > p.y = evt.clientY;
                      > > > >
                      > > > > //var rootCTM = svgRoot.getCTM();
                      > > > > //inverseRootCTM = rootCTM.inverse();
                      > > > >
                      > > > > //p = p.matrixTransform(inverseRootCTM);
                      > > > >
                      > > > > mouseOffsetX = p.x - dragX; //- svgRoot.currentTranslate.x;
                      > > > > mouseOffsetY = p.y - dragY; //- svgRoot.currentTranslate.y;
                      > > > >
                      > > > > evt.preventDefault();
                      > > > > }
                      > > > >
                      > > > > function mouseMove(evt) {
                      > > > > if (!dragging) {
                      > > > > return;
                      > > > > }
                      > > > >
                      > > > > var p = svgRoot.createSVGPoint();
                      > > > > p.x = evt.clientX;
                      > > > > p.y = evt.clientY;
                      > > > >
                      > > > > //p = p.matrixTransform(inverseRootCTM);
                      > > > > p.x -= mouseOffsetX;
                      > > > > p.y -= mouseOffsetY;
                      > > > >
                      > > > > dragX = p.x;
                      > > > > dragY = p.y;
                      > > > >
                      > > > > //svgRoot.currentTranslate.setXY(p.x, p.y);
                      > > > > svgRoot.currentTranslate.x = p.x;
                      > > > > svgRoot.currentTranslate.y = p.y;
                      > > > >
                      > > > > evt.preventDefault();
                      > > > > }
                      > > > >
                      > > > > function mouseUp(evt) {
                      > > > > mouseOffsetX = 0;
                      > > > > mouseOffsetY = 0;
                      > > > > dragging = false;
                      > > > >
                      > > > > evt.preventDefault();
                      > > > >
                      > > > > }
                      > > > >
                      > > > > --- In svg-developers@yahoogroups.com<svg-developers%40yahoogroups.com><svg-developers%
                      > > 40yahoogroups.com>,
                      > >
                      > > > > Bradley Neuberg <bradneuberg@> wrote:
                      > > > >
                      > > > > > BTW, I have a glitch in the Wikipedia Zoom and Pan prototype that
                      > > I've
                      > > > > had
                      > > > > > trouble tracking down. If you go here:
                      > > > > >
                      > > > > >
                      > > > >
                      > > http://codinginparadise.org/projects/svgweb-staging/tests/non-licensed/wikipedia/svgzoom/commons-logo.html
                      > > > > >
                      > > > > > You will see a prototype. If you click the little magnifying glass
                      > > you
                      > > > > can
                      > > > > > then zoom and pan around the Wikipedia Commons logo.
                      > > > > >
                      > > > > > Here's how to get the bug. First, use your mouse scroll wheel to zoom
                      > > out
                      > > > > > and have the logo get small. Then click and drag your mouse to pan
                      > > > > around.
                      > > > > > You will notice that the logo 'jumps' around and zooms away.
                      > > > > >
                      > > > > > My zoom and pan logic for the mouse scroll wheel and pan dragging is
                      > > > > here:
                      > > > > >
                      > > > > >
                      > > > >
                      > > http://codinginparadise.org/projects/svgweb-staging/tests/non-licensed/wikipedia/svgzoom/svgzoom.js
                      > > > > >
                      > > > > > In the methods zoomIn, zoomOut, mouseDown, mouseMove, and mouseUp.
                      > > > > >
                      > > > > > I'm stumped with this bug. At one point Jeff Schiller and Andreas
                      > > Neumann
                      > > > > at
                      > > > > > the conference were hacking with me and we weren't able to figure it
                      > > out.
                      > > > > > Any tips is much appreciated :)
                      > > > > >
                      > > > > > I think you also mentioned a tip once where you said to have all
                      > > zooming
                      > > > > > take the center of where the user is as well as the origin. That's
                      > > > > another
                      > > > > > change I'd like to add to the Zoom and Pan prototype.
                      > > > > >
                      > > > > > Best,
                      > > > > > Brad
                      > > > > >
                      > > > >
                      > > > >
                      > > > >
                      > > >
                      > > >
                      > > > [Non-text portions of this message have been removed]
                      > > >
                      > >
                      > >
                      > >
                      >
                      >
                      > [Non-text portions of this message have been removed]
                      >
                    • israel_eisenberg
                      Hi Brad, I took the link I sent you for a ride on an earlier version of FireFox (1.5) and it doesn t work. The browser simply do not recognize the object tag,
                      Message 10 of 16 , Oct 30, 2009
                      • 0 Attachment
                        Hi Brad,

                        I took the link I sent you for a ride on an earlier version of FireFox (1.5)
                        and it doesn't work. The browser simply do not recognize the object tag,
                        which immediately reminded me experiments I made a long time ago
                        with javaScripting across the object/embed elements. I cannot find
                        those experiments, but I remember the conclusion: to insert SVG into
                        HTML use embed and not object. That's why in my articles, all SVG
                        demos are embeds and not objects.

                        In the following link I replaced the SVG wrap to embed and now it works
                        well also on FF1.5 (and all its younger brothers). Give it a try and kindly
                        let me know if your FF is ok now:

                        http://owl3d.com/tests/wikipedia/svgzoom/Commons-logo4.html

                        Best results,

                        Israel

                        BTW, any particular reason you ignore Opera?:)


                        --- In svg-developers@yahoogroups.com, Bradley Neuberg <bradneuberg@...> wrote:
                        >
                        > Works for me in Webkit/Safari! Doesn't work in Firefox though.
                        >
                      • Bradley Neuberg
                        Nice! I had originally avoided EMBED because the EMBED tag doesn t provide fallback content, but I think in the long term I will move towards having an OBJECT
                        Message 11 of 16 , Oct 30, 2009
                        • 0 Attachment
                          Nice! I had originally avoided EMBED because the EMBED tag doesn't provide
                          fallback content, but I think in the long term I will move towards having an
                          OBJECT tag with an EMBED tag inside of it.

                          I don't mean to ignore Opera, I just have my hands full with other bugs and
                          issues to fix. I have an open issue to do more QA on Opera.

                          On Fri, Oct 30, 2009 at 8:24 AM, israel_eisenberg <owlgems@...> wrote:

                          >
                          >
                          > Hi Brad,
                          >
                          > I took the link I sent you for a ride on an earlier version of FireFox
                          > (1.5)
                          > and it doesn't work. The browser simply do not recognize the object tag,
                          > which immediately reminded me experiments I made a long time ago
                          > with javaScripting across the object/embed elements. I cannot find
                          > those experiments, but I remember the conclusion: to insert SVG into
                          > HTML use embed and not object. That's why in my articles, all SVG
                          > demos are embeds and not objects.
                          >
                          > In the following link I replaced the SVG wrap to embed and now it works
                          > well also on FF1.5 (and all its younger brothers). Give it a try and kindly
                          >
                          > let me know if your FF is ok now:
                          >
                          > http://owl3d.com/tests/wikipedia/svgzoom/Commons-logo4.html
                          >
                          > Best results,
                          >
                          > Israel
                          >
                          > BTW, any particular reason you ignore Opera?:)
                          >
                          >
                          > --- In svg-developers@yahoogroups.com <svg-developers%40yahoogroups.com>,
                          > Bradley Neuberg <bradneuberg@...> wrote:
                          > >
                          > > Works for me in Webkit/Safari! Doesn't work in Firefox though.
                          > >
                          >
                          >
                          >


                          [Non-text portions of this message have been removed]
                        • profileofpradeep
                          Hi Brad, The panning and zooming scripts look very impressive. Do you have tutorials to configure your scripts (Original View) for svg diagrams. How would your
                          Message 12 of 16 , Oct 31, 2009
                          • 0 Attachment
                            Hi Brad,

                            The panning and zooming scripts look very impressive.

                            Do you have tutorials to configure your scripts (Original View) for svg diagrams. How would your script perform when I use a large maps with 100s of paths.

                            Thank you,

                            Sincerely,
                            --Pradeep

                            --- In svg-developers@yahoogroups.com, Bradley Neuberg <bradneuberg@...> wrote:
                            >
                            > Nice! I had originally avoided EMBED because the EMBED tag doesn't provide
                            > fallback content, but I think in the long term I will move towards having an
                            > OBJECT tag with an EMBED tag inside of it.
                            >
                            > I don't mean to ignore Opera, I just have my hands full with other bugs and
                            > issues to fix. I have an open issue to do more QA on Opera.
                            >
                            > On Fri, Oct 30, 2009 at 8:24 AM, israel_eisenberg <owlgems@...> wrote:
                            >
                            > >
                            > >
                            > > Hi Brad,
                            > >
                            > > I took the link I sent you for a ride on an earlier version of FireFox
                            > > (1.5)
                            > > and it doesn't work. The browser simply do not recognize the object tag,
                            > > which immediately reminded me experiments I made a long time ago
                            > > with javaScripting across the object/embed elements. I cannot find
                            > > those experiments, but I remember the conclusion: to insert SVG into
                            > > HTML use embed and not object. That's why in my articles, all SVG
                            > > demos are embeds and not objects.
                            > >
                            > > In the following link I replaced the SVG wrap to embed and now it works
                            > > well also on FF1.5 (and all its younger brothers). Give it a try and kindly
                            > >
                            > > let me know if your FF is ok now:
                            > >
                            > > http://owl3d.com/tests/wikipedia/svgzoom/Commons-logo4.html
                            > >
                            > > Best results,
                            > >
                            > > Israel
                            > >
                            > > BTW, any particular reason you ignore Opera?:)
                            > >
                            > >
                            > > --- In svg-developers@yahoogroups.com <svg-developers%40yahoogroups.com>,
                            > > Bradley Neuberg <bradneuberg@> wrote:
                            > > >
                            > > > Works for me in Webkit/Safari! Doesn't work in Firefox though.
                            > > >
                            > >
                            > >
                            > >
                            >
                            >
                            > [Non-text portions of this message have been removed]
                            >
                          • Bradley Neuberg
                            Thanks Pradeep; this work will go into the Wikipedia Commons soon. Just have to finish things up. I m not sure how it will deal with large maps. Do you have a
                            Message 13 of 16 , Nov 1, 2009
                            • 0 Attachment
                              Thanks Pradeep; this work will go into the Wikipedia Commons soon. Just have
                              to finish things up.

                              I'm not sure how it will deal with large maps. Do you have a test case?

                              On Sat, Oct 31, 2009 at 8:47 AM, profileofpradeep <pradeep2005s@...>wrote:

                              >
                              >
                              > Hi Brad,
                              >
                              > The panning and zooming scripts look very impressive.
                              >
                              > Do you have tutorials to configure your scripts (Original View) for svg
                              > diagrams. How would your script perform when I use a large maps with 100s of
                              > paths.
                              >
                              > Thank you,
                              >
                              > Sincerely,
                              > --Pradeep
                              >
                              >
                              > --- In svg-developers@yahoogroups.com <svg-developers%40yahoogroups.com>,
                              > Bradley Neuberg <bradneuberg@...> wrote:
                              > >
                              > > Nice! I had originally avoided EMBED because the EMBED tag doesn't
                              > provide
                              > > fallback content, but I think in the long term I will move towards having
                              > an
                              > > OBJECT tag with an EMBED tag inside of it.
                              > >
                              > > I don't mean to ignore Opera, I just have my hands full with other bugs
                              > and
                              > > issues to fix. I have an open issue to do more QA on Opera.
                              > >
                              > > On Fri, Oct 30, 2009 at 8:24 AM, israel_eisenberg <owlgems@...> wrote:
                              > >
                              > > >
                              > > >
                              > > > Hi Brad,
                              > > >
                              > > > I took the link I sent you for a ride on an earlier version of FireFox
                              > > > (1.5)
                              > > > and it doesn't work. The browser simply do not recognize the object
                              > tag,
                              > > > which immediately reminded me experiments I made a long time ago
                              > > > with javaScripting across the object/embed elements. I cannot find
                              > > > those experiments, but I remember the conclusion: to insert SVG into
                              > > > HTML use embed and not object. That's why in my articles, all SVG
                              > > > demos are embeds and not objects.
                              > > >
                              > > > In the following link I replaced the SVG wrap to embed and now it works
                              > > > well also on FF1.5 (and all its younger brothers). Give it a try and
                              > kindly
                              > > >
                              > > > let me know if your FF is ok now:
                              > > >
                              > > > http://owl3d.com/tests/wikipedia/svgzoom/Commons-logo4.html
                              > > >
                              > > > Best results,
                              > > >
                              > > > Israel
                              > > >
                              > > > BTW, any particular reason you ignore Opera?:)
                              > > >
                              > > >
                              > > > --- In svg-developers@yahoogroups.com<svg-developers%40yahoogroups.com><svg-developers%
                              > 40yahoogroups.com>,
                              >
                              > > > Bradley Neuberg <bradneuberg@> wrote:
                              > > > >
                              > > > > Works for me in Webkit/Safari! Doesn't work in Firefox though.
                              > > > >
                              > > >
                              > > >
                              > > >
                              > >
                              > >
                              > > [Non-text portions of this message have been removed]
                              > >
                              >
                              >
                              >


                              [Non-text portions of this message have been removed]
                            Your message has been successfully submitted and would be delivered to recipients shortly.