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

Re: Converting user coordinates to root element coordinates

Expand Messages
  • Samuel Dagan
    Hi Simon, It is a pity that you are stuck with IE+ASV3. The function getScreenCTM() is not supported by ASV3. There is an ecma-script function of Holger Will,
    Message 1 of 7 , Mar 9 1:42 AM
    • 0 Attachment
      Hi Simon,

      It is a pity that you are stuck with IE+ASV3. The function getScreenCTM() is not supported by ASV3. There is an ecma-script function of Holger Will, with modifications of Jeff Schiller that does the job. Look at:
      http://groups.yahoo.com/group/svg-developers/message/50789
      It works fine!

      Good luck, Samy

      --- In svg-developers@yahoogroups.com, "simonshutter" <simon@...> wrote:
      >
      > I have a series of nested viewports (svg elements with viewBox attribute) and transformations (group elements with transform attribute). I'm trying to determine the best way to convert the user coordinates of the innermost element to the root element coordinate system.
      >
      > I'm not sure that getTransformToElement() handles nested coordinate systems but, in any case, I'm stuck with ASV3.03, which doesn't implement getTransformToElement. I believe I can use getCTM() for the transformations within a viewport.
      >
      > Do I have to navigate the DOM from the innermost element to the root, and manually convert the coordinates as I go?
      >
      > Thanks, Simon
      >
    • Helder Magalhães
      ... Yes, I believe there is a slightly updated version in a drag sample [1] by Jeff Schiller. (View source and search for getScreenCTM if you are curious).
      Message 2 of 7 , Mar 9 4:00 AM
      • 0 Attachment
        > There is an ecma-script function of Holger Will, with modifications
        > of Jeff Schiller that does the job.

        Yes, I believe there is a slightly updated version in a drag sample [1] by Jeff Schiller. (View source and search for "getScreenCTM" if you are curious).

        Hope this helps,
        Helder Magalhães

        [1] http://www.codedread.com/dragtest2.svg
      • Naveen Kumar T N
        Hi, I am working on rendering of the svg file. I am not able to find the tag in svg which could specify about the layer data of the element present. Ex: If
        Message 3 of 7 , Mar 9 4:35 AM
        • 0 Attachment
          Hi,

          I am working on rendering of the svg file.

          I am not able to find the tag in svg which could specify about the layer data of the element present.

          Ex: If there are 2 elements present in the svg file where one element is present in 1st layer and the other is present in the 2nd layer. Which tag represents the layer data for the elements?

          Kindly give me the pointer in this direction.

          Regards,
          Naveen






          **************** CAUTION - Disclaimer *****************
          This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
          for the use of the addressee(s). If you are not the intended recipient, please
          notify the sender by e-mail and delete the original message. Further, you are not
          to copy, disclose, or distribute this e-mail or its contents to any other person and
          any such actions are unlawful. This e-mail may contain viruses. Infosys has taken
          every reasonable precaution to minimize this risk, but is not liable for any damage
          you may sustain as a result of any virus in this e-mail. You should carry out your
          own virus checks before opening the e-mail or attachment. Infosys reserves the
          right to monitor and review the content of all messages sent to or from this e-mail
          address. Messages sent to or from this e-mail address may be stored on the
          Infosys e-mail system.
          ***INFOSYS******** End of Disclaimer ********INFOSYS***


          [Non-text portions of this message have been removed]
        • Helder Magalhães
          Hi Naveen, ... In SVG, visual elements are stacked according to the order they are declared [1]. As far as I know, there is not a specific layer concept,
          Message 4 of 7 , Mar 9 6:35 AM
          • 0 Attachment
            Hi Naveen,


            > I am not able to find the tag in svg which could specify
            > about the layer data of the element present.

            In SVG, visual elements are stacked according to the order they are declared [1]. As far as I know, there is not a specific "layer" concept, although this is usually modeled using through group elements [2]: a nice example from carto.net [3] shows how can this be achieved (toggle the checkboxes to show/hide the "layers").


            Hope this helps,
            Helder Magalhães


            [1] http://www.w3.org/TR/SVG11/render.html#RenderingOrder
            [2] http://www.w3.org/TR/SVG11/struct.html#Groups
            [3] http://www.carto.net/papers/svg/samples/canvas.shtml
          • simonshutter
            Thanks, Samy and Helder - I will check out the script Simon
            Message 5 of 7 , Mar 9 8:20 AM
            • 0 Attachment
              Thanks, Samy and Helder - I will check out the script

              Simon


              --- In svg-developers@yahoogroups.com, Helder Magalhães <helder.magalhaes@...> wrote:
              >
              > > There is an ecma-script function of Holger Will, with modifications
              > > of Jeff Schiller that does the job.
              >
              > Yes, I believe there is a slightly updated version in a drag sample [1] by Jeff Schiller. (View source and search for "getScreenCTM" if you are curious).
              >
              > Hope this helps,
              > Helder Magalhães
              >
              > [1] http://www.codedread.com/dragtest2.svg
              >
            • ddailey
              ... I gather that you are looking for something like a z-index in HTML. In SVG, this is just the rendering order (within the parent node) [1]. So I suppose if
              Message 6 of 7 , Mar 9 2:44 PM
              • 0 Attachment
                Naveen wrote:

                >Ex: If there are 2 elements present in the svg file where one element is present in 1st layer and the other is present in the 2nd layer. Which tag represents the layer data for the elements?

                I gather that you are looking for something like a z-index in HTML. In SVG, this is just the rendering order (within the parent node) [1]. So I suppose if you don't know where something is, you could retrieve its parent, and then loop through the children of the parent keeping track of the index until you find the node in question -- that would be the rough equivalent of its stacking order.

                The question often arises when you wish to change the stacking order (front to back) of objects. This is typically done by removing an object in the middle of the stack and appending it either to the front or bottom of the stack to move it up or down. I think Andreas Neumann has some nice examples at http://www.carto.net/papers/svg/manipulating_svg_with_dom_ecmascript/ , and I found another one by googling http://wiki.svg.org/Rendering_Order (unfortunately it isn't loading right now, but I suppose that is just a temporary thing).

                Hope this helps
                David


                [1] http://www.w3.org/TR/1999/WD-SVG-19990211/render.html

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