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

Re: PROBLEM with setSrc and onmousemove

Expand Messages
  • Rastoix Sylvia
    Sorry for my bad English, I m not clear. forget the loop while : I tried something but it doesn t work. I want to create a zoom box, when I m putting my mouse
    Message 1 of 3 , Sep 1, 2003
    • 0 Attachment
      Sorry for my bad English,

      I 'm not clear.

      forget the loop while : I tried something but it doesn't work.

      I want to create a zoom box,
      when I'm putting my mouse down, the point is stocked
      when the mouse move, the rectangle is drawed in the svg document,
      when a i'm putting my mouse up, i'm calling setsrc to change the
      source corresponding to the box (the source is in fact a servlet
      which has got the data of the rectangle as parameters)

      In my 4 files of test, I just want to obtain the test2.svg after a
      mouseup event in test1.svg by changing the source (with setSrc).
      (and not after the document is loaded)

      here are my files corrected without the loop
      __________________________________________________________
      SVGScript.js
      _________________________________________________________

      function MouseDown(evt)
      {
      }

      function MouseMove(evt)
      {
      }

      function MouseUp(evt)
      {
      var svgdoc = window.parent.svgmap.getSVGDocument();
      var val=svgdoc.getElementById("texte");
      if(val.getAttribute("value")=="1")
      {
      window.parent.svgmap.setSrc("test2.svg");
      }
      else
      window.parent.svgmap.setSrc("test1.svg");
      }
      _____________________________________________________
      test1.svg
      _____________________________________________________
      <?xml version="1.0" encoding="iso-8859-1"?>
      <svg width="1000" height="1000" contentScriptType="text/ecmascript"
      zoomAndPan="magnify" id="svgroot" preserveAspectRatio="xMidyMid
      slice" encoding="iso-8859-1" onmouseup="MouseUp()"
      onmousedown="MouseDown()" onmousemove="MouseMove()">
      <script xlink:href="SVGScript.js" type="text/jscript"/>
      <g style="color:black;font-size:20; font-family:Verdana;">
      <rect style="fill:yellow;fill-opacity:0.3;" x="0" y="0"
      width="1000" height="1000"/>
      <text id="texte" value="1" x="50" y="50">TEST 1</text>
      <rect id="selection" style="fill:blue;" x="10" y="10"
      width="30" height="30"/>
      </g>
      </svg>
      _____________________________________________________
      test2.svg
      _____________________________________________________
      <?xml version="1.0" encoding="iso-8859-1"?>
      <svg width="1000" height="1000" contentScriptType="text/ecmascript"
      zoomAndPan="magnify" id="svgroot" preserveAspectRatio="xMidyMid
      slice" encoding="iso-8859-1" onmouseup="MouseUp()"
      onmousedown="MouseDown()" onmousemove="MouseMove()">
      <script xlink:href="SVGScript.js" type="text/jscript"/>
      <g style="color:black;font-size:20; font-family:Verdana;">
      <rect style="fill:yellow;fill-opacity:0.3;" x="0" y="0"
      width="1000" height="1000"/>
      <text id="texte" value="2" x="50" y="50">TEST 2</text>
      <rect id="selection" style="fill:red;" x="10" y="10"
      width="30" height="30"/>
      </g>
      </svg>

      _____________________________________________________
      justatest.html
      _____________________________________________________
      <HTML>
      <BODY>
      <embed pluginspage="http://www.adobe.com/svg/viewer/install/"
      type="image/svg-xml" width="100%" height="100%" name="svgmap"
      src="./test1.svg" style="border-style:inset;border-width:2;"/>
      </BODY>
      </HTML>
      _______________________________________________________



      --- In svg-developers@yahoogroups.com, "Jim Ley" <jim@j...> wrote:
      >
      > "Rastoix Sylvia" <sylvia_rasta@y...> wrote in message
      > news:bivh4o+joh3@e...
      >
      >
      > >I tried to put a
      > > variable to know if my SVG is entirely loaded, but I don't know if
      > > it's the good way...
      >
      > javascript programming is event driven, so you know you're entirely
      loaded
      > when your onload event fires.
      >
      > > while(window.parent.document.getElementById("SVGLoaded").value
      > > =="false")
      > > {continue; }
      > > }
      >
      > never do closed loops like this in javascript! wait until the
      onload event
      > fires.
      >
      > I think it would be best if you try and explain what you actually
      want to
      > do, a simple setTimeout to delay the src change would likely solve
      the
      > problem you asked, but I really don't think that you're asking the
      best
      > question. What do you want to do, when an SVG document is loaded
      move to
      > the next svg doc?
      >
      > Jim.
    Your message has been successfully submitted and would be delivered to recipients shortly.