problem with "onmouseup" [Archive] - XML Elves

problem with "onmouseup"

kelum
08-03-2004, 06:17 AM
hi,
i used following code to zoom a map when user select a rectangle area using mouse.but my program does not detect the "onmouseup" event.i use adobe svg viewer 3.0.
if you can pls help me.

regards,
kelum


<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/SVG/DTD/svg10.dtd">
<svg id="root" width="720" height="593" viewBox="-2690 -100 5375 4421"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" >
<defs>
<style type="text/css">
<![CDATA[
.str7 {stroke:#1F1A17;stroke-width:3}
.str4 {stroke:#0093DD;stroke-width:3}
.str5 {stroke:#0093DD;stroke-width:4}
.str3 {stroke:#0093DD;stroke-width:5}
.str2 {stroke:#0093DD;stroke-width:6}
.str1 {stroke:#0093DD;stroke-width:8}
.str6 {stroke:#BB90BB;stroke-width:14}
.str0 {stroke:#DA251D;stroke-width:21}
.fil0 {fill:none}
.fil2 {fill:#1F1A17}
.fil1 {fill:#C4E5FA}
.fil3 {fill:#FFFFFF}
.fnt1 {font-weight:normal;font-size:125;font-family:'Arial';text-rendering:optimizeLegibility;}
.fnt0 {font-weight:normal;font-size:139;font-family:'Arial';text-decoration:underline;text-rendering:optimizeLegibility;}
]]>
</style>

<script type="text/ecmascript" ><![CDATA[
var zoom_rect = false, click_rect = false, node_rect = "", xsvg = 0, ysvg = 0, xsvg2 = 0, ysvg2 = 0;
function down_rect(evt)
{
if (zoom_rect == false) {
click_rect = true
node_rect = evt.target.ownerDocument.getElementById("zone")
xsvg = Math.round( -2690 + evt.clientX * 5375 / 720) ;
ysvg = Math.round( -100 + evt.clientY * 4421 / 593)
node_rect.setAttributeNS( null , "x" , xsvg.toString()) ;
node_rect.setAttributeNS( null , "y" , ysvg.toString())
node_rect.setAttributeNS( null , "visibility" , "visible")
}else {
node_root = evt.target.ownerDocument.getElementById("root")
node_root.setAttributeNS( null , "viewBox" , "-2690 -100 5375 4421")
zoom_rect = false ;
click_rect = false
}
}
function move_rect(evt) {
if (click_rect==true) {
xsvg2 = Math.round( -2690 + evt.clientX * 5375 / 720) ;
ysvg2 = Math.round( -100 + evt.clientY * 4421 / 593)
node_rect.setAttributeNS( null , "x" , Math.min( xsvg , xsvg2 ).toString())
node_rect.setAttributeNS( null , "y" , Math.min( ysvg , ysvg2 ).toString())
node_rect.setAttributeNS( null , "width" , Math.abs( xsvg - xsvg2 ).toString())
node_rect.setAttributeNS( null , "height" , Math.abs( ysvg - ysvg2 ).toString())
}
}
function up_rect(evt) {
if (click_rect==true) {
node_root = evt.target.ownerDocument.getElementById("root");
node_root.setAttributeNS(null , "viewBox" , Math.min(xsvg,xsvg2).toString() + " " + Math.min(ysvg,ysvg2).toString()+ " " + Math.abs(xsvg2-xsvg).toString() + " " + Math.abs(ysvg2-ysvg).toString());
node_rect.setAttributeNS( null , "visibility" , "hidden" );
zoom_rect = true ; click_rect = false;
}
}



]]></script>

</defs>
<g id="map" onmousedown="down_rect(evt);" onmousemove="move_rect(evt);" onmouseup="up_rect(evt);">
<rect x="-2690" y="-100" width="5375" height="4421" fill='white'/>

<g id="staatsgr">
<path class="fil0 str0" d="M2196 757c-18,-18 -50,-33 -57,-56 -7,-19 -15,-65 -25,-77 -22,-9 -24,-16 -24,-39 -17,-24 -53,-33 -30,-65l0 -50c14,-25 29,-48 47,-70 4,-39 -15,-75 -17,-114 -4,-86 -48,-25 -94,-49 -21,-11 -23,-17 -48,-7 -4,-24 0,-43 -30,-43 -38,0 -39,-27 -78,-14 -35,-8 -32,12 -40,38 -9,9 -15,16 -23,26 -47,0 -96,-9 -146,-9 -52,0 -101,-24 -123,-73 -33,-3 -41,-32 -71,-31 -28,1 -25,25 -59,16 -22,-6 -34,-25 -58,-32 -36,-9 -48,-7 -71,-41 -15,-4 -36,-3 -49,-12 -17,-13 -12,-27 -41,-14 -42,-4 -17,-21 -40,21 -28,-7 -38,13 -59,7 15,-50 -15,-42 -47,-42 -30,-29 -46,-18 -56,17 -8,31 14,53 5,84 -6,26 -12,57 -15,85 42,32 -30,18 -45,12 -63,-23 -25,31 -56,52 -46,32 -30,41 -33,89 -2,46 -34,11 -57,7l-5 -16c-38,23 -55,15 -86,-16 -25,16 6,33 -31,51 -18,8 -29,19 -49,27 -38,-21 -71,-29 -114,-29 -40,0 -43,-17 -66,-43 38,-26 8,-33 -14,-60 -35,-6 -44,-25 -68,-48 -63,-13 -27,96 -35,132"/>
<path class="fil0 str0" d="M288 371c-8,26 -3,44 -34,50 -17,81 -55,4 -98,-3 -20,-4 -26,-13 -45,-19 -29,34 -40,8 -35,57 3,28 -16,37 -12,66 7,47 -31,82 -64,111 -39,34 -58,12 -96,26 -35,14 -64,9 -90,42 -26,32 -35,29 -73,33 -4,5 -9,9 -12,14 -12,19 -38,51 -59,55 -20,61 47,62 59,112 8,30 26,38 50,59 18,60 52,61 0,121 -10,13 -8,13 -3,28 -34,45 -5,52 36,37 39,-15 45,47 54,69 -16,43 -44,69 -28,118 -40,65 -91,-14 -132,-36 -58,-33 12,-52 -20,-78 -5,-4 -10,-7 -14,-11 10,-45 -91,-38 -105,-12 -14,27 -2,21 -31,23 -59,2 -39,-64 -83,-53 -20,6 -17,2 -33,-3 -27,-7 -39,21 -58,-5 24,-60 -5,-15 -31,-5 -35,13 7,39 9,67 2,37 -111,-2 -137,4 -32,6 -54,3 -79,28 -25,3 -53,-5 -81,-2 -30,3 -58,-16 -70,28 -5,19 2,31 -24,36 -40,9 -88,-20 -94,37 34,25 -15,13 -29,17 -37,10 -26,44 -68,40 5,-43 -5,-30 -44,-21"/>
<path class="fil0 str0" d="M-1286 1401c-11,6 -17,11 -27,19 -6,0 -12,0 -18,0 -24,1 -44,3 -68,-7 13,-20 8,-25 -6,-41 -12,-14 -13,-12 -13,-30l-34 0 0 -16c21,-8 26,-14 7,-31 -6,1 -12,0 -18,2 -11,3 -20,11 -33,12 -5,1 -10,-1 -15,-2 -16,-15 -22,-15 -42,-22l-12 -14c-18,0 -33,-4 -51,-4 -12,20 -15,24 -40,21 -23,-2 -26,-4 -41,-22 16,-14 17,-11 0,-21 -17,11 -7,7 -6,24 2,13 -4,21 -7,33 -5,27 18,36 18,63 0,18 -8,15 -18,26 -7,7 -11,20 -15,29 -5,3 -10,5 -14,9 -16,14 -27,38 -40,55 -6,2 -12,2 -17,4 -6,2 -9,7 -14,10 -9,6 -20,10 -30,14 -16,-5 -16,-5 -33,0"/>
<path class="fil0 str0" d="M1609 1905l33 -4c27,-26 67,-48 80,-85 14,-7 42,-22 48,-38 6,-16 -3,-42 25,-21 23,-14 54,-5 81,-5 58,0 6,-18 -5,-33 20,-15 56,-13 23,-31 -42,-22 56,-67 3,-70 -23,-1 -27,10 -21,-22 -41,-18 -19,-13 -17,-44 1,-29 3,-19 26,-36 0,-19 0,-34 -10,-51 -3,-4 -9,-7 -11,-12 -8,-18 4,-27 -3,-48 7,-20 17,-18 29,-2 19,-17 11,-8 31,-11 9,-1 60,-41 63,-50 3,-9 -2,-24 -3,-33 31,-22 42,-36 3,-57 2,-25 -3,-47 -28,-54 -25,11 -23,10 -45,-4 -15,-9 -93,-11 -64,-36 2,-19 -1,-17 15,-9 15,-15 22,-19 42,-26 -4,-36 24,-49 56,-35 19,9 29,8 48,14 9,42 26,63 68,37 6,-21 11,-38 23,-7 18,10 107,-10 125,-23 -14,-22 -11,-39 -21,-62 17,-39 -23,-40 -23,-72 66,-6 38,-42 49,-85 -16,-24 56,-40 7,-55 -9,-3 -21,1 -30,3 -2,-21 -9,-43 6,-57l-16 -24"/>
<path class="fil0 str0" d="M-1873 1512c4,-21 1,-19 19,-29 -3,-34 7,-34 19,-63 -25,-25 -40,6 -66,4 -28,15 -20,-15 -29,-39 41,-15 -3,-41 -11,-59 -32,-10 -29,-7 -46,-38 -14,-24 -14,-6 -37,-16 -25,-10 -16,10 -38,-6 -22,-16 -5,-16 -12,-42 -40,-18 -41,17 -51,45 -33,10 -68,14 -101,24 7,33 18,32 46,47 0,31 0,34 10,63 -25,19 -32,10 -49,41 -14,27 -48,37 -24,70 -3,26 12,30 5,63 11,14 22,23 32,38 -3,28 13,41 -16,59 19,30 33,1 59,15 20,12 19,15 45,18 26,22 29,14 58,22 8,40 -26,62 24,86 33,15 46,12 71,41 30,35 59,27 99,12 30,-11 -14,-74 54,-47 20,-28 15,-67 63,-62 12,17 10,28 29,38 59,30 -43,84 43,94 24,3 18,9 40,-5 32,-20 51,-14 72,14 59,23 -28,60 41,45 19,18 38,11 61,26 28,-12 38,-10 66,0 20,-9 27,-30 47,-45 3,-32 9,-69 28,-96 23,0 26,-3 31,-26 25,-8 57,-12 84,-19 25,-7 24,-7 45,10 39,34 43,-51 81,-20 38,30 36,-19 72,-2 27,13 34,4 57,29 23,0 20,-13 42,-15 36,-4 55,-33 92,-40 24,-5 61,-11 76,-26l18 -4"/>
<path class="fil0 str0" d="M-724 1717c35,-12 49,-23 78,5 -24,15 -9,42 -45,42 -55,0 1,63 -7,91 28,23 23,37 59,26 42,42 7,50 21,90 55,12 30,11 48,52 12,26 110,66 134,64 33,-1 57,-9 82,19 41,-31 52,26 81,26 31,0 53,2 84,6 49,5 101,1 139,40 25,-9 40,5 66,-9 23,-12 25,-18 45,5 17,2 35,-4 50,0 22,6 43,19 63,11 46,20 94,36 146,26 43,-10 58,5 93,27 37,-8 68,-13 82,30 24,18 65,4 96,9 27,4 40,2 66,-9 37,18 28,28 74,19 16,24 33,69 33,9 0,-30 68,-24 77,-70 23,-11 39,-8 62,-15 6,-30 16,-101 56,-87 18,-23 27,-28 47,-2 15,-45 40,-41 82,-45 32,-3 51,19 83,10 42,-11 94,-30 120,18 28,0 36,-3 54,-26 -12,-53 45,-14 59,-54 30,0 50,15 80,-4 5,-3 10,-8 15,-10 34,-15 101,22 122,42 25,23 22,-24 9,-39 -36,-38 -21,-44 -26,-92"/>
<path class="fil0 str0" d="M1604 1922l5 -17"/>
</g>


<g id="signaturen" visibility="visible">
<g >
<circle class="fil2 str7" cx="-160" cy="1078" r="39"/>
<circle class="fil3 str7" cx="-160" cy="1078" r="28"/>
</g>
<g >
<circle class="fil2 str7" cx="592" cy="639" r="39"/>
<circle class="fil3 str7" cx="592" cy="639" r="28"/>
</g>
<g >
<circle class="fil2 str7" cx="1326" cy="653" r="39"/>
<circle class="fil3 str7" cx="1326" cy="653" r="28"/>
</g>
<g >
<circle class="fil2 str7" cx="1868" cy="1033" r="39"/>
<circle class="fil3 str7" cx="1868" cy="1033" r="28"/>
</g>
<g >
<circle class="fil2 str7" cx="603" cy="2108" r="39"/>
<circle class="fil3 str7" cx="603" cy="2108" r="28"/>
</g>
<g >
<circle class="fil2 str7" cx="1272" cy="1719" r="39"/>
<circle class="fil3 str7" cx="1272" cy="1719" r="28"/>
</g>
<g >
<circle class="fil2 str7" cx="-1142" cy="1537" r="45"/>
<circle class="fil3 str7" cx="-1142" cy="1537" r="32"/>
</g>
<g >
<circle class="fil2 str7" cx="-2110" cy="1315" r="45"/>
<circle class="fil3 str7" cx="-2110" cy="1315" r="32"/>
</g>
<g >
<circle class="fil2 str7" cx="1797" cy="689" r="59"/>
<circle class="fil3 str7" cx="1797" cy="689" r="41"/>
</g>
</g>


</g>
<rect id="zone" fill="none" stroke="red" stroke-width="5" visibility="hidden"/>

</svg>

Anonymous
08-03-2004, 09:14 AM
Rectangle that you draw is not in group with mouseup event!

Change end of your svg code :

<rect id="zone" fill="none" stroke="red" stroke-width="5" visibility="hidden"/>
</g>


Michel

 
Web mp2kmag.com
mapforums.com

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum