changeset 847:dfe28355bded

Fix the location of the text elements.
author wycc
date Sun, 19 Sep 2010 19:28:33 +0800
parents f348a41e1aae
children 702e4874a58a 33fd5fdc8b48
files nodejs/desktop.svg nodejs/svg.js nodejs/testdesktop.js
diffstat 3 files changed, 365 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- a/nodejs/desktop.svg	Sun Sep 19 11:38:17 2010 +0800
+++ b/nodejs/desktop.svg	Sun Sep 19 19:28:33 2010 +0800
@@ -53,6 +53,97 @@
        inkscape:vp_y="0 : 1000 : 0"
        inkscape:vp_x="0 : 0.5 : 1"
        sodipodi:type="inkscape:persp3d" />
+    <inkscape:perspective
+       id="perspective2953"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <inkscape:perspective
+       id="perspective2981"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <inkscape:perspective
+       id="perspective3009"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <inkscape:perspective
+       id="perspective3037"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <inkscape:perspective
+       id="perspective3065"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <inkscape:perspective
+       id="perspective3093"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <inkscape:perspective
+       id="perspective2960"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <inkscape:perspective
+       id="perspective2988"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <inkscape:perspective
+       id="perspective3016"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <inkscape:perspective
+       id="perspective3016-0"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <inkscape:perspective
+       id="perspective3016-6"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <inkscape:perspective
+       id="perspective3016-7"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <inkscape:perspective
+       id="perspective3016-5"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
   </defs>
   <sodipodi:namedview
      id="base"
@@ -61,11 +152,11 @@
      borderopacity="1.0"
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
-     inkscape:zoom="0.98994949"
-     inkscape:cx="141.17351"
-     inkscape:cy="136.92749"
+     inkscape:zoom="1.56875"
+     inkscape:cx="207.9"
+     inkscape:cy="240"
      inkscape:document-units="px"
-     inkscape:current-layer="svg2"
+     inkscape:current-layer="layer1"
      showgrid="false"
      inkscape:window-width="1920"
      inkscape:window-height="1006"
@@ -134,17 +225,17 @@
       <image
          sodipodi:absref="/home/wycc/devel/md3/MadButterfly/nodejs/video.png"
          xlink:href="video.png"
-         inkscape:bbox-height="84.588799"
-         inkscape:bbox-width="85.598946"
-         inkscape:bbox-y="383.87928"
-         inkscape:bbox-x="35.992421"
-         inkscape:transform-center-y="0"
+         width="85.598946"
+         height="84.588799"
+         id="image2983"
+         x="63.266537"
+         y="809.55243"
          inkscape:transform-center-x="0"
-         y="809.55243"
-         x="63.266537"
-         id="image2983"
-         height="84.588799"
-         width="85.598946" />
+         inkscape:transform-center-y="0"
+         inkscape:bbox-x="35.992421"
+         inkscape:bbox-y="383.87928"
+         inkscape:bbox-width="85.598946"
+         inkscape:bbox-height="84.588799" />
     </g>
     <g
        id="g2917-8"
@@ -159,17 +250,17 @@
       <image
          sodipodi:absref="/home/wycc/devel/md3/MadButterfly/nodejs/music.png"
          xlink:href="music.png"
-         inkscape:bbox-height="76.928574"
-         inkscape:bbox-width="86.5"
-         inkscape:bbox-y="386.37278"
-         inkscape:bbox-x="189.7836"
-         inkscape:transform-center-y="0"
+         width="86.5"
+         height="76.928574"
+         id="image3048"
+         x="63.00946"
+         y="814.71918"
          inkscape:transform-center-x="0"
-         y="814.71918"
-         x="63.00946"
-         id="image3048"
-         height="76.928574"
-         width="86.5" />
+         inkscape:transform-center-y="0"
+         inkscape:bbox-x="189.7836"
+         inkscape:bbox-y="386.37278"
+         inkscape:bbox-width="86.5"
+         inkscape:bbox-height="76.928574" />
     </g>
     <g
        id="g2917-88"
@@ -184,17 +275,17 @@
       <image
          sodipodi:absref="/home/wycc/devel/md3/MadButterfly/nodejs/photo.png"
          xlink:href="photo.png"
-         inkscape:bbox-height="76.14286"
-         inkscape:bbox-width="84"
-         inkscape:bbox-y="392.95458"
-         inkscape:bbox-x="354.2955"
-         inkscape:transform-center-y="0"
+         width="84"
+         height="76.14286"
+         id="image3049"
+         x="63.624115"
+         y="809.93323"
          inkscape:transform-center-x="0"
