<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Thank you Mehmet -<br>
    </p>
    <p>Tried to follow the math within the svg (inkscape) on my first
      attempt(s)</p>
    <p>got completely lost (which leads to questioning ones
      intelligence) on the transforms, scales and differing units :)</p>
    <p>So now fully fudging it by dividing the Svg source Height and
      Width by a grid format and call each one a quadrant location
      (x,y).</p>
    <p>Then do the same with the OnClick position of the viewer (so
      relative quadrants / sizes), and find closest matching (for me)
      object. All depends on granularity of grid for accuracy. <br>
    </p>
    <p>Works, but is very dependent on complexity of the svg (not a
      problem for my use case so far)<br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 18/1/22 9:53 am, Mehmet Erol
      Sanliturk wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAOgwaMuDfe0hrizVOfy0jqRKB-AsJKcPyaymkosH4L17gSH==Q@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr">
          <div class="gmail_default"
            style="font-family:tahoma,sans-serif;font-size:large"><br>
          </div>
        </div>
        <br>
        <div class="gmail_quote">
          <div dir="ltr" class="gmail_attr">On Tue, Jan 18, 2022 at 2:37
            AM Steve Gatenby via lazarus <<a
              href="mailto:lazarus@lists.lazarus-ide.org"
              moz-do-not-send="true">lazarus@lists.lazarus-ide.org</a>>
            wrote:<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">Thanks Marc - seems I
            will need to stick with what I have then.<br>
            <br>
            Currently I am pulling all object info from the SVG into an
            array and <br>
            assigning quadrant positions.<br>
            <br>
            Then do best guess by relative quadrant of mouse click
            position - works <br>
            fine, but feels sloppy :)<br>
            <br>
          </blockquote>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default">If it is feasible for you , you may
              do the following :</div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default"><br>
            </div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default"><br>
            </div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default">In an array of a record , define
              approximate "bounding boxes" of your</div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default">SVG graphic ( You may generate  a
              "bounding box" array conforming to the given SVG ) .</div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default"><br>
            </div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default">In  the "bounding box" array record
              , you may define a pointer showing the SVG object .</div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default">When a mouse click is obtained , you
              may search  "bounding box" array and <br>
            </div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default">if it is related with an element of
              the SVG , from it you reach to the SVG element and</div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default">do whatever you want to do with it .<br>
            </div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default"><br>
            </div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default"><br>
            </div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default"><a
                href="https://en.wikipedia.org/wiki/Minimum_bounding_box"
                moz-do-not-send="true">https://en.wikipedia.org/wiki/Minimum_bounding_box</a></div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default">Minimum bounding box</div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default"><br>
            </div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default">( Please see attached pages . )</div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default"><br>
            </div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default"><br>
            </div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default">This idea may be considered as an
              alternative view which I can not say that</div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default">it is very suitable for you . Only
              you may decide its usefulness .<br>
            </div>
            <br>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>
            <div style="font-family:tahoma,sans-serif;font-size:large"
              class="gmail_default">Mehmet Erol Sanliturk</div>
            <br>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div> </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">
            <br>
            On 17/1/22 8:55 pm, Marc Weustink via lazarus wrote:<br>
            > I'm afraid there is no easy solution for that. SVGs are
            rendered from <br>
            > the first element to the last, where ever element
            (atleast in theory) <br>
            > can be a part of a given pixel. SVG elements do have a
            <br>
            > x,y,width,height but they may also be part of one or
            more <br>
            > transformations.<br>
            > To give you an idea, the (browser)app I'm currently
            working on <br>
            > displays several object, where every object has an
            origin(x,y) of 0,0 <br>
            > and they are finally placed by translations.<br>
            > The easiest way (if you are in a browser context) is to
            add an onclick <br>
            > handler to your elements of interest.<br>
            ><br>
            > Marc<br>
            ><br>
            ><br>
            ><br>
            > On 16-1-2022 23:34, Steve Gatenby via lazarus wrote:<br>
            >> Not sure if this is the right place to ask about
            this one -<br>
            >><br>
            >> I am using the BCSVGViewer from bgra controls - for
            SVG viewing <br>
            >> obviously :)<br>
            >><br>
            >> Would anybody know if there is a method to retrieve
            the object <br>
            >> (within the svg) at specified x,y ?<br>
            >><br>
            >> or is it possible to use embedded links within the
            svg ?<br>
            >><br>
            >> I am looking to find which object has been clicked
            on within the svg <br>
            >> to create a 'clickable' map<br>
            >><br>
            >> Any suggestions on a better place to post this also
            appreciated<br>
            >><br>
            >> Regards SteveG<br>
            >><br>
            -- <br>
            _______________________________________________<br>
            lazarus mailing list<br>
            <a href="mailto:lazarus@lists.lazarus-ide.org"
              target="_blank" moz-do-not-send="true">lazarus@lists.lazarus-ide.org</a><br>
            <a href="https://lists.lazarus-ide.org/listinfo/lazarus"
              rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.lazarus-ide.org/listinfo/lazarus</a><br>
          </blockquote>
        </div>
      </div>
    </blockquote>
  </body>
</html>