tkormann 01/12/19 08:17:42 Modified: sources/org/apache/batik/bridge AbstractGraphicsNodeBridge.java CSSUtilities.java SVGImageElementBridge.java SVGTextElementBridge.java sources/org/apache/batik/gvt AbstractGraphicsNode.java CompositeShapePainter.java GraphicsNode.java ImageNode.java ShapeNode.java TextNode.java Added: samples/tests/spec/linking pointerEvents.svg pointerEvents2.svg Log: - commit support for the 'pointer-events' property - 2 new tests added Revision Changes Path 1.1 xml-batik/samples/tests/spec/linking/pointerEvents.svg Index: pointerEvents.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 interactive test validates that the pointer-events property --> <!-- --> <!-- @author [EMAIL PROTECTED] --> <!-- @version $Id: pointerEvents.svg,v 1.1 2001/12/19 16:17:41 tkormann 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"> <title>Pointer Events Test</title> <g id="content"> <text class="title" x="50%" y="40">'pointer-events' Test <desc>Click in any of the links in the table. You should see a smilley.</desc></text> <defs> <g id="smilley"> <g transform="scale(.8, .8) translate(-15,-15)"> <circle cx="15" cy="15" r="10"/> <circle cx="12" cy="12" r="1.5" fill="black"/> <circle cx="17" cy="12" r="1.5" fill="black"/> <path d="M 10 19 A 8 8 0 0 0 20 19" stroke="black" stroke-width="1"/> </g> </g> <g id="success" fill="rgb(0,255,0)"> <use xlink:href="#smilley" /> </g> <g id="cell"> <rect x="20" y="60" width="120" height="20" style="fill:#eee; stroke:black"/> <rect x="20" y="80" width="120" height="100" style="fill:none; stroke:black"/> <g> <g> <rect x="90" y="90" width="40" height="20" style="fill:#aaa"/> </g> <g transform="translate(0 30)"> <rect x="90" y="90" width="40" height="20" style="fill:none; stroke:black; stroke-width:4"/> </g> <g transform="translate(0 60)"> <rect x="90" y="90" width="40" height="20" style="fill:#aaa; stroke:black; stroke-width:4"/> </g> </g> </g> </defs> <g transform="translate(5, 5) scale(.2)"> <use xlink:href="#success"/> <a xlink:href="#svgView(viewBox(0,0,450,500))"> <text y="-11" font-size="2" fill="blue" text-decoration="underline" text-anchor="middle">Return to test</text> </a> </g> <!-- ######################################### --> <g style="text-anchor:middle;"> <g transform="translate(0 0)"> <use xlink:href="#cell" /> <text x="80" y="74">visiblePainted</text> </g> <g transform="translate(140 0)"> <use xlink:href="#cell" /> <text x="80" y="74">visibleFill</text> </g> <g transform="translate(280 0)"> <use xlink:href="#cell" /> <text x="80" y="74">visibleStroke</text> </g> <g transform="translate(0 130)"> <use xlink:href="#cell" /> <text x="80" y="74">visible</text> </g> <g transform="translate(140 130)"> <use xlink:href="#cell" /> <text x="80" y="74">painted</text> </g> <g transform="translate(280 130)"> <use xlink:href="#cell" /> <text x="80" y="74">fill</text> </g> <g transform="translate(0 260)"> <use xlink:href="#cell" /> <text x="80" y="74">stroke</text> </g> <g transform="translate(140 260)"> <use xlink:href="#cell" /> <text x="80" y="74">all</text> </g> <g transform="translate(280 260)"> <use xlink:href="#cell" /> <text x="80" y="74">none</text> </g> <!-- ######################################### --> <g transform="translate(0 0)" style="pointer-events:visiblePainted"> <a xlink:href="#svgView(viewBox(3,2.5,4,4))"> <g style="fill:crimson"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> <g transform="translate(0 30)" style="fill:none; stroke:gold; stroke-width:4"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> <g transform="translate(0 60)" style="fill:crimson; stroke:gold; stroke-width:4"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> </a> </g> <g transform="translate(140 0)" style="pointer-events:visibleFill"> <a xlink:href="#svgView(viewBox(3,2.5,4,4))"> <g style="fill:crimson"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> <g transform="translate(0 30)" style="fill:none; stroke:gold; stroke-width:4"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> <g transform="translate(0 60)" style="fill:crimson; stroke:gold; stroke-width:4"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> </a> </g> <g transform="translate(280 0)" style="pointer-events:visibleStroke"> <a xlink:href="#svgView(viewBox(3,2.5,4,4))"> <g style="fill:crimson"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> <g transform="translate(0 30)" style="fill:none; stroke:gold; stroke-width:4"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> <g transform="translate(0 60)" style="fill:crimson; stroke:gold; stroke-width:4"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> </a> </g> <g transform="translate(0 130)" style="pointer-events:visible"> <a xlink:href="#svgView(viewBox(3,2.5,4,4))"> <g style="fill:crimson"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> <g transform="translate(0 30)" style="fill:none; stroke:gold; stroke-width:4"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> <g transform="translate(0 60)" style="fill:crimson; stroke:gold; stroke-width:4"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> </a> </g> <g transform="translate(140 130)" style="pointer-events:painted"> <a xlink:href="#svgView(viewBox(3,2.5,4,4))"> <g style="fill:crimson"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> <g transform="translate(0 30)" style="fill:none; stroke:gold; stroke-width:4"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> <g transform="translate(0 60)" style="fill:crimson; stroke:gold; stroke-width:4"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> </a> </g> <g transform="translate(280 130)" style="pointer-events:fill"> <a xlink:href="#svgView(viewBox(3,2.5,4,4))"> <g style="fill:crimson"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> <g transform="translate(0 30)" style="fill:none; stroke:gold; stroke-width:4"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> <g transform="translate(0 60)" style="fill:crimson; stroke:gold; stroke-width:4"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> </a> </g> <g transform="translate(0 260)" style="pointer-events:stroke"> <a xlink:href="#svgView(viewBox(3,2.5,4,4))"> <g style="fill:crimson"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> <g transform="translate(0 30)" style="fill:none; stroke:gold; stroke-width:4"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> <g transform="translate(0 60)" style="fill:crimson; stroke:gold; stroke-width:4"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> </a> </g> <g transform="translate(140 260)" style="pointer-events:all"> <a xlink:href="#svgView(viewBox(3,2.5,4,4))"> <g style="fill:crimson"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> <g transform="translate(0 30)" style="fill:none; stroke:gold; stroke-width:4"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> <g transform="translate(0 60)" style="fill:crimson; stroke:gold; stroke-width:4"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> </a> </g> <g transform="translate(280 260)" style="pointer-events:none"> <a xlink:href="#svgView(viewBox(3,2.5,4,4))"> <g style="fill:crimson"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> <g transform="translate(0 30)" style="fill:none; stroke:gold; stroke-width:4"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> <g transform="translate(0 60)" style="fill:crimson; stroke:gold; stroke-width:4"> <rect x="30" y="90" width="40" height="20" /> <rect x="90" y="90" width="40" height="20" style="visibility:hidden"/> </g> </a> </g> </g> </g><!-- "content" --> <!-- ============================================================= --> <!-- Batik sample mark --> <!-- ============================================================= --> <use xlink:href="../../../batikLogo.svg#Batik_Tag_Box" /> </svg> 1.1 xml-batik/samples/tests/spec/linking/pointerEvents2.svg Index: pointerEvents2.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 interactive test validates that the pointer-events property --> <!-- --> <!-- @author [EMAIL PROTECTED] --> <!-- @version $Id: pointerEvents2.svg,v 1.1 2001/12/19 16:17:41 tkormann 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"> <title>Pointer Events Test</title> <g id="content"> <text class="title" x="50%" y="40">'pointer-events' Test <desc>Click in any of the links in the table. You should see a smilley.</desc></text> <defs> <g id="smilley"> <g transform="scale(.8, .8) translate(-15,-15)"> <circle cx="15" cy="15" r="10"/> <circle cx="12" cy="12" r="1.5" fill="black"/> <circle cx="17" cy="12" r="1.5" fill="black"/> <path d="M 10 19 A 8 8 0 0 0 20 19" stroke="black" stroke-width="1"/> </g> </g> <g id="success" fill="rgb(0,255,0)"> <use xlink:href="#smilley" /> </g> <g id="cell"> <rect x="20" y="60" width="120" height="20" style="fill:#eee; stroke:black"/> <rect x="20" y="80" width="120" height="100" style="fill:none; stroke:black"/> <g style="fill:#aaa"> <rect x="35" y="90" width="35" height="14.5" /> <rect x="90" y="90" width="35" height="14.5" /> <rect x="25" y="120" width="50" height="28" /> <rect x="80" y="120" width="50" height="28" /> <rect x="35" y="158" width="30" height="16" /> <rect x="90" y="158" width="30" height="16" /> </g> </g> </defs> <g transform="translate(5, 5) scale(.2)"> <use xlink:href="#success"/> <a xlink:href="#svgView(viewBox(0,0,450,500))"> <text y="-11" font-size="2" fill="blue" text-decoration="underline" text-anchor="middle">Return to test</text> </a> </g> <!-- ######################################### --> <g style="text-anchor:middle;"> <g transform="translate(0 0)"> <use xlink:href="#cell" /> <text x="80" y="74">visiblePainted</text> </g> <g transform="translate(140 0)"> <use xlink:href="#cell" /> <text x="80" y="74">visibleFill</text> </g> <g transform="translate(280 0)"> <use xlink:href="#cell" /> <text x="80" y="74">visibleStroke</text> </g> <g transform="translate(0 130)"> <use xlink:href="#cell" /> <text x="80" y="74">visible</text> </g> <g transform="translate(140 130)"> <use xlink:href="#cell" /> <text x="80" y="74">painted</text> </g> <g transform="translate(280 130)"> <use xlink:href="#cell" /> <text x="80" y="74">fill</text> </g> <g transform="translate(0 260)"> <use xlink:href="#cell" /> <text x="80" y="74">stroke</text> </g> <g transform="translate(140 260)"> <use xlink:href="#cell" /> <text x="80" y="74">all</text> </g> <g transform="translate(280 260)"> <use xlink:href="#cell" /> <text x="80" y="74">none</text> </g> <!-- ######################################### --> <g transform="translate(0 0)" style="pointer-events:visiblePainted"> <a xlink:href="#svgView(viewBox(3,2.5,4,4))"> <image xlink:href="../../resources/images/tde.jpg" x="35" y="90" width="35" height="14.5" /> <image xlink:href="../../resources/images/tde.jpg" x="90" y="90" width="35" height="14.5" style="visibility:hidden"/> <image xlink:href="../../resources/images/svg.svg" x="25" y="120" width="50" height="28" /> <image xlink:href="../../resources/images/svg.svg" x="80" y="120" width="50" height="28" style="visibility:hidden"/> <text x="50" y="170">Batik</text> <text x="105" y="170" style="visibility:hidden">Batik</text> </a> </g> <g transform="translate(140 0)" style="pointer-events:visibleFill"> <a xlink:href="#svgView(viewBox(3,2.5,4,4))"> <image xlink:href="../../resources/images/tde.jpg" x="35" y="90" width="35" height="14.5" /> <image xlink:href="../../resources/images/tde.jpg" x="90" y="90" width="35" height="14.5" style="visibility:hidden"/> <image xlink:href="../../resources/images/svg.svg" x="25" y="120" width="50" height="28" /> <image xlink:href="../../resources/images/svg.svg" x="80" y="120" width="50" height="28" style="visibility:hidden"/> <text x="50" y="170">Batik</text> <text x="105" y="170" style="visibility:hidden">Batik</text> </a> </g> <g transform="translate(280 0)" style="pointer-events:visibleStroke"> <a xlink:href="#svgView(viewBox(3,2.5,4,4))"> <image xlink:href="../../resources/images/tde.jpg" x="35" y="90" width="35" height="14.5" /> <image xlink:href="../../resources/images/tde.jpg" x="90" y="90" width="35" height="14.5" style="visibility:hidden"/> <image xlink:href="../../resources/images/svg.svg" x="25" y="120" width="50" height="28" /> <image xlink:href="../../resources/images/svg.svg" x="80" y="120" width="50" height="28" style="visibility:hidden"/> <text x="50" y="170">Batik</text> <text x="105" y="170" style="visibility:hidden">Batik</text> </a> </g> <g transform="translate(0 130)" style="pointer-events:visible"> <a xlink:href="#svgView(viewBox(3,2.5,4,4))"> <image xlink:href="../../resources/images/tde.jpg" x="35" y="90" width="35" height="14.5" /> <image xlink:href="../../resources/images/tde.jpg" x="90" y="90" width="35" height="14.5" style="visibility:hidden"/> <image xlink:href="../../resources/images/svg.svg" x="25" y="120" width="50" height="28" /> <image xlink:href="../../resources/images/svg.svg" x="80" y="120" width="50" height="28" style="visibility:hidden"/> <text x="50" y="170">Batik</text> <text x="105" y="170" style="visibility:hidden">Batik</text> </a> </g> <g transform="translate(140 130)" style="pointer-events:painted"> <a xlink:href="#svgView(viewBox(3,2.5,4,4))"> <image xlink:href="../../resources/images/tde.jpg" x="35" y="90" width="35" height="14.5" /> <image xlink:href="../../resources/images/tde.jpg" x="90" y="90" width="35" height="14.5" style="visibility:hidden"/> <image xlink:href="../../resources/images/svg.svg" x="25" y="120" width="50" height="28" /> <image xlink:href="../../resources/images/svg.svg" x="80" y="120" width="50" height="28" style="visibility:hidden"/> <text x="50" y="170">Batik</text> <text x="105" y="170" style="visibility:hidden">Batik</text> </a> </g> <g transform="translate(280 130)" style="pointer-events:fill"> <a xlink:href="#svgView(viewBox(3,2.5,4,4))"> <image xlink:href="../../resources/images/tde.jpg" x="35" y="90" width="35" height="14.5" /> <image xlink:href="../../resources/images/tde.jpg" x="90" y="90" width="35" height="14.5" style="visibility:hidden"/> <image xlink:href="../../resources/images/svg.svg" x="25" y="120" width="50" height="28" /> <image xlink:href="../../resources/images/svg.svg" x="80" y="120" width="50" height="28" style="visibility:hidden"/> <text x="50" y="170">Batik</text> <text x="105" y="170" style="visibility:hidden">Batik</text> </a> </g> <g transform="translate(0 260)" style="pointer-events:stroke"> <a xlink:href="#svgView(viewBox(3,2.5,4,4))"> <image xlink:href="../../resources/images/tde.jpg" x="35" y="90" width="35" height="14.5" /> <image xlink:href="../../resources/images/tde.jpg" x="90" y="90" width="35" height="14.5" style="visibility:hidden"/> <image xlink:href="../../resources/images/svg.svg" x="25" y="120" width="50" height="28" /> <image xlink:href="../../resources/images/svg.svg" x="80" y="120" width="50" height="28" style="visibility:hidden"/> <text x="50" y="170">Batik</text> <text x="105" y="170" style="visibility:hidden">Batik</text> </a> </g> <g transform="translate(140 260)" style="pointer-events:all"> <a xlink:href="#svgView(viewBox(3,2.5,4,4))"> <image xlink:href="../../resources/images/tde.jpg" x="35" y="90" width="35" height="14.5" /> <image xlink:href="../../resources/images/tde.jpg" x="90" y="90" width="35" height="14.5" style="visibility:hidden"/> <image xlink:href="../../resources/images/svg.svg" x="25" y="120" width="50" height="28" /> <image xlink:href="../../resources/images/svg.svg" x="80" y="120" width="50" height="28" style="visibility:hidden"/> <text x="50" y="170">Batik</text> <text x="105" y="170" style="visibility:hidden">Batik</text> </a> </g> <g transform="translate(280 260)" style="pointer-events:none"> <a xlink:href="#svgView(viewBox(3,2.5,4,4))"> <image xlink:href="../../resources/images/tde.jpg" x="35" y="90" width="35" height="14.5" /> <image xlink:href="../../resources/images/tde.jpg" x="90" y="90" width="35" height="14.5" style="visibility:hidden"/> <image xlink:href="../../resources/images/svg.svg" x="25" y="120" width="50" height="28" /> <image xlink:href="../../resources/images/svg.svg" x="80" y="120" width="50" height="28" style="visibility:hidden"/> <text x="50" y="170">Batik</text> <text x="105" y="170" style="visibility:hidden">Batik</text> </a> </g> </g> </g><!-- "content" --> <!-- ============================================================= --> <!-- Batik sample mark --> <!-- ============================================================= --> <use xlink:href="../../../batikLogo.svg#Batik_Tag_Box" /> </svg> 1.6 +7 -5 xml-batik/sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java Index: AbstractGraphicsNodeBridge.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- AbstractGraphicsNodeBridge.java 2001/11/13 15:20:58 1.5 +++ AbstractGraphicsNodeBridge.java 2001/12/19 16:17:41 1.6 @@ -35,7 +35,7 @@ * </ul> * * @author <a href="mailto:[EMAIL PROTECTED]">Thierry Kormann</a> - * @version $Id: AbstractGraphicsNodeBridge.java,v 1.5 2001/11/13 15:20:58 tkormann Exp $ + * @version $Id: AbstractGraphicsNodeBridge.java,v 1.6 2001/12/19 16:17:41 tkormann Exp $ */ public abstract class AbstractGraphicsNodeBridge extends AbstractSVGBridge implements GraphicsNodeBridge, ErrorConstants { @@ -53,10 +53,10 @@ * @return a graphics node that represents the specified element */ public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) { - // 'requiredFeatures', 'requiredExtensions' and 'systemLanguage' - if (!SVGUtilities.matchUserAgent(e, ctx.getUserAgent())) { - return null; - } + // 'requiredFeatures', 'requiredExtensions' and 'systemLanguage' + if (!SVGUtilities.matchUserAgent(e, ctx.getUserAgent())) { + return null; + } GraphicsNode node = instantiateGraphicsNode(); // 'transform' @@ -95,6 +95,8 @@ node.setMask(CSSUtilities.convertMask(e, node, ctx)); // 'clip-path' node.setClip(CSSUtilities.convertClipPath(e, node, ctx)); + // 'pointer-events' + node.setPointerEventType(CSSUtilities.convertPointerEvents(e)); // bind the specified element and its associated graphics node if needed if (ctx.isDynamic()) { 1.35 +57 -3 xml-batik/sources/org/apache/batik/bridge/CSSUtilities.java Index: CSSUtilities.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/CSSUtilities.java,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- CSSUtilities.java 2001/10/19 08:05:18 1.34 +++ CSSUtilities.java 2001/12/19 16:17:41 1.35 @@ -64,9 +64,9 @@ * concrete objects regarding to CSS properties. * * @author <a href="mailto:[EMAIL PROTECTED]">Thierry Kormann</a> - * @version $Id: CSSUtilities.java,v 1.34 2001/10/19 08:05:18 tkormann Exp $ + * @version $Id: CSSUtilities.java,v 1.35 2001/12/19 16:17:41 tkormann Exp $ */ -public abstract class CSSUtilities +public abstract class CSSUtilities implements CSSConstants, ErrorConstants, XMLConstants { /** @@ -96,6 +96,60 @@ } ///////////////////////////////////////////////////////////////////////// + // 'pointer-events' + ///////////////////////////////////////////////////////////////////////// + + /** + * Returns the type that describes how this graphics node reacts to events. + * + * @return GraphicsNode.VISIBLE_PAINTED | + * GraphicsNode.VISIBLE_FILL | + * GraphicsNode.VISIBLE_STROKE | + * GraphicsNode.VISIBLE | + * GraphicsNode.PAINTED | + * GraphicsNode.FILL | + * GraphicsNode.STROKE | + * GraphicsNode.ALL | + * GraphicsNode.NONE + */ + public static int convertPointerEvents(Element e) { + CSSOMReadOnlyStyleDeclaration decl = getComputedStyle(e); + CSSPrimitiveValue v + = (CSSPrimitiveValue) decl.getPropertyCSSValueInternal + (CSS_POINTER_EVENTS_PROPERTY); + String s = v.getStringValue(); + switch(s.charAt(0)) { + case 'v': + if (s.length() == 7) { + return GraphicsNode.VISIBLE; + } else { + switch(s.charAt(7)) { + case 'p': + return GraphicsNode.VISIBLE_PAINTED; + case 'f': + return GraphicsNode.VISIBLE_FILL; + case 's': + return GraphicsNode.VISIBLE_STROKE; + default: + throw new Error(); // can't be reached + } + } + case 'p': + return GraphicsNode.PAINTED; + case 'f': + return GraphicsNode.FILL; + case 's': + return GraphicsNode.STROKE; + case 'a': + return GraphicsNode.ALL; + case 'n': + return GraphicsNode.NONE; + default: + throw new Error(); // can't be reached + } + } + + ///////////////////////////////////////////////////////////////////////// // 'enable-background' ///////////////////////////////////////////////////////////////////////// @@ -841,7 +895,7 @@ SVGOMDocument refDocument = (SVGOMDocument)refElement.getOwnerDocument(); AbstractViewCSS refView = (AbstractViewCSS)refDocument.getDefaultView(); - + HiddenChildElementSupport.setStyle(localRefElement, view, refElement, 1.33 +3 -1 xml-batik/sources/org/apache/batik/bridge/SVGImageElementBridge.java Index: SVGImageElementBridge.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGImageElementBridge.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- SVGImageElementBridge.java 2001/11/19 08:29:25 1.32 +++ SVGImageElementBridge.java 2001/12/19 16:17:41 1.33 @@ -51,7 +51,7 @@ * Bridge class for the <image> element. * * @author <a href="mailto:[EMAIL PROTECTED]">Thierry Kormann</a> - * @version $Id: SVGImageElementBridge.java,v 1.32 2001/11/19 08:29:25 tkormann Exp $ + * @version $Id: SVGImageElementBridge.java,v 1.33 2001/12/19 16:17:41 tkormann Exp $ */ public class SVGImageElementBridge extends AbstractGraphicsNodeBridge { @@ -163,6 +163,8 @@ node.setMask(CSSUtilities.convertMask(e, node, ctx)); // 'clip-path' node.setClip(CSSUtilities.convertClipPath(e, node, ctx)); + // 'pointer-events' + node.setPointerEventType(CSSUtilities.convertPointerEvents(e)); // bind the specified element and its associated graphics node if needed if (ctx.isDynamic()) { 1.43 +3 -1 xml-batik/sources/org/apache/batik/bridge/SVGTextElementBridge.java Index: SVGTextElementBridge.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGTextElementBridge.java,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- SVGTextElementBridge.java 2001/12/03 13:01:40 1.42 +++ SVGTextElementBridge.java 2001/12/19 16:17:41 1.43 @@ -56,7 +56,7 @@ * Bridge class for the <text> element. * * @author <a href="[EMAIL PROTECTED]>Bill Haneman</a> - * @version $Id: SVGTextElementBridge.java,v 1.42 2001/12/03 13:01:40 tkormann Exp $ + * @version $Id: SVGTextElementBridge.java,v 1.43 2001/12/19 16:17:41 tkormann Exp $ */ public class SVGTextElementBridge extends AbstractSVGBridge implements GraphicsNodeBridge, ErrorConstants { @@ -176,6 +176,8 @@ node.setMask(CSSUtilities.convertMask(e, node, ctx)); // 'clip-path' node.setClip(CSSUtilities.convertClipPath(e, node, ctx)); + // 'pointer-events' + node.setPointerEventType(CSSUtilities.convertPointerEvents(e)); // bind the specified element and its associated graphics node if needed if (ctx.isDynamic()) { 1.29 +47 -3 xml-batik/sources/org/apache/batik/gvt/AbstractGraphicsNode.java Index: AbstractGraphicsNode.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/AbstractGraphicsNode.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- AbstractGraphicsNode.java 2001/12/19 12:10:09 1.28 +++ AbstractGraphicsNode.java 2001/12/19 16:17:41 1.29 @@ -51,7 +51,7 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Thierry Kormann</a> * @author <a href="mailto:[EMAIL PROTECTED]">Emmanuel Tissandier</a> * @author <a href="mailto:[EMAIL PROTECTED]">Thomas DeWeese</a> - * @version $Id: AbstractGraphicsNode.java,v 1.28 2001/12/19 12:10:09 tkormann Exp $ + * @version $Id: AbstractGraphicsNode.java,v 1.29 2001/12/19 16:17:41 tkormann Exp $ */ public abstract class AbstractGraphicsNode implements GraphicsNode { @@ -114,8 +114,13 @@ protected Filter filter; /** - * .The GraphicsNodeRable for this node. + * Indicates how this graphics node reacts to events. */ + protected int pointerEventType = VISIBLE_PAINTED; + + /** + * The GraphicsNodeRable for this node. + */ protected WeakReference graphicsNodeRable; /** @@ -133,6 +138,26 @@ // /** + * Returns the type that describes how this graphics node reacts to events. + * + * @return VISIBLE_PAINTED | VISIBLE_FILL | VISIBLE_STROKE | VISIBLE | + * PAINTED | FILL | STROKE | ALL | NONE + */ + public int getPointerEventType() { + return pointerEventType; + } + + /** + * Sets the type that describes how this graphics node reacts to events. + * + * @param pointerEventType VISIBLE_PAINTED | VISIBLE_FILL | VISIBLE_STROKE | + * VISIBLE | PAINTED | FILL | STROKE | ALL | NONE + */ + public void setPointerEventType(int pointerEventType) { + this.pointerEventType = pointerEventType; + } + + /** * Sets the transform of this node. * * @param newTransform the new transform of this node @@ -892,7 +917,26 @@ * @param p the specified Point2D in the user space */ public boolean contains(Point2D p) { - return getBounds().contains(p); + Rectangle2D b = getBounds(); + if (b == null || !b.contains(p)) { + return false; + } + switch(pointerEventType) { + case VISIBLE_PAINTED: + case VISIBLE_FILL: + case VISIBLE_STROKE: + case VISIBLE: + return isVisible; + case PAINTED: + case FILL: + case STROKE: + case ALL: + return true; + case NONE: + return false; + default: + return false; + } } /** 1.10 +21 -5 xml-batik/sources/org/apache/batik/gvt/CompositeShapePainter.java Index: CompositeShapePainter.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/CompositeShapePainter.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- CompositeShapePainter.java 2001/09/18 21:18:59 1.9 +++ CompositeShapePainter.java 2001/12/19 16:17:41 1.10 @@ -20,7 +20,7 @@ * A shape painter which consists of multiple shape painters. * * @author <a href="mailto:[EMAIL PROTECTED]">Thierry Kormann</a> - * @version $Id: CompositeShapePainter.java,v 1.9 2001/09/18 21:18:59 deweese Exp $ + * @version $Id: CompositeShapePainter.java,v 1.10 2001/12/19 16:17:41 tkormann Exp $ */ public class CompositeShapePainter implements ShapePainter { @@ -29,7 +29,7 @@ */ protected Shape shape; - /** + /** * The enclosed <tt>ShapePainter</tt>s of this composite shape painter. */ protected ShapePainter [] painters; @@ -73,6 +73,22 @@ } /** + * Returns the shape painter at the specified index. + * + * @param index the index of the shape painter to return + */ + public ShapePainter getShapePainter(int index) { + return painters[index]; + } + + /** + * Returns the number of shape painter of this composite shape painter. + */ + public int getShapePainterCount() { + return count; + } + + /** * Paints the specified shape using the specified Graphics2D. * * @param g2d the Graphics2D to use @@ -91,11 +107,11 @@ public Shape getPaintedArea(){ // <!> FIX ME: Use of GeneralPath is a work around Area problems. if (painters != null) { - GeneralPath paintedArea = new GeneralPath(); + Area paintedArea = new Area(); for (int i=0; i < count; ++i) { Shape s = painters[i].getPaintedArea(); if (s != null) { - paintedArea.append(s, false); + paintedArea.add(new Area(s)); } } return paintedArea; @@ -103,7 +119,7 @@ return null; } } - + /** * Sets the Shape this shape painter is associated with. * 1.31 +70 -1 xml-batik/sources/org/apache/batik/gvt/GraphicsNode.java Index: GraphicsNode.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/GraphicsNode.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- GraphicsNode.java 2001/12/19 12:10:09 1.30 +++ GraphicsNode.java 2001/12/19 16:17:41 1.31 @@ -34,11 +34,64 @@ * * @author <a href="mailto:[EMAIL PROTECTED]">Thierry Kormann</a> * @author <a href="mailto:[EMAIL PROTECTED]">Emmanuel Tissandier</a> - * @version $Id: GraphicsNode.java,v 1.30 2001/12/19 12:10:09 tkormann Exp $ + * @version $Id: GraphicsNode.java,v 1.31 2001/12/19 16:17:41 tkormann Exp $ */ public interface GraphicsNode { /** + * Indicates that this graphics node can be the target for events when it + * is visible and when the mouse is over the "painted" area. + */ + public static final int VISIBLE_PAINTED = 0; + + /** + * Indicates that this graphics node can be the target for events when it + * is visible and when the mouse is over the filled area if any. + */ + public static final int VISIBLE_FILL = 1; + + /** + * Indicates that this graphics node can be the target for events when it + * is visible and when the mouse is over the stroked area if any. + */ + public static final int VISIBLE_STROKE = 2; + + /** + * Indicates that this graphics node can be the target for events when it + * is visible and whatever is the filled and stroked area. + */ + public static final int VISIBLE = 3; + + /** + * Indicates that this graphics node can be the target for events when the + * mouse is over the painted area whatever or not it is the visible. + */ + public static final int PAINTED = 4; + + /** + * Indicates that this graphics node can be the target for events when the + * mouse is over the filled area whatever or not it is the visible. + */ + public static final int FILL = 5; + + /** + * Indicates that this graphics node can be the target for events when the + * mouse is over the stroked area whatever or not it is the visible. + */ + public static final int STROKE = 6; + + /** + * Indicates that this graphics node can be the target for events if any + * cases. + */ + public static final int ALL = 7; + + /** + * Indicates that this graphics node can not be the target for events. + */ + public static final int NONE = 8; + + /** * The identity affine transform matrix used to draw renderable images. */ public static final AffineTransform IDENTITY = new AffineTransform(); @@ -46,6 +99,22 @@ // // Properties methods // + + /** + * Returns the type that describes how this graphics node reacts to events. + * + * @return VISIBLE_PAINTED | VISIBLE_FILL | VISIBLE_STROKE | VISIBLE | + * PAINTED | FILL | STROKE | ALL | NONE + */ + int getPointerEventType(); + + /** + * Sets the type that describes how this graphics node reacts to events. + * + * @param pointerEventType VISIBLE_PAINTED | VISIBLE_FILL | VISIBLE_STROKE | + * VISIBLE | PAINTED | FILL | STROKE | ALL | NONE + */ + void setPointerEventType(int pointerEventType); /** * Sets the transform of this node. 1.9 +36 -1 xml-batik/sources/org/apache/batik/gvt/ImageNode.java Index: ImageNode.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/ImageNode.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- ImageNode.java 2001/09/18 21:18:59 1.8 +++ ImageNode.java 2001/12/19 16:17:41 1.9 @@ -18,7 +18,7 @@ * A graphics node that represents an image described as a graphics node. * * @author <a href="mailto:[EMAIL PROTECTED]">Thierry Kormann</a> - * @version $Id: ImageNode.java,v 1.8 2001/09/18 21:18:59 deweese Exp $ + * @version $Id: ImageNode.java,v 1.9 2001/12/19 16:17:41 tkormann Exp $ */ public class ImageNode extends CompositeGraphicsNode { @@ -36,6 +36,41 @@ if (isVisible) { super.paint(g2d); } + } + + /** + * Returns true if the specified Point2D is inside the boundary of this + * node, false otherwise. + * + * @param p the specified Point2D in the user space + */ + public boolean contains(Point2D p) { + switch(pointerEventType) { + case VISIBLE_PAINTED: + case VISIBLE_FILL: + case VISIBLE_STROKE: + case VISIBLE: + return isVisible && super.contains(p); + case PAINTED: + case FILL: + case STROKE: + case ALL: + return super.contains(p); + case NONE: + return false; + default: + return false; + } + } + + /** + * Returns the GraphicsNode containing point p if this node or one of its + * children is sensitive to mouse events at p. + * + * @param p the specified Point2D in the user space + */ + public GraphicsNode nodeHitAt(Point2D p) { + return (contains(p) ? super.nodeHitAt(p) : null); } // 1.12 +91 -10 xml-batik/sources/org/apache/batik/gvt/ShapeNode.java Index: ShapeNode.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/ShapeNode.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- ShapeNode.java 2001/09/18 21:19:00 1.11 +++ ShapeNode.java 2001/12/19 16:17:41 1.12 @@ -20,7 +20,7 @@ * A graphics node that represents a shape. * * @author <a href="mailto:[EMAIL PROTECTED]">Thierry Kormann</a> - * @version $Id: ShapeNode.java,v 1.11 2001/09/18 21:19:00 deweese Exp $ + * @version $Id: ShapeNode.java,v 1.12 2001/12/19 16:17:41 tkormann Exp $ */ public class ShapeNode extends AbstractGraphicsNode { @@ -50,6 +50,11 @@ private Shape paintedArea; /** + * Internal Cache: The sensitive area. + */ + private Shape sensitiveArea; + + /** * Constructs a new empty <tt>ShapeNode</tt>. */ public ShapeNode() {} @@ -82,7 +87,7 @@ * Sets the <tt>ShapePainter</tt> used by this shape node to render its * shape. * - * @param newShapePainter the new ShapePainter to use + * @param newShapePainter the new ShapePainter to use */ public void setShapePainter(ShapePainter newShapePainter) { invalidateGeometryCache(); @@ -134,13 +139,14 @@ /** * Invalidates this <tt>ShapeNode</tt>. This node and all its ancestors have * been informed that all its cached values related to its bounds must be - * recomputed. + * recomputed. */ protected void invalidateGeometryCache() { super.invalidateGeometryCache(); primitiveBounds = null; geometryBounds = null; paintedArea = null; + sensitiveArea = null; } /** @@ -151,13 +157,38 @@ */ public boolean contains(Point2D p) { Rectangle2D b = getBounds(); - if (b != null) { - return (b.contains(p) && - paintedArea != null && - paintedArea.contains(p)); - } else { - return false; - } + if (b == null || !b.contains(p)) { + return false; + } + Shape s; + switch(pointerEventType) { + case VISIBLE_PAINTED: + case VISIBLE_FILL: + case VISIBLE_STROKE: + s = getSensitiveArea(); + if (s != null) { + return isVisible && s.contains(p); + } else { + return false; + } + case VISIBLE: + return isVisible; + case PAINTED: + case FILL: + case STROKE: + s = getSensitiveArea(); + if (s != null) { + return s.contains(p); + } else { + return false; + } + case ALL: + return true; + case NONE: + return false; + default: + return false; + } } /** @@ -195,6 +226,56 @@ } } return primitiveBounds; + } + + /** + * Returns the shape that represents the sensitive area of this graphics + * node. + */ + public Shape getSensitiveArea() { + if (sensitiveArea == null) { + // <!> NOT REALLY NICE CODE BUT NO OTHER WAY + ShapePainter strokeShapePainter = null; + ShapePainter fillShapePainter = null; + if (shapePainter instanceof StrokeShapePainter) { + strokeShapePainter = shapePainter; + } else if (shapePainter instanceof FillShapePainter) { + fillShapePainter = shapePainter; + } else { + CompositeShapePainter cp = (CompositeShapePainter)shapePainter; + for (int i=0; i < cp.getShapePainterCount(); ++i) { + ShapePainter sp = cp.getShapePainter(i); + if (sp instanceof StrokeShapePainter) { + strokeShapePainter = sp; + } else if (sp instanceof FillShapePainter) { + fillShapePainter = sp; + } + } + } + switch(pointerEventType) { + case VISIBLE_PAINTED: + case PAINTED: + sensitiveArea = shapePainter.getPaintedArea(); + break; + case VISIBLE_FILL: + case FILL: + if (fillShapePainter != null) { + sensitiveArea = fillShapePainter.getPaintedArea(); + } + break; + case VISIBLE_STROKE: + case STROKE: + if (strokeShapePainter != null) { + sensitiveArea = strokeShapePainter.getPaintedArea(); + } + break; + case ALL: + case NONE: + default: + // nothing to tdo + } + } + return sensitiveArea; } /** 1.22 +34 -49 xml-batik/sources/org/apache/batik/gvt/TextNode.java Index: TextNode.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/TextNode.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- TextNode.java 2001/11/05 20:04:11 1.21 +++ TextNode.java 2001/12/19 16:17:41 1.22 @@ -35,7 +35,7 @@ * A graphics node that represents text. * * @author <a href="mailto:[EMAIL PROTECTED]">Thierry Kormann</a> - * @version $Id: TextNode.java,v 1.21 2001/11/05 20:04:11 deweese Exp $ + * @version $Id: TextNode.java,v 1.22 2001/12/19 16:17:41 tkormann Exp $ */ public class TextNode extends AbstractGraphicsNode implements Selectable { @@ -102,21 +102,21 @@ * null, this text node will use its default text painter * (StrokingTextPainter.getInstance()). * - * @param textPainter the text painter to use + * @param textPainter the text painter to use */ public void setTextPainter(TextPainter textPainter) { - if (textPainter == null) { - this.textPainter = StrokingTextPainter.getInstance(); - } else { - this.textPainter = textPainter; - } + if (textPainter == null) { + this.textPainter = StrokingTextPainter.getInstance(); + } else { + this.textPainter = textPainter; + } } /** * Returns the text painter of this text node. */ public TextPainter getTextPainter() { - return textPainter; + return textPainter; } /** @@ -141,9 +141,9 @@ public String getText() { if (text == null) { StringBuffer buf = new StringBuffer(aci.getEndIndex()); - for (char c = aci.first(); - c != CharacterIterator.DONE; - c = aci.next()) { + for (char c = aci.first(); + c != CharacterIterator.DONE; + c = aci.next()) { buf.append(c); } text = buf.toString(); @@ -199,13 +199,13 @@ /** * Invalidates this <tt>TextNode</tt>. This node and all its ancestors have * been informed that all its cached values related to its bounds must be - * recomputed. + * recomputed. */ protected void invalidateGeometryCache() { super.invalidateGeometryCache(); primitiveBounds = null; geometryBounds = null; - outline = null; + outline = null; } /** @@ -230,34 +230,19 @@ if (aci != null) { geometryBounds = textPainter.getBounds(this); } - } + } return geometryBounds; } /** - * Returns true if the specified Point2D is inside the boundary of this - * node, false otherwise. - * - * @param p the specified Point2D in the user space - */ - public boolean contains(Point2D p) { - Rectangle2D b = getBounds(); - if (b != null) { - return b.contains(p.getX(), p.getY()); - } else { - return false; - } - } - - /** * Returns the outline of this node. */ public Shape getOutline() { - if (outline == null) { - if (aci != null) { - outline = textPainter.getDecoratedShape(this); - } - } + if (outline == null) { + if (aci != null) { + outline = textPainter.getDecoratedShape(this); + } + } return outline; } @@ -339,7 +324,7 @@ ranges[0] = temp; } o = new AttributedCharacterSpanIterator - (aci, ranges[0], ranges[1]+1); + (aci, ranges[0], ranges[1]+1); } return o; } @@ -350,8 +335,8 @@ * @return a Shape which encloses the current text selection. */ public Shape getHighlightShape() { - Shape highlightShape = - textPainter.getHighlightShape(beginMark, endMark); + Shape highlightShape = + textPainter.getHighlightShape(beginMark, endMark); AffineTransform t = getGlobalTransform(); highlightShape = t.createTransformedShape(highlightShape); return highlightShape; @@ -415,32 +400,32 @@ /** * The anchor which enables the rendered characters to be aligned such * that the start of the text string is at the initial current text - * location. - */ + * location. + */ public static final Anchor START = new Anchor(ANCHOR_START); /** * The anchor which enables the rendered characters to be aligned such * that the middle of the text string is at the initial current text - * location. - */ + * location. + */ public static final Anchor MIDDLE = new Anchor(ANCHOR_MIDDLE); /** * The anchor which enables the rendered characters to be aligned such * that the end of the text string is at the initial current text - * location. - */ + * location. + */ public static final Anchor END = new Anchor(ANCHOR_END); - /** - * The anchor type. - */ + /** + * The anchor type. + */ private int type; - /** - * No instance of this class. - */ + /** + * No instance of this class. + */ private Anchor(int type) { this.type = type; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]