diff options
author | Walter Bender <walter@walter-laptop.(none)> | 2009-05-27 01:48:54 (GMT) |
---|---|---|
committer | Walter Bender <walter@walter-laptop.(none)> | 2009-05-27 01:48:54 (GMT) |
commit | 85c80742d44d3175e327bdb4852027c2ecd33e31 (patch) | |
tree | f12c448ba655a2d6f1f717e08f6ba7050e2b0f40 | |
parent | ad6d464d95b79c3a244d48c23d7e4c9b43e9369b (diff) |
fixed? xml coordinate problem
-rw-r--r-- | html/xo-color.xml | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/html/xo-color.xml b/html/xo-color.xml index 7cab5ef..f7d118e 100644 --- a/html/xo-color.xml +++ b/html/xo-color.xml @@ -17,18 +17,19 @@ Author: Walter Bender (walter@laptop.org) // SVG version of OLPC XO man color changer and shape shifter // Created by: Walter Bender (walter@laptop.org) on 27 January 2007 -// Last modified by: Walter Bender (walter@laptop.org) on 28 June 2007 +// Last modified by: Walter Bender (walter@laptop.org) on 26 May 2009 // Color tool designed in memory of: Nat Jacobson // ajax hooks: Erik Blankinship (erikb@mediamods.com) on 15 August 2007 <script type="text/javascript"> <![CDATA[ + var screenW = 1200, screenH = 900; + var fillcolors = [ // red, orange, yellow, green, blue, purple "rgb(255,43,52)", "rgb(255,143,0)", "rgb(248,232,0)", "rgb(0,234,17)", "rgb(0,160,255)", "rgb(172,50,255)" ]; - var strokecolors = [ // M A+ C- C C+ A- // dark fill @@ -615,13 +616,8 @@ function background(evt,a) { if( a == 0 ) { e.setAttribute("visibility","visible"); - } else { - e.setAttribute("visibility","hidden"); - } - e = evt.target.ownerDocument.getElementById("backgroundW"); - if( a == 0 ) - { - e.setAttribute("visibility","visible"); + e = evt.target.ownerDocument.getElementById("backgroundXO"); + e.setAttribute("fill","rgb(255,255,255)"); } else { e.setAttribute("visibility","hidden"); } @@ -629,6 +625,8 @@ function background(evt,a) { if( a == 1 ) { e.setAttribute("visibility","visible"); + e = evt.target.ownerDocument.getElementById("backgroundXO"); + e.setAttribute("fill","rgb(231,231,233)"); } else { e.setAttribute("visibility","hidden"); } @@ -636,6 +634,8 @@ function background(evt,a) { if( a == 2 ) { e.setAttribute("visibility","visible"); + e = evt.target.ownerDocument.getElementById("backgroundXO"); + e.setAttribute("fill","rgb(76,77,79)"); } else { e.setAttribute("visibility","hidden"); } @@ -643,6 +643,8 @@ function background(evt,a) { if( a == 3 ) { e.setAttribute("visibility","visible"); + e = evt.target.ownerDocument.getElementById("backgroundXO"); + e.setAttribute("fill","rgb(0,0,0)"); } else { e.setAttribute("visibility","hidden"); } @@ -722,10 +724,20 @@ var x,y; if( moveOn == 1 ) { //bug, see: http://dev.laptop.org/ticket/1657 + //need to test on an XO, but the following code seems to do the correct thing in jhbuild + x = evt.clientX; -// x = x * 1.43; + if( screen.width < 1200 ) + { + x *= 1200; + x /= screen.width; + } y = evt.clientY; -// y = y * 1.43; + if( screen.height < 900 ) + { + y *= 900; + y /= screen.height; + } if( x < (xoCenterX-80) ) { x = xoCenterX-80; } if( x > (xoCenterX+80) ) { x = xoCenterX+80; } @@ -825,17 +837,7 @@ xoL2K2Y=xoL2K2YReset; xoCX=xoCXReset; xoCY=xoCYReset; - e = evt.target.ownerDocument.getElementById("Circle"); - e.setAttribute("cx",xoCX); - e.setAttribute("cy",xoCY); - e = evt.target.ownerDocument.getElementById("Line1"); - e.setAttribute("d", "M"+xoL1X1+","+xoL1Y1+" C"+xoL1K1X+","+xoL1K1Y+" "+xoL1K2X+","+xoL1K2Y+" "+xoL1X2+","+xoL1Y2); - e = evt.target.ownerDocument.getElementById("Fill1"); - e.setAttribute("d", "M"+xoL1X1+","+xoL1Y1+" C"+xoL1K1X+","+xoL1K1Y+" "+xoL1K2X+","+xoL1K2Y+" "+xoL1X2+","+xoL1Y2); - e = evt.target.ownerDocument.getElementById("Line2"); - e.setAttribute("d", "M"+xoL2X1+","+xoL2Y1+" C"+xoL2K1X+","+xoL2K1Y+" "+xoL2K2X+","+xoL2K2Y+" "+xoL2X2+","+xoL2Y2); - e = evt.target.ownerDocument.getElementById("Fill2"); - e.setAttribute("d", "M"+xoL2X1+","+xoL2Y1+" C"+xoL2K1X+","+xoL2K1Y+" "+xoL2K2X+","+xoL2K2Y+" "+xoL2X2+","+xoL2Y2); +stopmove(evt); } ]]> @@ -857,6 +859,10 @@ xoCY=xoCYReset; // start XO group <g onmouseover="showpoints(evt)" onmouseout="hidepoints(evt)" onmousedown="startmove(evt)" onmouseup="stopmove(evt)" onmousemove="move(evt)" onkeyup="textProcess(evt)"> + +// XO-man background +<rect id="backgroundXO" width="240" height="260" x="480" y="250" fill="rgb(0,0,0)" stroke="none" visibility="visible" /> + <g id="upXo"> // begin XO man <path id="Line1" d="M645.5,357 C600,400.5 600,400.5 554.5,448" stroke="rgb(216,75,24)" stroke-width="37" stroke-linecap="round" fill="none" visibility="visible" /> <path id="Line2" d="M645.5,448 C600,400.5 600,400.5 554.5,357" stroke="rgb(216,75,24)" stroke-width="37" stroke-linecap="round" fill="none" visibility="visible" /> |