-         y="809.93323"
-         x="63.624115"
-         id="image3049"
-         height="76.14286"
-         width="84" />
+         inkscape:transform-center-y="0"
+         inkscape:bbox-x="354.2955"
+         inkscape:bbox-y="392.95458"
+         inkscape:bbox-width="84"
+         inkscape:bbox-height="76.14286" />
     </g>
     <g
        id="g2917-8-6"
@@ -209,17 +300,17 @@
       <image
          sodipodi:absref="/home/wycc/devel/md3/MadButterfly/nodejs/tool.png"
          xlink:href="tool.png"
-         inkscape:bbox-height="75.14286"
-         inkscape:bbox-width="84.571426"
-         inkscape:bbox-y="389.0568"
-         inkscape:bbox-x="526.42387"
-         inkscape:transform-center-y="0"
+         width="84.571426"
+         height="75.14286"
+         id="image3168"
+         x="63.521473"
+         y="810.79041"
          inkscape:transform-center-x="0"
-         y="810.79041"
-         x="63.521473"
-         id="image3168"
-         height="75.14286"
-         width="84.571426" />
+         inkscape:transform-center-y="0"
+         inkscape:bbox-x="526.42387"
+         inkscape:bbox-y="389.0568"
+         inkscape:bbox-width="84.571426"
+         inkscape:bbox-height="75.14286" />
     </g>
     <rect
        style="fill:#dfdf49;fill-opacity:1"
@@ -235,6 +326,182 @@
        inkscape:bbox-x="35.355339"
        inkscape:bbox-y="249.90203"
        inkscape:bbox-width="641.44684"
