You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by vh...@apache.org on 2002/09/02 16:07:36 UTC

cvs commit: xml-batik/samples/tests/spec/interactivity useTarget.svg

vhardy      2002/09/02 07:07:36

  Added:       samples/tests/spec/interactivity useTarget.svg
  Log:
  New test showing bug with target on <use> elements. Currently, the reported target is the cloned element hooked into the imported tree. Working on fix and hopefully the commit will follow soon
  
  Revision  Changes    Path
  1.1                  xml-batik/samples/tests/spec/interactivity/useTarget.svg
  
  Index: useTarget.svg
  ===================================================================
  <?xml version="1.0" standalone="no"?>
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
  "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
  
  <!-- ========================================================================= -->
  <!-- Copyright (C) The Apache Software Foundation. All rights reserved.        -->
  <!--                                                                           -->
  <!-- This software is published under the terms of the Apache Software License -->
  <!-- version 1.1, a copy of which has been included with this distribution in  -->
  <!-- the LICENSE file.                                                         -->
  <!-- ========================================================================= -->
  
  <!-- ========================================================================= -->
  <!-- This test validates that the event target, for events triggered from the  -->
  <!-- content of a 'use' element, is the 'use' element (and not the cloned      -->
  <!-- elements).                                                                -->
  <!--                                                                           -->
  <!-- @author vincent.hardy@sun.com                                             -->
  <!-- @version $Id: useTarget.svg,v 1.1 2002/09/02 14:07:36 vhardy Exp $ -->
  <!-- ========================================================================= -->
  
  <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
  
  <svg xmlns="http://www.w3.org/2000/svg" 
       xmlns:xlink="http://www.w3.org/1999/xlink"
       id="body" width="450" height="500" viewBox="0 0 450 500">
  
      <text class="title" x="50%" y="50">Event target on use</text>
  
      <script type="text/ecmascript"><![CDATA[
  
      function highlight(evt, onOrOff) {
          var h = document.getElementById("highlight");
          var x = 175;
          var y = 280;
  
          if (onOrOff) {
              var t = evt.getTarget();
              x = t.getAttributeNS(null, "x");
              y = t.getAttributeNS(null, "y");
          } 
  
          h.setAttributeNS(null, "x", x);
          h.setAttributeNS(null, "y", y);
  
      }
          
      ]]></script>
  
      <style type="text/css"><![CDATA[
          .label {
              text-anchor: middle;
          }
      ]]></style>
  
      <defs>
          <g id="useDef">
              <rect x="0" y="0" width="100" height="30" fill="gold" stroke="none" />
          </g>
  
      </defs>
  
  
      <text x="50%" y="140" class="label">
          <tspan x="50%" y="140">Use Target:</tspan>
          <tspan dy="1.1em" x="50%">move your mouse over the gold</tspan>
          <tspan dy="1.1em" x="50%">rectangle. This should move the </tspan>
          <tspan dy="1.1em" x="50%">black highlight over the gold rectangle</tspan>
      </text>
  
      <use xlink:href="#useDef" x="175" y="190" 
           onmouseover="highlight(evt, true)" 
           onmouseout="highlight(evt, false)"/>
  
      <text x="50%" y="270" class="label">Black highlight</text>
      <rect id="highlight" x="175" y="280" width="100" height="30" fill="none" stroke="black" />
  
  </svg>
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org