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/06/28 17:02:02 UTC
cvs commit: xml-batik/sources/org/apache/batik/gvt/text ConcreteTextSelector.java
vhardy 2002/06/28 08:02:02
Modified: sources/org/apache/batik/gvt/event AWTEventDispatcher.java
sources/org/apache/batik/gvt/text ConcreteTextSelector.java
Added: samples/tests/spec/scripting modalEventTest.svg
Log:
Fixed problem with modal events. See new modalEventTest.svg in scripting directory. Text selection is as it was before.
Revision Changes Path
1.1 xml-batik/samples/tests/spec/scripting/modalEventTest.svg
Index: modalEventTest.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. -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!-- Simple test to validate that events are properly dispatched. This -->
<!-- test shows a problem we had due to isModalEvent. -->
<!-- For example: mousedown on red circle, move out of circle, mouseup. -->
<!-- This sequence should not trigger the circle's mouseup handler. -->
<!-- -->
<!-- @author vincent.hardy@sun.com -->
<!-- @version $Id: modalEventTest.svg,v 1.1 2002/06/28 15:02:02 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">
<title>Remove/Insert event handler test</title>
<text x="50%" y="45" class="title">remove/insert event handler test</text>
<script type="text/ecmascript"><![CDATA[
var svgNamespaceURI = "http://www.w3.org/2000/svg";
function onMouseDown(id) {
// First, turn mouse control green
var ctrl = document.getElementById("mouseDownCtrl");
ctrl.setAttribute("fill", "rgb(0,255,0)");
}
function onMouseUp(id) {
// First, turn mouse control green
var ctrl = document.getElementById("mouseUpCtrl");
ctrl.setAttribute("fill", "rgb(0,255,0)");
}
function clear() {
var ctrl = document.getElementById("mouseDownCtrl");
ctrl.setAttribute("fill", "gray");
ctrl = document.getElementById("mouseUpCtrl");
ctrl.setAttribute("fill", "gray");
}
]]></script>
<defs>
<rect id="button" x="-30" y="-15" width="60" height="20" />
</defs>
<style type="text/css"><![CDATA[
use.button {
fill: #eeeeee;
stroke: black;
}
text.button {
fill: black;
stroke: none;
text-anchor: middle;
}
]]></style>
<g id="originalGroup" transform="translate(225,250)">
<g id="target" onmousedown="onMouseDown('target')" onmouseup="onMouseUp(evt)" >
<circle cx="0" cy="0" r="30" fill="crimson" />
</g>
</g>
<g id="insertionPointGroup" transform="translate(225,250) scale(2)">
</g>
<g transform="translate(150, 350)">
<circle id="mouseDownCtrl" r="10" stroke="black" fill="gray" />
<text class="legend" y="20">mousedown</text>
</g>
<g transform="translate(300, 350)">
<circle id="mouseUpCtrl" r="10" stroke="black" fill="gray" />
<text class="legend" y="20" >mouseup</text>
</g>
<g transform="translate(225,450)">
<a onclick="clear()">
<use class="button" xlink:href="#button" />
<text class="button">Clear</text>
</a>
</g>
</svg>
1.10 +3 -24 xml-batik/sources/org/apache/batik/gvt/event/AWTEventDispatcher.java
Index: AWTEventDispatcher.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/event/AWTEventDispatcher.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- AWTEventDispatcher.java 19 Jun 2002 08:15:26 -0000 1.9
+++ AWTEventDispatcher.java 28 Jun 2002 15:02:02 -0000 1.10
@@ -343,14 +343,6 @@
}
GraphicsNode node = root.nodeHitAt(p);
- GraphicsNode relatedNode = null;
-
- if (isModalEvent(evt, node) && (lastHit != null)) {
- // modal if either button release on null node, or
- // if button is down on a non-press
- relatedNode = node;
- node = lastHit;
- }
// If the receiving node has changed, send a notification
// check if we enter a new node
@@ -403,7 +395,7 @@
screenPos.x,
screenPos.y,
evt.getClickCount(),
- relatedNode);
+ null);
// node.processMouseEvent(gvtevt);
processMouseEvent(gvtevt);
@@ -420,24 +412,11 @@
screenPos.x,
screenPos.y,
evt.getClickCount(),
- relatedNode);
+ null);
processMouseEvent(gvtevt);
}
lastHit = node;
- }
-
- /**
- * Returns true if the specified event is considered as 'modal'
- * for the specified graphics node, false otherwise.
- * @param evt the event to check
- * @param node the targetted graphics node
- */
- protected boolean isModalEvent(MouseEvent evt, GraphicsNode node) {
- int type = evt.getID();
- return ((type == MouseEvent.MOUSE_RELEASED) ||
- ((type != MouseEvent.MOUSE_PRESSED) &&
- ((evt.getModifiers() & InputEvent.BUTTON1_MASK) != 0)));
}
/**
1.12 +2 -4 xml-batik/sources/org/apache/batik/gvt/text/ConcreteTextSelector.java
Index: ConcreteTextSelector.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/text/ConcreteTextSelector.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ConcreteTextSelector.java 3 Apr 2002 04:58:21 -0000 1.11
+++ ConcreteTextSelector.java 28 Jun 2002 15:02:02 -0000 1.12
@@ -255,9 +255,7 @@
}
private boolean isSelectStartGesture(GraphicsNodeEvent evt) {
- return ((evt.getID() == GraphicsNodeMouseEvent.MOUSE_PRESSED)
- || ( isMouseButton1Down(evt) &&
- (evt.getID() == GraphicsNodeMouseEvent.MOUSE_ENTERED) ));
+ return (evt.getID() == GraphicsNodeMouseEvent.MOUSE_PRESSED);
}
private boolean isSelectEndGesture(GraphicsNodeEvent evt) {
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org