-       inkscape:bbox-height="71.720833" />
+       inkscape:bbox-height="71.720833"
+       mbname="lightbar" />
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
+       x="124.96794"
+       y="185.925"
+       id="text2931"
+       inkscape:transform-center-x="0"
+       inkscape:transform-center-y="0"
+       inkscape:bbox-x="140.30434"
+       inkscape:bbox-y="273.84843"
+       inkscape:bbox-width="488.15625"
+       inkscape:bbox-height="32.382812"
+       mbname="line1"><tspan
+         sodipodi:role="line"
+         inkscape:transform-center-x="0"
+         inkscape:transform-center-y="0"
+         x="124.96794"
+         y="185.925"
+         id="tspan2935"
+         style="font-size:16px"
+         inkscape:bbox-x="140.56215"
+         inkscape:bbox-y="290.74687"
+         inkscape:bbox-width="487.89844"
+         inkscape:bbox-height="15.484375">Lim JeongHee (J.Lim) &amp; JoKwon (2AM) - The Road to Break Up</tspan><tspan
+         sodipodi:role="line"
+         inkscape:transform-center-x="0"
+         inkscape:transform-center-y="0"
+         x="124.96794"
+         y="205.925"
+         style="font-size:16px"
+         inkscape:bbox-x="140.30434"
+         inkscape:bbox-y="273.84843"
+         inkscape:bbox-width="75.335938"
+         inkscape:bbox-height="12.101562"
+         id="tspan2941">7:00-7:30</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;display:inline;font-family:Bitstream Vera Sans"
+       x="124.96794"
+       y="247.75766"
+       id="text2931-20"
+       inkscape:transform-center-x="0"
+       inkscape:transform-center-y="0"
+       inkscape:bbox-x="126.28044"
+       inkscape:bbox-y="212.01578"
+       inkscape:bbox-width="488.15625"
+       inkscape:bbox-height="32.382812"
+       mbname="line2"><tspan
+         sodipodi:role="line"
+         inkscape:transform-center-x="0"
+         inkscape:transform-center-y="0"
+         x="124.96794"
+         y="247.75766"
+         id="tspan2935-1"
+         style="font-size:16px"
+         inkscape:bbox-x="126.53825"
+         inkscape:bbox-y="228.91422"
+         inkscape:bbox-width="487.89844"
+         inkscape:bbox-height="15.484375">Lim JeongHee (J.Lim) &amp; JoKwon (2AM) - The Road to Break Up</tspan><tspan
+         sodipodi:role="line"
+         inkscape:transform-center-x="0"
+         inkscape:transform-center-y="0"
+         x="124.96794"
+         y="267.75766"
+         style="font-size:16px"
+         inkscape:bbox-x="126.28044"
+         inkscape:bbox-y="212.01578"
+         inkscape:bbox-width="75.335938"
+         inkscape:bbox-height="12.101562"
+         id="tspan2941-9">7:30-8:30</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;display:inline;font-family:Bitstream Vera Sans"
+       x="124.96794"
+       y="309.59033"
+       id="text2931-21"
+       inkscape:transform-center-x="0"
+       inkscape:transform-center-y="0"
+       inkscape:bbox-x="126.05388"
+       inkscape:bbox-y="150.18311"
+       inkscape:bbox-width="488.38281"
+       inkscape:bbox-height="32.382812"
+       mbname="line3"><tspan
+         sodipodi:role="line"
+         inkscape:transform-center-x="0"
+         inkscape:transform-center-y="0"
+         x="124.96794"
+         y="309.59033"
+         id="tspan2935-2"
+         style="font-size:16px"
+         inkscape:bbox-x="126.53825"
+         inkscape:bbox-y="167.08154"
+         inkscape:bbox-width="487.89844"
+         inkscape:bbox-height="15.484375">Lim JeongHee (J.Lim) &amp; JoKwon (2AM) - The Road to Break Up</tspan><tspan
+         sodipodi:role="line"
+         inkscape:transform-center-x="0"
+         inkscape:transform-center-y="0"
+         x="124.96794"
+         y="329.59033"
+         style="font-size:16px"
+         inkscape:bbox-x="126.05388"
+         inkscape:bbox-y="150.18311"
+         inkscape:bbox-width="85.75"
+         inkscape:bbox-height="12.101562"
+         id="tspan2941-0">8:30-9:30</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;display:inline;font-family:Bitstream Vera Sans"
+       x="124.96794"
+       y="371.423"
+       id="text2931-3"
+       inkscape:transform-center-x="0"
+       inkscape:transform-center-y="0"
+       inkscape:bbox-x="125.97575"
+       inkscape:bbox-y="88.350433"
+       inkscape:bbox-width="488.46094"
+       inkscape:bbox-height="32.382812"
+       mbname="line4"><tspan
+         sodipodi:role="line"
+         inkscape:transform-center-x="0"
+         inkscape:transform-center-y="0"
+         x="124.96794"
+         y="371.423"
+         id="tspan2935-11"
+         style="font-size:16px"
+         inkscape:bbox-x="126.53825"
+         inkscape:bbox-y="105.24887"
+         inkscape:bbox-width="487.89844"
+         inkscape:bbox-height="15.484375">Lim JeongHee (J.Lim) &amp; JoKwon (2AM) - The Road to Break Up</tspan><tspan
+         sodipodi:role="line"
+         inkscape:transform-center-x="0"
+         inkscape:transform-center-y="0"
+         x="124.96794"
+         y="391.423"
+         style="font-size:16px"
+         inkscape:bbox-x="125.97575"
+         inkscape:bbox-y="88.350433"
+         inkscape:bbox-width="85.828125"
+         inkscape:bbox-height="12.101562"
+         id="tspan2941-90">9:30-10:30</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;display:inline;font-family:Bitstream Vera Sans"
+       x="124.96794"
+       y="433.25568"
+       id="text2931-6"
+       inkscape:transform-center-x="0"
+       inkscape:transform-center-y="0"
+       inkscape:bbox-x="126.53825"
+       inkscape:bbox-y="26.517761"
+       inkscape:bbox-width="487.89844"
+       inkscape:bbox-height="32.382812"
+       mbname="line5"><tspan
+         sodipodi:role="line"
+         inkscape:transform-center-x="0"
+         inkscape:transform-center-y="0"
+         x="124.96794"
+         y="433.25568"
+         id="tspan2935-7"
+         style="font-size:16px"
+         inkscape:bbox-x="126.53825"
+         inkscape:bbox-y="43.416199"
+         inkscape:bbox-width="487.89844"
+         inkscape:bbox-height="15.484375">Lim JeongHee (J.Lim) &amp; JoKwon (2AM) - The Road to Break Up</tspan><tspan
+         sodipodi:role="line"
+         inkscape:transform-center-x="0"
+         inkscape:transform-center-y="0"
+         x="124.96794"
+         y="453.25568"
+         style="font-size:16px"
+         inkscape:bbox-x="126.72575"
+         inkscape:bbox-y="26.517761"
+         inkscape:bbox-width="95.265625"
+         inkscape:bbox-height="12.101562"
+         id="tspan2941-7">10:30-11:30</tspan></text>
   </g>
 </svg>
