Mercurial > laserkard
comparison onlypaths/js/format.js @ 46:26c2b3ad21c7 laserkard
[svn r47] saving progresswww.cinemassacre.com/new/?page_id=30
author | rlm |
---|---|
date | Sun, 31 Jan 2010 12:33:33 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
45:bff96abdddfa | 46:26c2b3ad21c7 |
---|---|
1 /* | |
2 JSON Richdraw Abstraction Layer | |
3 | |
4 --------------------- | |
5 Also, | |
6 | |
7 JSON Rich Draw Format | |
8 | |
9 --------------------- | |
10 | |
11 */ | |
12 | |
13 | |
14 | |
15 function canvas(richdraw,format){ | |
16 | |
17 var rawshapes = richdraw.getshapes() | |
18 var newshapes = []; | |
19 //var view=Ext.util.JSON.encode(myOPF[0]) | |
20 //newshapes.push(Ext.util.JSON.decode(view)); | |
21 newshapes.push(myOPF[0]); | |
22 for(var i = 0; i < rawshapes.length; i++){ | |
23 newshapes.push(richdraw.renderer.info(rawshapes[i])); | |
24 } | |
25 return newshapes; | |
26 } | |
27 | |
28 | |
29 var fullscreen=false; | |
30 function load(code,draw) | |
31 { | |
32 | |
33 var noattachlistener=false; | |
34 var renderdoc=false; | |
35 var renderinfo=false | |
36 for(var i = 0; i < code.length; i++) | |
37 { | |
38 var rendering=true; | |
39 | |
40 if(code[i].type == "info") | |
41 { | |
42 rendering=false; | |
43 renderinfo=true; | |
44 if(code[i].loop!=null) | |
45 { | |
46 timerNext=code[i].loop; | |
47 }else{ | |
48 timerNext=0; | |
49 } | |
50 } | |
51 | |
52 if(code[i].type == "doc") | |
53 { | |
54 rendering=false; | |
55 renderdoc=true; | |
56 if(fullscreen==false) | |
57 { | |
58 draw.renderer.view( | |
59 code[i].left, | |
60 code[i].top, | |
61 code[i].width, | |
62 code[i].height, | |
63 code[i].viewBox, | |
64 (code[i].bgcolor!=null)?code[i].bgcolor:"" | |
65 ); | |
66 } | |
67 else | |
68 { | |
69 draw.renderer.view( | |
70 0, | |
71 0, | |
72 screenW, | |
73 screenH, | |
74 code[i].viewBox, | |
75 '' | |
76 ); | |
77 } | |
78 } | |
79 | |
80 if( rendering==true) | |
81 { | |
82 var co = draw.renderer.create(code[i].type, | |
83 (code[i].fillColor!=null)?code[i].fillColor:"", | |
84 (code[i].lineColor)?code[i].lineColor:"", | |
85 (code[i].fillOpac)?code[i].fillOpac:"", | |
86 (code[i].lineOpac)?code[i].lineOpac:"", | |
87 (code[i].lineWidth)?code[i].lineWidth:"", | |
88 (code[i].left)?code[i].left:"", | |
89 (code[i].top)?code[i].top:"", | |
90 (code[i].width)?code[i].width:"", | |
91 (code[i].height)?code[i].height:"", | |
92 (code[i].text)?code[i].text:'', | |
93 (code[i].textSize)?code[i].textSize:"", | |
94 (code[i].textFamily)?code[i].textFamily:'Arial', | |
95 (code[i].href)?code[i].href:'', | |
96 (code[i].points)?code[i].points:'', | |
97 (code[i].transform)?code[i].transform:'', | |
98 (code[i].parent)?code[i].parent:''); | |
99 | |
100 co.id = ""+code[i].id; | |
101 if (!noattachlistener) | |
102 { | |
103 Ext.get(co).on("mousedown", draw.onHit, draw); | |
104 | |
105 /* | |
106 co.addEventListener("click", function(event) { myfunction(this.id,draw,event); }, false); | |
107 co.addEventListener("mouseover", function(event) {myOverFunction(this.id,draw,event); }, false); | |
108 co.addEventListener("mouseout", function(event) {myOutFunction(this.id,draw,event); }, false); | |
109 co.addEventListener("mouseup", function(event) {myUpFunction(this.id,draw,event); }, false); | |
110 co.addEventListener("mousedown", function(event) {myDownFunction(this.id,draw,event); }, false); | |
111 co.addEventListener("mousemove", function(event) {myMoveFunction(this.id,draw,event); }, false); | |
112 co.addEventListener("dblclick", function(event) {myDblclickFunction(this.id,draw,event); }, false); | |
113 */ | |
114 } | |
115 } | |
116 } | |
117 if(renderdoc == false) | |
118 { | |
119 if(fullscreen==false) | |
120 { | |
121 draw.renderer.view(0,0,canvasWidth,canvasHeight,'0 0 700 400',''); | |
122 } | |
123 else | |
124 { | |
125 draw.renderer.view(0,0,screenW,screenH,'0 0 700 400',''); | |
126 } | |
127 } | |
128 if(renderinfo == false) | |
129 { | |
130 } | |
131 } | |
132 | |
133 | |
134 | |
135 |