--- a/nodejs/svg.js	Sun Sep 19 11:38:17 2010 +0800
+++ b/nodejs/svg.js	Sun Sep 19 19:28:33 2010 +0800
@@ -253,6 +253,7 @@
     var bbox, center;
     
     a = node.attr("bbox-x");
+    sys.puts("a="+a);
     if(!a)
 	return 0;
     
@@ -391,6 +392,16 @@
 	} else {
 	}
     }
+    sys.puts(y);
+    if (this._set_bbox(n, tcoord)) {
+        tcoord.center.x -= tcoord[2];
+        tcoord.center.y -= tcoord[5];
+        tcoord._x = tcoord.center.x;
+        tcoord._y = tcoord.center.y;
+    } else {
+        tcoord._x = coord.center.x;
+        tcoord._y = coord.center.y;
+    }
 	
     make_mbnames(this.mb_rt, n, tcoord);
 };
@@ -469,10 +480,8 @@
     var rect = this.mb_rt.rect_new(x,y,w,h,10, 10);
     this._set_paint(n, rect);
     if (this._set_bbox(n, tcoord)) {
-        rx = accu_matrix[0]*tcoord.center.x+accu_matrix[1]*tcoord.center.y+accu_matrix[2];
-        ry = accu_matrix[3]*tcoord.center.x+accu_matrix[4]*tcoord.center.y+accu_matrix[5];
-	tcoord.center.x -= accu_matrix[2]+tcoord[2];
-	tcoord.center.y -= accu_matrix[2]+tcoord[2];
+	tcoord.center.x -= tcoord[2];
+	tcoord.center.y -= tcoord[5];
     } else {
         if (trans) {
             rx = tcoord[0]*x+tcoord[1]*y+tcoord[2];
@@ -483,6 +492,10 @@
                 tcoord.center.y = ry;
 	}
     }
+    sys.puts("center.x="+tcoord.center.x);
+    sys.puts("center.y="+tcoord.center.y);
+    tcoord._x = tcoord.center.x;
+    tcoord._y = tcoord.center.y;
     tcoord.add_shape(rect);
 
     make_mbnames(this.mb_rt, n, tcoord);
--- a/nodejs/testdesktop.js	Sun Sep 19 11:38:17 2010 +0800
+++ b/nodejs/testdesktop.js	Sun Sep 19 19:28:33 2010 +0800
@@ -15,15 +15,18 @@
 picture = app.get("picture");
 setting = app.get("setting");
 
+lightbar = app.get("lightbar");
+lines=[app.get("line1"),app.get("line2"),app.get("line3"), app.get("line4"),app.get("line5")];
+for(i=0;i<lines.length;i++) {
+    sys.puts("["+i+"]="+lines[i].y);
+}
+line=0;
+
 items=[video,audio,picture,setting];
 item = 0;
 an = new animate.scale(app,items[item],1,1.5,0.1);
 an.start();
 app.refresh();
-setInterval(function() {
-    
-
-}, 300);
 app.addKeyListener(mbapp.KEY_LEFT, function() {
 	var old = items[item];
 	item = item - 1;
@@ -52,6 +55,35 @@
         an.start();
 });
 
+app.addKeyListener(mbapp.KEY_UP, function() {
+	var old = lines[line];
+	line = line - 1;
+	if (line == -1) {
+		line = 0;
+		return;
+	}
+        var target = lines[line];
+	var sy = target.y-20-lightbar.y;
+	sys.puts(sy);
+	var an = new animate.linear(app,lightbar,0,sy,0.3);
+        an.start();
+});
+app.addKeyListener(mbapp.KEY_DOWN, function() {
+	var old = lines[line];
+	line = line + 1;
+	if (line == lines.length) {
+		line = line - 1; 
+		return;
+	}
+        var target = lines[line];
+	var sy = target.y-20-lightbar.y;
+	sys.puts("line="+line);
+	sys.puts("sy="+sy);
+	sys.puts("target.y="+target.y);
+	sys.puts("lightbar.y="+lightbar.y);
+	var an = new animate.linear(app,lightbar,0,sy,0.3);
+        an.start();
+});
 
 app.addKeyListener(mbapp.KEY_ENTER, function() {
 	var target = items[item];