Merge lp:~a11danjo/lenasys/branch into lp:~lenasysimpl1/lenasys/GammaBear
- branch
- Merge into GammaBear
Proposed by
Daniel Johansson
Status: | Merged |
---|---|
Merged at revision: | 13 |
Proposed branch: | lp:~a11danjo/lenasys/branch |
Merge into: | lp:~lenasysimpl1/lenasys/GammaBear |
Diff against target: |
1280 lines (+618/-611) 5 files modified
ErModeller/canvas.css (+3/-0) ErModeller/canvas.js (+604/-0) ErModeller/canvas_ER_demo_duggajs.html (+8/-610) WebGL and Benchmarking/test1shaderstartup.css (+2/-0) WebGL and Benchmarking/test1shaderstartup.html (+1/-1) |
To merge this branch: | bzr merge lp:~a11danjo/lenasys/branch |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel Johansson | Approve | ||
Review via email: mp+156809@code.launchpad.net |
Commit message
Description of the change
Mostly to ErModeller and some stuff in WebGL and Widget Library
To post a comment you must log in.
Revision history for this message
Daniel Johansson (a11danjo) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'ErModeller/canvas.css' |
2 | --- ErModeller/canvas.css 1970-01-01 00:00:00 +0000 |
3 | +++ ErModeller/canvas.css 2013-04-03 11:33:22 +0000 |
4 | @@ -0,0 +1,3 @@ |
5 | +#a {border:2px solid black;} |
6 | +#infobox {padding:4px;} |
7 | +#background {border:2px solid black;background-color:#fed; width:300;height:450;} |
8 | |
9 | === added file 'ErModeller/canvas.js' |
10 | --- ErModeller/canvas.js 1970-01-01 00:00:00 +0000 |
11 | +++ ErModeller/canvas.js 2013-04-03 11:33:22 +0000 |
12 | @@ -0,0 +1,604 @@ |
13 | + var startx = 0; |
14 | + var starty = 0; |
15 | + var deltax = 0; |
16 | + var deltay = 0; |
17 | + var gridsize = 20; |
18 | + |
19 | + // Multi-select move offset |
20 | + var offsx = 0; |
21 | + var offsy = 0; |
22 | + // Drawing Globals -- For while in transit drawing |
23 | + var drawlinesx; |
24 | + var drawlinesy; |
25 | + var drawlinedx; |
26 | + var drawlinedy; |
27 | + var drawlinekind = 0; |
28 | + // List of objects |
29 | + // List of identifiers |
30 | + // List of selected object identifiers |
31 | + // The context object |
32 | + var Objects = new Array(); |
33 | + var Selected = new Array(); |
34 | + var Identifiers = new Array(); |
35 | + var ContextObj; |
36 | + // Mouse Down Result |
37 | + var downRes; |
38 | + // User Interface Mode Variables |
39 | + var multiselect = 0; |
40 | + var dragsensitivity = 12; |
41 | + var sidetol = 12; |
42 | + var printstr; |
43 | + |
44 | + /* |
45 | + User interface callbacks |
46 | + */ |
47 | + function handler_mouseup() |
48 | + { |
49 | + if(clickstate == 1) { |
50 | + // Either select on/off for multi or single select |
51 | + if(multiselect) { |
52 | + if(Selected[downRes.objid]) { |
53 | + Selected[downRes.objid] = false; |
54 | + } else { |
55 | + Selected[downRes.objid] = true; |
56 | + } |
57 | + } else { |
58 | + if(ContextObj == downRes.objid) { |
59 | + ContextObj = ""; |
60 | + } else { |
61 | + ContextObj = downRes.objid; |
62 | + } |
63 | + } |
64 | + } else if(clickstate == 8) { |
65 | + // Draw Attribute Line |
66 | + upRes=mouseover(gridx,gridy); |
67 | + if(upRes.code != "None") { |
68 | + obj = Objects[downRes.objid]; |
69 | + if(upRes.typ == "ERAttribute" || upRes.typ == "Entity" || upRes.typ == "ERRel") { |
70 | + obj.DrawtoID = upRes.objid; |
71 | + obj.DrawfromSide = downRes.side; |
72 | + if(upRes.side != "None") { |
73 | + obj.DrawtoSide = upRes.side; |
74 | + obj.DrawtoPerc = upRes.sideperc; |
75 | + } else { |
76 | + upobj = Objects[downRes.objid]; |
77 | + var sid = 1; |
78 | + var perco = 0.5; |
79 | + var x1g = Math.abs(upRes.x1 - gridx); |
80 | + var x2g = Math.abs(upRes.x2 - gridx); |
81 | + var y1g = Math.abs(upRes.y1 - gridy); |
82 | + var y2g = Math.abs(upRes.y2 - gridy); |
83 | + if(x1g <= x2g && x1g <= y1g && x1g <= y2g){ |
84 | + sid = 1; |
85 | + perco = makesideperc(gridy, upRes.y1, upRes.y2); |
86 | + } else if(x2g <= x1g && x2g <= y1g && x2g <= y2g){ |
87 | + sid = 3; |
88 | + perco = makesideperc(gridy, upRes.y1, upRes.y2); |
89 | + } else if(y1g <= x1g && y1g <= x2g && y1g <= y2g){ |
90 | + sid = 4; |
91 | + perco = makesideperc(gridx, upRes.x1, upRes.x2); |
92 | + } else if(y2g <= x1g && y2g <= x2g && y2g <= y1g){ |
93 | + sid = 2; |
94 | + perco = makesideperc(gridx, upRes.x1, upRes.x2); |
95 | + } |
96 | + obj.DrawtoSide = sid; |
97 | + obj.DrawtoPerc = perco; |
98 | + } |
99 | + if(upRes.typ == "ERAttribute" || upRes.typ == "ERRel") obj.DrawtoPerc = 0.5; |
100 | + } |
101 | + } |
102 | + } else if(clickstate == 9) { |
103 | + // Draw Relationship line |
104 | + upRes = mouseover(gridx, gridy); |
105 | + if(upRes.code != "None") { |
106 | + obj = Objects[downRes.objid]; |
107 | + if(upRes.side != "None") { |
108 | + if(obj.DrawtoID == "None") { |
109 | + obj.DrawtoID = upRes.objid; |
110 | + obj.DrawtoSide = upRes.side; |
111 | + obj.DrawtoPerc = upRes.sideperc; |
112 | + obj.DrawfromSide = downRes.side; |
113 | + } else { |
114 | + obj.DrawtoIDDest = upRes.objid; |
115 | + obj.DrawtoSideDest = upRes.side; |
116 | + obj.DrawtoPercDest = upRes.sideperc; |
117 | + obj.DrawfromSideDest = downRes.side; |
118 | + } |
119 | + } else { |
120 | + upobj = Objects[downRes.objid]; |
121 | + var sid = 1; |
122 | + var perco = 0.5; |
123 | + var x1g = Math.abs(upRes.x1-gridx); |
124 | + var x2g = Math.abs(upRes.x2-gridx); |
125 | + var y1g = Math.abs(upRes.y1-gridy); |
126 | + var y2g = Math.abs(upRes.y2-gridy); |
127 | + if(x1g <= x2g && x1g <= y1g && x1g <= y2g) { |
128 | + sid = 1; |
129 | + perco = makesideperc(gridy, upRes.y1, upRes.y2); |
130 | + } else if(x2g <= x1g && x2g <= y1g && x2g <= y2g) { |
131 | + sid = 3; |
132 | + perco = makesideperc(gridy, upRes.y1, upRes.y2); |
133 | + } else if(y1g <= x1g && y1g <= x2g && y1g <= y2g) { |
134 | + sid = 4; |
135 | + perco = makesideperc(gridx, upRes.x1, upRes.x2); |
136 | + } else if(y2g <= x1g && y2g <= x2g && y2g <= y1g){ |
137 | + sid = 2; |
138 | + perco = makesideperc(gridx, upRes.x1, upRes.x2); |
139 | + } |
140 | + if(obj.DrawtoID == "None") { |
141 | + obj.DrawtoID = upRes.objid; |
142 | + obj.DrawtoSide = sid; |
143 | + obj.DrawtoPerc = perco; |
144 | + obj.DrawfromSide = downRes.side; |
145 | + } else { |
146 | + obj.DrawtoIDDest = upRes.objid; |
147 | + obj.DrawtoSideDest = sid; |
148 | + obj.DrawtoPercDest = perco; |
149 | + obj.DrawfromSideDest = downRes.side; |
150 | + } |
151 | + } |
152 | + } |
153 | + } |
154 | + clickstate = 0; |
155 | + cpsel = 0; |
156 | + drawlinekind = 0; |
157 | + } |
158 | + /* |
159 | + * Mouse down state |
160 | + */ |
161 | + function handler_mousedown() { |
162 | + clickstate = 1; |
163 | + downRes = mouseover(gridx, gridy); |
164 | + startx = gridx; |
165 | + starty = gridy; |
166 | + } |
167 | + |
168 | + /* |
169 | + * Mouse move |
170 | + */ |
171 | + function handler_mousemove(cx, cy) { |
172 | +// gridx=Math.round((cx-(gridsize/2.0))/gridsize)*gridsize; |
173 | +// gridy=Math.round((cy-(gridsize/2.0))/gridsize)*gridsize; |
174 | + gridx = cx; |
175 | + gridy = cy; |
176 | + deltax = startx - gridx; |
177 | + deltay = starty - gridy; |
178 | + // We start drag mode |
179 | + if((distance(gridx, gridy, startx, starty) > dragsensitivity) && clickstate == 1) { |
180 | + clickstate = 2; |
181 | + } |
182 | + // We are in drag mode |
183 | + if(clickstate == 2) { |
184 | + // Single Object Move - If Not Selected, Or if Selected and Center Area Is Dragged |
185 | + if((downRes.typ == "Entity" || downRes.typ == "ERAttribute" || downRes.typ == "ERRel") && (downRes.code == "NonSel" || (downRes.code == "Cont" && downRes.side == "None") || (downRes.code == "ContDraw" && downRes.side == "None"))) { |
186 | + clickstate = 3; |
187 | + } |
188 | + // Single Object Scale Left |
189 | + if((downRes.typ == "Entity" || downRes.typ == "ERAttribute") && (downRes.code == "Cont" && downRes.side == "1")) { |
190 | + clickstate=4; |
191 | + } |
192 | + // Single Object Scale Bottom |
193 | + if((downRes.typ == "Entity" || downRes.typ == "ERAttribute") && (downRes.code == "Cont" && downRes.side == "2")) { |
194 | + clickstate=5; |
195 | + } |
196 | + // Single Object Scale Right |
197 | + if((downRes.typ == "Entity" || downRes.typ == "ERAttribute") && (downRes.code == "Cont" && downRes.side == "3")) { |
198 | + clickstate=6; |
199 | + } |
200 | + // Single Object Scale Top |
201 | + if((downRes.typ == "Entity" || downRes.typ == "ERAttribute") && (downRes.code == "Cont" && downRes.side == "4")) { |
202 | + clickstate=7; |
203 | + } |
204 | + if(downRes.typ == "ERAttribute" && downRes.code == "ContDraw" && downRes.side != "None") { |
205 | + clickstate=8; // Attribute Connection Draw |
206 | + drawlinekind=1; // Tell drawing engine to draw attribute line symbol |
207 | + if(downRes.side == "1") { |
208 | + drawlinesx = downRes.x1; // Initiate start parameters for line drawing left side |
209 | + drawlinesy = downRes.y1 + ((downRes.y2 - downRes.y1) * 0.5); |
210 | + } else if(downRes.side == "2") { |
211 | + drawlinesx = downRes.x1 + ((downRes.x2 - downRes.x1) * 0.5); // Initiate start parameters for line drawing bottom side |
212 | + drawlinesy = downRes.y2; |
213 | + } else if(downRes.side == "3") { |
214 | + drawlinesx = downRes.x2; // Initiate start parameters for line drawing left side |
215 | + drawlinesy = downRes.y1 + ((downRes.y2 - downRes.y1) * 0.5); |
216 | + } else if(downRes.side == "4") { |
217 | + drawlinesx = downRes.x1 + ((downRes.x2 - downRes.x1) * 0.5); // Initiate start parameters for line drawing bottom side |
218 | + drawlinesy = downRes.y1; |
219 | + } |
220 | + drawlinedx = drawlinesx; |
221 | + drawlinedy = drawlinesy; |
222 | + } |
223 | + if(downRes.typ == "ERRel" && downRes.code == "ContDraw" && downRes.side != "None") { |
224 | + var obj=Objects[downRes.objid]; |
225 | + if(downRes.side != obj.DrawfromSide && downRes.side != obj.DrawfromSideDest) { |
226 | + clickstate = 9; // Attribute Connection Draw |
227 | + drawlinekind = 1; // Tell drawing engine to draw relation line symbol |
228 | + if(downRes.side == "1") { |
229 | + drawlinesx = downRes.x1; // Initiate start parameters for line drawing left side |
230 | + drawlinesy = downRes.y1 + ((downRes.y2 - downRes.y1) * 0.5); |
231 | + } else if(downRes.side == "2") { |
232 | + drawlinesx = downRes.x1 + ((downRes.x2 - downRes.x1) * 0.5); // Initiate start parameters for line drawing bottom side |
233 | + drawlinesy = downRes.y2; |
234 | + } else if(downRes.side == "3") { |
235 | + drawlinesx = downRes.x2; // Initiate start parameters for line drawing left side |
236 | + drawlinesy = downRes.y1 + ((downRes.y2 - downRes.y1) * 0.5); |
237 | + } else if(downRes.side == "4") { |
238 | + drawlinesx = downRes.x1 + ((downRes.x2 - downRes.x1) * 0.5); // Initiate start parameters for line drawing bottom side |
239 | + drawlinesy = downRes.y1; |
240 | + } |
241 | + drawlinedx = drawlinesx; |
242 | + drawlinedy = drawlinesy; |
243 | + } |
244 | + } |
245 | + } |
246 | + if(clickstate > 2) { |
247 | + var obj = Objects[downRes.objid]; |
248 | + } |
249 | + if(clickstate == 3) { // We are in single rectangular object move |
250 | + obj.x1 = downRes.x1 - deltax; |
251 | + obj.y1 = downRes.y1 - deltay; |
252 | + obj.x2 = downRes.x2 - deltax; |
253 | + obj.y2 = downRes.y2 - deltay; |
254 | + } else if(clickstate == 4) { // We are in single rectangular object scale left |
255 | + if((obj.x2 - downRes.x1 + deltax) > 60) obj.x1 = downRes.x1 - deltax; |
256 | + } else if(clickstate == 5) { // We are in single rectangular object scale bottom |
257 | + if((downRes.y2 - obj.y1 - deltay) > 40) obj.y2 = downRes.y2 - deltay; |
258 | + } else if(clickstate==6) { // We are in single rectangular object scale right |
259 | + if((downRes.x2 - obj.x1 - deltax) > 60) obj.x2 = downRes.x2 - deltax; |
260 | + } else if(clickstate == 7) { // We are in single rectangular object scale top |
261 | + if((obj.y2 - downRes.y1 + deltay) > 40) obj.y1 = downRes.y1 - deltay; |
262 | + } else if(clickstate == 8 || clickstate == 9) { // We are in straight connective line drawing mode |
263 | + drawlinedx = gridx; |
264 | + drawlinedy = gridy; |
265 | + } |
266 | + } |
267 | + |
268 | + /* |
269 | + * Call-forward for mouse-over event |
270 | + */ |
271 | + function mouseover(x, y) { |
272 | + // Code of touch, and if available object id and id of side of object that was touched |
273 | + // Tolerances included as constant |
274 | + var obj_code = "None"; |
275 | + var obj_id = "None"; |
276 | + var obj_sidentifier =" None"; |
277 | + var obj_sideperc = 0; |
278 | + var obj_centerdist = 0; |
279 | + var obj_type = "None"; |
280 | + var obj_x1 = 0; |
281 | + var obj_y1 = 0; |
282 | + var obj_x2 = 0; |
283 | + var obj_y2 = 0; |
284 | + var Cont; |
285 | + var found = 0; |
286 | + var side; |
287 | + for(j = 0; j < Identifiers.length; j++) { |
288 | + var objid = Identifiers[j]; |
289 | + var obj = Objects[objid]; |
290 | + var Sel = Selected[objid]; |
291 | + if(ContextObj == objid) { |
292 | + Cont = 1; |
293 | + } else { |
294 | + Cont = 0; |
295 | + } |
296 | + // Compute coordinates including offset |
297 | + if(obj.type == "Entity" || obj.type == "ERAttribute" || obj.type == "ERRel") { |
298 | + x1 = obj.x1 + offsx; |
299 | + y1 = obj.y1 + offsy; |
300 | + x2 = obj.x2 + offsx; |
301 | + y2 = obj.y2 + offsy; |
302 | + rx = (x2 - x1) * 0.5; |
303 | + ry = (y2 - y1) * 0.5; |
304 | + } |
305 | + found = 0; |
306 | + // For each kind of clickable object, check if we are inside object and if so assign variables |
307 | + // Any general properties for all object types are set when "found" is true |
308 | + if(obj.type == "Entity") { |
309 | + if(x > (x1 - sidetol) && y > (y1 - sidetol ) && x < (x2 + sidetol) && y < (y2 + sidetol)) { |
310 | + obj_code = "NonSel"; |
311 | + if(Sel) { |
312 | + obj_code = "Sel"; |
313 | + } |
314 | + if(Cont) { |
315 | + obj_code = "Cont"; |
316 | + } |
317 | + side = computeside(x, y, x1, y1, x2, y2, sidetol); |
318 | + obj_sidentifier = side.side; |
319 | + obj_sideperc = side.perc; |
320 | + obj_centerdist = side.dist; |
321 | + found = 1; |
322 | + } |
323 | + } else if(obj.type=="ERAttribute") { |
324 | + if(x > (x1 - sidetol) && y > (y1 - sidetol) && x < (x2 + sidetol) && y < (y2 + sidetol)) { |
325 | + obj_code = "NonSel"; |
326 | + if(Sel) { |
327 | + obj_code="Sel"; |
328 | + } |
329 | + if(Cont) { |
330 | + if(obj.DrawtoID == "None") { |
331 | + obj_code = "ContDraw"; |
332 | + } else { |
333 | + obj_code = "Cont"; |
334 | + } |
335 | + } |
336 | + side = computeside(x, y, x1, y1, x2, y2, sidetol); |
337 | + obj_sidentifier = side.side; |
338 | + obj_sideperc = side.perc; |
339 | + obj_centerdist = side.dist; |
340 | + found = 1; |
341 | + } |
342 | + } else if(obj.type == "ERRel") { |
343 | + if(x > (x1 - sidetol) && y > (y1 - sidetol) && x < (x2 + sidetol) && y < (y2 + sidetol)) { |
344 | + xk = x - x1; |
345 | + // Colision detection against diamond |
346 | + var inside = 0; |
347 | + if(xk <= rx) { |
348 | + if(y > (y1 + ry - xk - sidetol) && y < (y1 + ry + xk + sidetol)) { |
349 | + inside = 1; |
350 | + } |
351 | + } else { |
352 | + if(y > (y1 - rx + xk - sidetol) && y < ( y2 + rx - xk + sidetol)) { |
353 | + inside = 1; |
354 | + } |
355 | + } |
356 | + if(inside) { |
357 | + if((x > (x1 - sidetol)) && (x < (x1 + sidetol)) && (y > (y1 + ry - sidetol)) && (y < (y1 + ry + sidetol))) { |
358 | + obj_sidentifier = 1; |
359 | + } |
360 | + if((x > (x1 + rx - sidetol)) && (x < (x1 + rx + sidetol)) && (y > (y2 - sidetol)) && (y < (y2 + sidetol))) { |
361 | + obj_sidentifier = 2; |
362 | + } |
363 | + if((x > (x2 - sidetol)) && (x < (x2 + sidetol)) && (y > (y1 + ry - sidetol)) && (y < (y1 + ry + sidetol))) { |
364 | + obj_sidentifier = 3; |
365 | + } |
366 | + if((x > (x1 + rx - sidetol)) && (x < (x1 + rx + sidetol)) && (y > (y1 - sidetol)) && (y < (y1 + sidetol))) { |
367 | + obj_sidentifier = 4; |
368 | + } |
369 | + obj_code = "NonSel"; |
370 | + if(Sel) { |
371 | + obj_code = "Sel"; |
372 | + } |
373 | + if(Cont) { |
374 | + if(obj.DrawtoID == "None"){ |
375 | + obj_code = "ContDraw"; |
376 | + } else if(obj.DrawtoIDDest == "None") { |
377 | + obj_code = "ContDraw"; |
378 | + } else { |
379 | + obj_code = "Cont"; |
380 | + } |
381 | + } |
382 | + obj_sideperc = 0.5; |
383 | + found = 1; |
384 | + } |
385 | + } |
386 | + } |
387 | + if(found == 1) { |
388 | + // Save coordinates at time of click |
389 | + obj_x1 = x1; |
390 | + obj_y1 = y1; |
391 | + obj_x2 = x2; |
392 | + obj_y2 = y2; |
393 | + obj_id = objid; |
394 | + obj_type = obj.type; |
395 | + printstr=obj_id + " " + obj_sidentifier + " " + obj_sideperc; |
396 | + } |
397 | + } |
398 | + return { |
399 | + objid:obj_id, |
400 | + code:obj_code, |
401 | + side:obj_sidentifier, |
402 | + sideperc:obj_sideperc, |
403 | + centerdist:obj_centerdist, |
404 | + typ:obj_type, |
405 | + x1:obj_x1, |
406 | + y1:obj_y1, |
407 | + x2:obj_x2, |
408 | + y2:obj_y2 |
409 | + } |
410 | + } |
411 | + |
412 | + /* |
413 | + * |
414 | + */ |
415 | + function importdata() { |
416 | + for(i = 0; i < 7; i++) { |
417 | + if(i == 0) { |
418 | + obj = jQuery.parseJSON('{"type":"ERAttribute","id":"ATT1","kind":"Multiple","name":"Addressfosoppooo","x1":220,"y1":100,"x2":300,"y2":140, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"None", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":""}'); |
419 | + } |
420 | + if(i == 1) { |
421 | + obj = jQuery.parseJSON('{"type":"Entity","id":"ENT2","kind":"Weak","name":"Carsmashoepppoloo","x1":100,"y1":160,"x2":220,"y2":220}'); |
422 | + } |
423 | + if(i == 2) { |
424 | + obj = jQuery.parseJSON('{"type":"ERAttribute","id":"ATT3","kind":"Key","name":"SSNFooomesPoo","x1":160,"y1":260,"x2":260,"y2":300, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"None", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":""}'); |
425 | + } |
426 | + if(i == 3) { |
427 | + obj = jQuery.parseJSON('{"type":"Entity","id":"ENT4","kind":"Strong","name":"Trailerfpdddpeoooooe","x1":320,"y1":260,"x2":420,"y2":320}'); |
428 | + } |
429 | + if(i == 4) { |
430 | + obj = jQuery.parseJSON('{"type":"Entity","id":"ENT5","kind":"Strong","name":"Grail","x1":120,"y1":440,"x2":220,"y2":480}'); |
431 | + } |
432 | + if(i == 5) { |
433 | + obj = jQuery.parseJSON('{"type":"ERRel","id":"REL6","kind":"Strong","name":"FGFool","x1":460,"y1":160,"x2":520,"y2":220, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"0", "DrawtoCard":"N", "DrawtoRole":"Fumo", "DrawtoXoffs":"20", "DrawtoYoffs":"50", "DrawtoIDDest":"None", "DrawfromSideDest":"None","DrawtoSideDest":"None", "DrawtoPercDest":"0", "DrawtoDestCard":"N", "DrawtoDestRole":"Luma", "DrawtoDestXoffs":"0", "DrawtoDestYoffs":"-50", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":"","DrawX3":"", "DrawY3":"", "DrawX4":"","DrawY4":""}'); |
434 | + } |
435 | + if(i == 6) { |
436 | + obj = jQuery.parseJSON('{"type":"ERRel","id":"REL7","kind":"Weak","name":"PODrool","x1":360,"y1":360,"x2":420,"y2":420, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"0", "DrawtoCard":"N", "DrawtoRole":"Kumo", "DrawtoXoffs":"60", "DrawtoYoffs":"70", "DrawtoIDDest":"None", "DrawfromSideDest":"None","DrawtoSideDest":"None", "DrawtoPercDest":"0", "DrawtoDestCard":"N", "DrawtoDestRole":"Zuuma", "DrawtoDestXoffs":"40", "DrawtoDestYoffs":"50", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":"","DrawX3":"", "DrawY3":"", "DrawX4":"","DrawY4":""}'); |
437 | + } |
438 | + objid = obj.id; |
439 | + Objects[objid] = obj; |
440 | + Identifiers.push(objid); |
441 | + } |
442 | + } |
443 | + |
444 | + /* |
445 | + * prepareobj |
446 | + * Prepares all kinds of objects, with local movement-offset (scrolling offset is handled with transforms??) |
447 | + * Ofss in prepare are not finished. |
448 | + */ |
449 | + function prepareobj(obji) { |
450 | + var fromobj = Objects[obji]; |
451 | + // Attributes are prepared by re-pointing the DrawX1, DrawY1, DrawX2 and DrawY2 variables and Relationships are prepared by re-pointing DrawX1-DrawX4 and DrawY1-DrawY4 |
452 | + if((fromobj.type == "ERAttribute" || fromobj.type == "ERRel") && fromobj.DrawtoID != "None") { |
453 | + var toid = fromobj.DrawtoID; |
454 | + var toobj = Objects[toid]; |
455 | + var sidek; |
456 | + if(fromobj.DrawtoIDDest != "None" && fromobj.DrawtoIDDest != undefined) { |
457 | + var toiddest = fromobj.DrawtoIDDest; |
458 | + var toobjdest = Objects[toiddest]; |
459 | + sidek = makeside(fromobj.DrawfromSideDest, fromobj.x1, fromobj.y1, fromobj.x2, fromobj.y2, 0.5); |
460 | + fromobj.DrawX3 = sidek.x; |
461 | + fromobj.DrawY3 = sidek.y; |
462 | + sidek = makeside(fromobj.DrawtoSideDest, toobjdest.x1, toobjdest.y1, toobjdest.x2, toobjdest.y2, fromobj.DrawtoPercDest); |
463 | + fromobj.DrawX4 = sidek.x; |
464 | + fromobj.DrawY4 = sidek.y; |
465 | + } |
466 | + //printstr=fromobj.DrawfromSide+" "+fromobj.x1+" "+fromobj.y1+" "+fromobj.x2+" "+fromobj.y2+" :: "+fromobj.DrawtoSide+" "+toobj.x1+" "+toobj.y1+" "+toobj.x2+" "+toobj.y2+" "+fromobj.DrawtoPerc; |
467 | + sidek = makeside(fromobj.DrawfromSide, fromobj.x1, fromobj.y1, fromobj.x2, fromobj.y2, 0.5); |
468 | + fromobj.DrawX1 = sidek.x; |
469 | + fromobj.DrawY1 = sidek.y; |
470 | + sidek = makeside(fromobj.DrawtoSide, toobj.x1, toobj.y1, toobj.x2, toobj.y2, fromobj.DrawtoPerc); |
471 | + fromobj.DrawX2 = sidek.x; |
472 | + fromobj.DrawY2 = sidek.y; |
473 | + } |
474 | + } |
475 | + |
476 | + /* |
477 | + * Drawobj |
478 | + * Draws all kinds of objects, with local movement-offset (scrolling offset is handled with transforms??) |
479 | + */ |
480 | + function drawobj(obji) { |
481 | + var obj = Objects[obji]; |
482 | + var Sel = Selected[obji]; |
483 | + if(ContextObj == obji) { |
484 | + Cont = 1; |
485 | + } else { |
486 | + Cont = 0; |
487 | + } |
488 | + context.strokeStyle = '#000'; |
489 | + context.lineWidth = 2.0; |
490 | + // Compute coordinates including offset |
491 | + if(obj.type == "Entity" || obj.type == "ERAttribute" || obj.type == "ERRel") { |
492 | + x1 = obj.x1 + offsx; |
493 | + y1 = obj.y1 + offsy; |
494 | + x2 = obj.x2 + offsx; |
495 | + y2 = obj.y2 + offsy; |
496 | + rx = (x2 - x1) * 0.5; |
497 | + ry = (y2 - y1) * 0.5; |
498 | + } |
499 | + if(obj.type == "Entity") { |
500 | + //Draw Local Graphic |
501 | + drawrect(x1, y1, x2, y2, "#000"); |
502 | + if(obj.kind == "Weak") { |
503 | + drawrect(x1 + 5, y1 + 5, x2 - 5, y2 - 5, "#000"); |
504 | + cliptext(x1 + 5, y1 + 5, x2 - 5, y2 - 5, obj.name, "20px Calibri", "center", 8, 6, "#000", 1, 0); |
505 | + |
506 | + } else { |
507 | + cliptext(x1, y1, x2, y2, obj.name, "20px Calibri", "center", 8, 6, "#000", 1, 0); |
508 | + } |
509 | + // Draw Select Marker |
510 | + if(Sel || Cont) { |
511 | + fourpoints(x1, y1 + ry, x2, y1 + ry, x1 + rx, y1, x1 + rx, y2, "#5f8"); |
512 | + } |
513 | + } else if(obj.type == "ERAttribute") { |
514 | + drawellipse(x1, y1, x2, y2); |
515 | + if(obj.kind == "Key") { |
516 | + cliptext(x1, y1, x2, y2, obj.name, "20px Calibri", "center", 8, 6, "#000", 2, 1); |
517 | + } else { |
518 | + cliptext(x1, y1, x2, y2, obj.name, "20px Calibri", "center", 8, 6, "#000", 2, 0); |
519 | + } |
520 | + if(obj.DrawtoID != "None") { |
521 | + drawline(obj.DrawX1, obj.DrawY1, obj.DrawX2, obj.DrawY2, "#000", 2.0); |
522 | + } |
523 | + // Draw Select Marker |
524 | + if(Cont && obj.DrawtoID == "None") { |
525 | + fourpoints(x1, y1 + ry, x2, y1 + ry, x1 + rx, y1, x1 + rx, y2, "#fa2"); |
526 | + } else if(Sel || (Cont && obj.DrawtoID != "None")) { |
527 | + fourpoints(x1, y1 + ry, x2, y1 + ry, x1 + rx, y1, x1 + rx, y2, "#5f8"); |
528 | + } |
529 | + } else if(obj.type == "ERRel") { |
530 | + if(obj.DrawtoID != "None") { |
531 | + drawline(obj.DrawX1, obj.DrawY1, obj.DrawX2, obj.DrawY2, "#000", 2.0); |
532 | + drawcardinality(obj.DrawX2, obj.DrawY2, obj.DrawtoSide, obj.DrawtoCard, obj.DrawtoXoffsCard, obj.DrawtoYoffsCard, "20px Calibri", 20, 1, "#0a0"); |
533 | + drawcardinality(obj.DrawX2, obj.DrawY2, obj.DrawtoSide, obj.DrawtoRole, obj.DrawtoXoffsRole, obj.DrawtoYoffsRole, "20px Calibri", 20, 2, "#0a0"); |
534 | +// function drawcardinality(x,y,side,tex,xoffs,yoffs,font,baseline,sign,color) |
535 | +// if(i==5) obj = jQuery.parseJSON('{"type":"ERRel","id":"REL6","kind":"Strong","name":"FGFool","x1":460,"y1":160,"x2":520,"y2":220, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"0", "DrawtoCard":"N", "DrawtoRole":"Fumo", "DrawtoXoffsCard":"20", "DrawtoYoffsCard":"50","DrawtoXoffsRole":"20", "DrawtoYoffsRole":"-50", "DrawtoIDDest":"None", "DrawfromSideDest":"None","DrawtoSideDest":"None", "DrawtoPercDest":"0", "DrawtoDestCard":"1", "DrawtoDestRole":"Luma", "DrawtoDestXoffsCard":"0", "DrawtoDestYoffsCard":"-50","DrawtoDestXoffsRole":"0", "DrawtoDestYoffsRole":"-50", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":"","DrawX3":"", "DrawY3":"", "DrawX4":"","DrawY4":""}'); |
536 | +// if(i==6) obj = jQuery.parseJSON('{"type":"ERRel","id":"REL7","kind":"Weak","name":"PODrool","x1":360,"y1":360,"x2":420,"y2":420, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"0", "DrawtoCard":"1", "DrawtoRole":"Kumo", "DrawtoXoffsCard":"60", "DrawtoYoffsCard":"70", "DrawtoXoffsCard":"80", "DrawtoYoffsCard":"-70", "DrawtoIDDest":"None", "DrawfromSideDest":"None","DrawtoSideDest":"None", "DrawtoPercDest":"0", "DrawtoDestCard":"N", "DrawtoDestRole":"Zuuma", "DrawtoDestXoffsCard":"40", "DrawtoDestYoffsCard":"50", "DrawtoDestXoffsRole":"40", "DrawtoDestYoffsRole":"50", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":"","DrawX3":"", "DrawY3":"", "DrawX4":"","DrawY4":""}'); |
537 | + } |
538 | + if(obj.DrawtoIDDest != "None") { |
539 | + drawline(obj.DrawX3, obj.DrawY3, obj.DrawX4, obj.DrawY4, "#000", 2.0); |
540 | + } |
541 | + if(obj.kind == "Weak") { |
542 | + drawdiamond(x1 - 4, y1 - 4, x2 + 4, y2 + 4); |
543 | + drawdiamond(x1 + 4, y1 + 4, x2 - 4, y2 - 4); |
544 | + cliptext(x1 + 8, y1 + 8, x2 - 8, y2 - 8, obj.name, "20px Calibri", "center", 8, 6, "#000", 3, 0); |
545 | + } else { |
546 | + drawdiamond(x1, y1, x2, y2, 0); |
547 | + cliptext(x1, y1, x2, y2, obj.name, "20px Calibri", "center", 8, 6, "#000", 3, 0); |
548 | + } |
549 | + // Draw Select Markers |
550 | + if(Sel || (Cont && obj.DrawtoID != "None" && obj.DrawtoIDDest != "None")) { |
551 | + fourpoints(x1, y1 + ry, x2, y1 + ry, x1 + rx, y1, x1 + rx, y2, "#5f8"); |
552 | + } else if(Cont) { |
553 | + if(obj.DrawfromSide != 1 && obj.DrawfromSideDest != 1) { |
554 | + point(x1, y1 + ry, "#fa2"); |
555 | + } |
556 | + if(obj.DrawfromSide != 2 && obj.DrawfromSideDest != 2) { |
557 | + point(x1 + rx, y2, "#fa2"); |
558 | + } |
559 | + if(obj.DrawfromSide != 3 && obj.DrawfromSideDest != 3) { |
560 | + point(x2, y1 + ry, "#fa2"); |
561 | + } |
562 | + if(obj.DrawfromSide != 4 && obj.DrawfromSideDest != 4) { |
563 | + point(x1 + rx, y1, "#fa2"); |
564 | + } |
565 | + } |
566 | + } |
567 | + } |
568 | + importdata(); |
569 | + |
570 | + /* |
571 | + * |
572 | + */ |
573 | + function foo() { |
574 | + context.clearRect(0, 0, 600, 600); |
575 | +// overline(gridx,gridy,150,550,550,300,8.0); |
576 | + // Draw grid lines |
577 | + context.strokeStyle = '#ddd'; |
578 | + context.lineWidth = 0.5; |
579 | + context.beginPath(); |
580 | + for(i = 0; i < 600; i += 20) { |
581 | + context.moveTo(i, 0); |
582 | + context.lineTo(i, 600); |
583 | + context.moveTo(0, i); |
584 | + context.lineTo(600, i); |
585 | + } |
586 | + context.stroke(); |
587 | + // Draw drawing line |
588 | + if(drawlinekind == 1) { |
589 | + drawline(drawlinesx, drawlinesy, drawlinedx, drawlinedy, "#000", 1.0); |
590 | + } |
591 | + // Prepare model objects |
592 | + for(i = 0; i < Identifiers.length; i++){ |
593 | + var objid = Identifiers[i]; |
594 | + prepareobj(objid); |
595 | + } |
596 | + // Draw model objects |
597 | + for(i = 0; i < Identifiers.length; i++){ |
598 | + var objid = Identifiers[i]; |
599 | + drawobj(objid); |
600 | + } |
601 | + // Draw Crosshair |
602 | + context.beginPath(); |
603 | + context.strokeStyle = '#444'; |
604 | + context.lineWidth = 1.0; |
605 | + context.moveTo(gridx - gridsize, gridy); |
606 | + context.lineTo(gridx + gridsize, gridy); |
607 | + context.moveTo(gridx, gridy - gridsize); |
608 | + context.lineTo(gridx, gridy + gridsize); |
609 | + context.stroke(); |
610 | + context.strokeStyle = '#ddd'; |
611 | + context.fillStyle = '#000'; |
612 | + context.font = "bold 16px Arial"; |
613 | + context.textAlign = "left"; |
614 | + context.fillText("currop: " + printstr, 20, 576); |
615 | + setTimeout("foo();", 100); |
616 | + } |
617 | \ No newline at end of file |
618 | |
619 | === modified file 'ErModeller/canvas_ER_demo_duggajs.html' |
620 | --- ErModeller/canvas_ER_demo_duggajs.html 2013-04-02 07:26:15 +0000 |
621 | +++ ErModeller/canvas_ER_demo_duggajs.html 2013-04-03 11:33:22 +0000 |
622 | @@ -1,627 +1,25 @@ |
623 | +<!DOCTYPE html> |
624 | <html> |
625 | <head> |
626 | - <script type="text/javascript" src="jquery.js"></script> |
627 | - <script lang='Javascript'> |
628 | - var startx = 0; |
629 | - var starty = 0; |
630 | - var deltax = 0; |
631 | - var deltay = 0; |
632 | - var gridsize = 20; |
633 | - // Multi-select move offset |
634 | - var offsx = 0; |
635 | - var offsy = 0; |
636 | - // Drawing Globals -- For while in transit drawing |
637 | - var drawlinesx; |
638 | - var drawlinesy; |
639 | - var drawlinedx; |
640 | - var drawlinedy; |
641 | - var drawlinekind = 0; |
642 | - // List of objects |
643 | - // List of identifiers |
644 | - // List of selected object identifiers |
645 | - // The context object |
646 | - var Objects = new Array(); |
647 | - var Selected = new Array(); |
648 | - var Identifiers = new Array(); |
649 | - var ContextObj; |
650 | - // Mouse Down Result |
651 | - var downRes; |
652 | - // User Interface Mode Variables |
653 | - var multiselect = 0; |
654 | - var dragsensitivity = 12; |
655 | - var sidetol = 12; |
656 | - var printstr; |
657 | - |
658 | - /* |
659 | - User interface callbacks |
660 | - */ |
661 | - function handler_mouseup() |
662 | - { |
663 | - if(clickstate == 1) { |
664 | - // Either select on/off for multi or single select |
665 | - if(multiselect) { |
666 | - if(Selected[downRes.objid]) { |
667 | - Selected[downRes.objid] = false; |
668 | - } else { |
669 | - Selected[downRes.objid] = true; |
670 | - } |
671 | - } else { |
672 | - if(ContextObj == downRes.objid) { |
673 | - ContextObj = ""; |
674 | - } else { |
675 | - ContextObj = downRes.objid; |
676 | - } |
677 | - } |
678 | - } else if(clickstate == 8) { |
679 | - // Draw Attribute Line |
680 | - upRes=mouseover(gridx,gridy); |
681 | - if(upRes.code != "None") { |
682 | - obj = Objects[downRes.objid]; |
683 | - if(upRes.typ == "ERAttribute" || upRes.typ == "Entity" || upRes.typ == "ERRel") { |
684 | - obj.DrawtoID = upRes.objid; |
685 | - obj.DrawfromSide = downRes.side; |
686 | - if(upRes.side != "None") { |
687 | - obj.DrawtoSide = upRes.side; |
688 | - obj.DrawtoPerc = upRes.sideperc; |
689 | - } else { |
690 | - upobj = Objects[downRes.objid]; |
691 | - var sid = 1; |
692 | - var perco = 0.5; |
693 | - var x1g = Math.abs(upRes.x1 - gridx); |
694 | - var x2g = Math.abs(upRes.x2 - gridx); |
695 | - var y1g = Math.abs(upRes.y1 - gridy); |
696 | - var y2g = Math.abs(upRes.y2 - gridy); |
697 | - if(x1g <= x2g && x1g <= y1g && x1g <= y2g){ |
698 | - sid = 1; |
699 | - perco = makesideperc(gridy, upRes.y1, upRes.y2); |
700 | - } else if(x2g <= x1g && x2g <= y1g && x2g <= y2g){ |
701 | - sid = 3; |
702 | - perco = makesideperc(gridy, upRes.y1, upRes.y2); |
703 | - } else if(y1g <= x1g && y1g <= x2g && y1g <= y2g){ |
704 | - sid = 4; |
705 | - perco = makesideperc(gridx, upRes.x1, upRes.x2); |
706 | - } else if(y2g <= x1g && y2g <= x2g && y2g <= y1g){ |
707 | - sid = 2; |
708 | - perco = makesideperc(gridx, upRes.x1, upRes.x2); |
709 | - } |
710 | - obj.DrawtoSide = sid; |
711 | - obj.DrawtoPerc = perco; |
712 | - } |
713 | - if(upRes.typ == "ERAttribute" || upRes.typ == "ERRel") obj.DrawtoPerc = 0.5; |
714 | - } |
715 | - } |
716 | - } else if(clickstate == 9) { |
717 | - // Draw Relationship line |
718 | - upRes = mouseover(gridx, gridy); |
719 | - if(upRes.code != "None") { |
720 | - obj = Objects[downRes.objid]; |
721 | - if(upRes.side != "None") { |
722 | - if(obj.DrawtoID == "None") { |
723 | - obj.DrawtoID = upRes.objid; |
724 | - obj.DrawtoSide = upRes.side; |
725 | - obj.DrawtoPerc = upRes.sideperc; |
726 | - obj.DrawfromSide = downRes.side; |
727 | - } else { |
728 | - obj.DrawtoIDDest = upRes.objid; |
729 | - obj.DrawtoSideDest = upRes.side; |
730 | - obj.DrawtoPercDest = upRes.sideperc; |
731 | - obj.DrawfromSideDest = downRes.side; |
732 | - } |
733 | - } else { |
734 | - upobj = Objects[downRes.objid]; |
735 | - var sid = 1; |
736 | - var perco = 0.5; |
737 | - var x1g = Math.abs(upRes.x1-gridx); |
738 | - var x2g = Math.abs(upRes.x2-gridx); |
739 | - var y1g = Math.abs(upRes.y1-gridy); |
740 | - var y2g = Math.abs(upRes.y2-gridy); |
741 | - if(x1g <= x2g && x1g <= y1g && x1g <= y2g) { |
742 | - sid = 1; |
743 | - perco = makesideperc(gridy, upRes.y1, upRes.y2); |
744 | - } else if(x2g <= x1g && x2g <= y1g && x2g <= y2g) { |
745 | - sid = 3; |
746 | - perco = makesideperc(gridy, upRes.y1, upRes.y2); |
747 | - } else if(y1g <= x1g && y1g <= x2g && y1g <= y2g) { |
748 | - sid = 4; |
749 | - perco = makesideperc(gridx, upRes.x1, upRes.x2); |
750 | - } else if(y2g <= x1g && y2g <= x2g && y2g <= y1g){ |
751 | - sid = 2; |
752 | - perco = makesideperc(gridx, upRes.x1, upRes.x2); |
753 | - } |
754 | - if(obj.DrawtoID == "None") { |
755 | - obj.DrawtoID = upRes.objid; |
756 | - obj.DrawtoSide = sid; |
757 | - obj.DrawtoPerc = perco; |
758 | - obj.DrawfromSide = downRes.side; |
759 | - } else { |
760 | - obj.DrawtoIDDest = upRes.objid; |
761 | - obj.DrawtoSideDest = sid; |
762 | - obj.DrawtoPercDest = perco; |
763 | - obj.DrawfromSideDest = downRes.side; |
764 | - } |
765 | - } |
766 | - } |
767 | - } |
768 | - clickstate = 0; |
769 | - cpsel = 0; |
770 | - drawlinekind = 0; |
771 | - } |
772 | - /* |
773 | - * Mouse down state |
774 | - */ |
775 | - function handler_mousedown() { |
776 | - clickstate = 1; |
777 | - downRes = mouseover(gridx, gridy); |
778 | - startx = gridx; |
779 | - starty = gridy; |
780 | - } |
781 | - |
782 | - /* |
783 | - * Mouse move |
784 | - */ |
785 | - function handler_mousemove(cx, cy) { |
786 | -// gridx=Math.round((cx-(gridsize/2.0))/gridsize)*gridsize; |
787 | -// gridy=Math.round((cy-(gridsize/2.0))/gridsize)*gridsize; |
788 | - gridx = cx; |
789 | - gridy = cy; |
790 | - deltax = startx - gridx; |
791 | - deltay = starty - gridy; |
792 | - // We start drag mode |
793 | - if((distance(gridx, gridy, startx, starty) > dragsensitivity) && clickstate == 1) { |
794 | - clickstate = 2; |
795 | - } |
796 | - // We are in drag mode |
797 | - if(clickstate == 2) { |
798 | - // Single Object Move - If Not Selected, Or if Selected and Center Area Is Dragged |
799 | - if((downRes.typ == "Entity" || downRes.typ == "ERAttribute" || downRes.typ == "ERRel") && (downRes.code == "NonSel" || (downRes.code == "Cont" && downRes.side == "None") || (downRes.code == "ContDraw" && downRes.side == "None"))) { |
800 | - clickstate = 3; |
801 | - } |
802 | - // Single Object Scale Left |
803 | - if((downRes.typ == "Entity" || downRes.typ == "ERAttribute") && (downRes.code == "Cont" && downRes.side == "1")) { |
804 | - clickstate=4; |
805 | - } |
806 | - // Single Object Scale Bottom |
807 | - if((downRes.typ == "Entity" || downRes.typ == "ERAttribute") && (downRes.code == "Cont" && downRes.side == "2")) { |
808 | - clickstate=5; |
809 | - } |
810 | - // Single Object Scale Right |
811 | - if((downRes.typ == "Entity" || downRes.typ == "ERAttribute") && (downRes.code == "Cont" && downRes.side == "3")) { |
812 | - clickstate=6; |
813 | - } |
814 | - // Single Object Scale Top |
815 | - if((downRes.typ == "Entity" || downRes.typ == "ERAttribute") && (downRes.code == "Cont" && downRes.side == "4")) { |
816 | - clickstate=7; |
817 | - } |
818 | - if(downRes.typ == "ERAttribute" && downRes.code == "ContDraw" && downRes.side != "None") { |
819 | - clickstate=8; // Attribute Connection Draw |
820 | - drawlinekind=1; // Tell drawing engine to draw attribute line symbol |
821 | - if(downRes.side == "1") { |
822 | - drawlinesx = downRes.x1; // Initiate start parameters for line drawing left side |
823 | - drawlinesy = downRes.y1 + ((downRes.y2 - downRes.y1) * 0.5); |
824 | - } else if(downRes.side == "2") { |
825 | - drawlinesx = downRes.x1 + ((downRes.x2 - downRes.x1) * 0.5); // Initiate start parameters for line drawing bottom side |
826 | - drawlinesy = downRes.y2; |
827 | - } else if(downRes.side == "3") { |
828 | - drawlinesx = downRes.x2; // Initiate start parameters for line drawing left side |
829 | - drawlinesy = downRes.y1 + ((downRes.y2 - downRes.y1) * 0.5); |
830 | - } else if(downRes.side == "4") { |
831 | - drawlinesx = downRes.x1 + ((downRes.x2 - downRes.x1) * 0.5); // Initiate start parameters for line drawing bottom side |
832 | - drawlinesy = downRes.y1; |
833 | - } |
834 | - drawlinedx = drawlinesx; |
835 | - drawlinedy = drawlinesy; |
836 | - } |
837 | - if(downRes.typ == "ERRel" && downRes.code == "ContDraw" && downRes.side != "None") { |
838 | - var obj=Objects[downRes.objid]; |
839 | - if(downRes.side != obj.DrawfromSide && downRes.side != obj.DrawfromSideDest) { |
840 | - clickstate = 9; // Attribute Connection Draw |
841 | - drawlinekind = 1; // Tell drawing engine to draw relation line symbol |
842 | - if(downRes.side == "1") { |
843 | - drawlinesx = downRes.x1; // Initiate start parameters for line drawing left side |
844 | - drawlinesy = downRes.y1 + ((downRes.y2 - downRes.y1) * 0.5); |
845 | - } else if(downRes.side == "2") { |
846 | - drawlinesx = downRes.x1 + ((downRes.x2 - downRes.x1) * 0.5); // Initiate start parameters for line drawing bottom side |
847 | - drawlinesy = downRes.y2; |
848 | - } else if(downRes.side == "3") { |
849 | - drawlinesx = downRes.x2; // Initiate start parameters for line drawing left side |
850 | - drawlinesy = downRes.y1 + ((downRes.y2 - downRes.y1) * 0.5); |
851 | - } else if(downRes.side == "4") { |
852 | - drawlinesx = downRes.x1 + ((downRes.x2 - downRes.x1) * 0.5); // Initiate start parameters for line drawing bottom side |
853 | - drawlinesy = downRes.y1; |
854 | - } |
855 | - drawlinedx = drawlinesx; |
856 | - drawlinedy = drawlinesy; |
857 | - } |
858 | - } |
859 | - } |
860 | - if(clickstate > 2) { |
861 | - var obj = Objects[downRes.objid]; |
862 | - } |
863 | - if(clickstate == 3) { // We are in single rectangular object move |
864 | - obj.x1 = downRes.x1 - deltax; |
865 | - obj.y1 = downRes.y1 - deltay; |
866 | - obj.x2 = downRes.x2 - deltax; |
867 | - obj.y2 = downRes.y2 - deltay; |
868 | - } else if(clickstate == 4) { // We are in single rectangular object scale left |
869 | - if((obj.x2 - downRes.x1 + deltax) > 60) obj.x1 = downRes.x1 - deltax; |
870 | - } else if(clickstate == 5) { // We are in single rectangular object scale bottom |
871 | - if((downRes.y2 - obj.y1 - deltay) > 40) obj.y2 = downRes.y2 - deltay; |
872 | - } else if(clickstate==6) { // We are in single rectangular object scale right |
873 | - if((downRes.x2 - obj.x1 - deltax) > 60) obj.x2 = downRes.x2 - deltax; |
874 | - } else if(clickstate == 7) { // We are in single rectangular object scale top |
875 | - if((obj.y2 - downRes.y1 + deltay) > 40) obj.y1 = downRes.y1 - deltay; |
876 | - } else if(clickstate == 8 || clickstate == 9) { // We are in straight connective line drawing mode |
877 | - drawlinedx = gridx; |
878 | - drawlinedy = gridy; |
879 | - } |
880 | - } |
881 | - |
882 | - /* |
883 | - * Call-forward for mouse-over event |
884 | - */ |
885 | - function mouseover(x, y) { |
886 | - // Code of touch, and if available object id and id of side of object that was touched |
887 | - // Tolerances included as constant |
888 | - var obj_code = "None"; |
889 | - var obj_id = "None"; |
890 | - var obj_sidentifier =" None"; |
891 | - var obj_sideperc = 0; |
892 | - var obj_centerdist = 0; |
893 | - var obj_type = "None"; |
894 | - var obj_x1 = 0; |
895 | - var obj_y1 = 0; |
896 | - var obj_x2 = 0; |
897 | - var obj_y2 = 0; |
898 | - var Cont; |
899 | - var found = 0; |
900 | - var side; |
901 | - for(j = 0; j < Identifiers.length; j++) { |
902 | - var objid = Identifiers[j]; |
903 | - var obj = Objects[objid]; |
904 | - var Sel = Selected[objid]; |
905 | - if(ContextObj == objid) { |
906 | - Cont = 1; |
907 | - } else { |
908 | - Cont = 0; |
909 | - } |
910 | - // Compute coordinates including offset |
911 | - if(obj.type == "Entity" || obj.type == "ERAttribute" || obj.type == "ERRel") { |
912 | - x1 = obj.x1 + offsx; |
913 | - y1 = obj.y1 + offsy; |
914 | - x2 = obj.x2 + offsx; |
915 | - y2 = obj.y2 + offsy; |
916 | - rx = (x2 - x1) * 0.5; |
917 | - ry = (y2 - y1) * 0.5; |
918 | - } |
919 | - found = 0; |
920 | - // For each kind of clickable object, check if we are inside object and if so assign variables |
921 | - // Any general properties for all object types are set when "found" is true |
922 | - if(obj.type == "Entity") { |
923 | - if(x > (x1 - sidetol) && y > (y1 - sidetol ) && x < (x2 + sidetol) && y < (y2 + sidetol)) { |
924 | - obj_code = "NonSel"; |
925 | - if(Sel) { |
926 | - obj_code = "Sel"; |
927 | - } |
928 | - if(Cont) { |
929 | - obj_code = "Cont"; |
930 | - } |
931 | - side = computeside(x, y, x1, y1, x2, y2, sidetol); |
932 | - obj_sidentifier = side.side; |
933 | - obj_sideperc = side.perc; |
934 | - obj_centerdist = side.dist; |
935 | - found = 1; |
936 | - } |
937 | - } else if(obj.type=="ERAttribute") { |
938 | - if(x > (x1 - sidetol) && y > (y1 - sidetol) && x < (x2 + sidetol) && y < (y2 + sidetol)) { |
939 | - obj_code = "NonSel"; |
940 | - if(Sel) { |
941 | - obj_code="Sel"; |
942 | - } |
943 | - if(Cont) { |
944 | - if(obj.DrawtoID == "None") { |
945 | - obj_code = "ContDraw"; |
946 | - } else { |
947 | - obj_code = "Cont"; |
948 | - } |
949 | - } |
950 | - side = computeside(x, y, x1, y1, x2, y2, sidetol); |
951 | - obj_sidentifier = side.side; |
952 | - obj_sideperc = side.perc; |
953 | - obj_centerdist = side.dist; |
954 | - found = 1; |
955 | - } |
956 | - } else if(obj.type == "ERRel") { |
957 | - if(x > (x1 - sidetol) && y > (y1 - sidetol) && x < (x2 + sidetol) && y < (y2 + sidetol)) { |
958 | - xk = x - x1; |
959 | - // Colision detection against diamond |
960 | - var inside = 0; |
961 | - if(xk <= rx) { |
962 | - if(y > (y1 + ry - xk - sidetol) && y < (y1 + ry + xk + sidetol)) { |
963 | - inside = 1; |
964 | - } |
965 | - } else { |
966 | - if(y > (y1 - rx + xk - sidetol) && y < ( y2 + rx - xk + sidetol)) { |
967 | - inside = 1; |
968 | - } |
969 | - } |
970 | - if(inside) { |
971 | - if((x > (x1 - sidetol)) && (x < (x1 + sidetol)) && (y > (y1 + ry - sidetol)) && (y < (y1 + ry + sidetol))) { |
972 | - obj_sidentifier = 1; |
973 | - } |
974 | - if((x > (x1 + rx - sidetol)) && (x < (x1 + rx + sidetol)) && (y > (y2 - sidetol)) && (y < (y2 + sidetol))) { |
975 | - obj_sidentifier = 2; |
976 | - } |
977 | - if((x > (x2 - sidetol)) && (x < (x2 + sidetol)) && (y > (y1 + ry - sidetol)) && (y < (y1 + ry + sidetol))) { |
978 | - obj_sidentifier = 3; |
979 | - } |
980 | - if((x > (x1 + rx - sidetol)) && (x < (x1 + rx + sidetol)) && (y > (y1 - sidetol)) && (y < (y1 + sidetol))) { |
981 | - obj_sidentifier = 4; |
982 | - } |
983 | - obj_code = "NonSel"; |
984 | - if(Sel) { |
985 | - obj_code = "Sel"; |
986 | - } |
987 | - if(Cont) { |
988 | - if(obj.DrawtoID == "None"){ |
989 | - obj_code = "ContDraw"; |
990 | - } else if(obj.DrawtoIDDest == "None") { |
991 | - obj_code = "ContDraw"; |
992 | - } else { |
993 | - obj_code = "Cont"; |
994 | - } |
995 | - } |
996 | - obj_sideperc = 0.5; |
997 | - found = 1; |
998 | - } |
999 | - } |
1000 | - } |
1001 | - if(found == 1) { |
1002 | - // Save coordinates at time of click |
1003 | - obj_x1 = x1; |
1004 | - obj_y1 = y1; |
1005 | - obj_x2 = x2; |
1006 | - obj_y2 = y2; |
1007 | - obj_id = objid; |
1008 | - obj_type = obj.type; |
1009 | - printstr=obj_id + " " + obj_sidentifier + " " + obj_sideperc; |
1010 | - } |
1011 | - } |
1012 | - return { |
1013 | - objid:obj_id, |
1014 | - code:obj_code, |
1015 | - side:obj_sidentifier, |
1016 | - sideperc:obj_sideperc, |
1017 | - centerdist:obj_centerdist, |
1018 | - typ:obj_type, |
1019 | - x1:obj_x1, |
1020 | - y1:obj_y1, |
1021 | - x2:obj_x2, |
1022 | - y2:obj_y2 |
1023 | - } |
1024 | - } |
1025 | - |
1026 | - /* |
1027 | - * |
1028 | - */ |
1029 | - function importdata() { |
1030 | - for(i = 0; i < 7; i++) { |
1031 | - if(i == 0) { |
1032 | - obj = jQuery.parseJSON('{"type":"ERAttribute","id":"ATT1","kind":"Multiple","name":"Addressfosoppooo","x1":220,"y1":100,"x2":300,"y2":140, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"None", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":""}'); |
1033 | - } |
1034 | - if(i == 1) { |
1035 | - obj = jQuery.parseJSON('{"type":"Entity","id":"ENT2","kind":"Weak","name":"Carsmashoepppoloo","x1":100,"y1":160,"x2":220,"y2":220}'); |
1036 | - } |
1037 | - if(i == 2) { |
1038 | - obj = jQuery.parseJSON('{"type":"ERAttribute","id":"ATT3","kind":"Key","name":"SSNFooomesPoo","x1":160,"y1":260,"x2":260,"y2":300, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"None", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":""}'); |
1039 | - } |
1040 | - if(i == 3) { |
1041 | - obj = jQuery.parseJSON('{"type":"Entity","id":"ENT4","kind":"Strong","name":"Trailerfpdddpeoooooe","x1":320,"y1":260,"x2":420,"y2":320}'); |
1042 | - } |
1043 | - if(i == 4) { |
1044 | - obj = jQuery.parseJSON('{"type":"Entity","id":"ENT5","kind":"Strong","name":"Grail","x1":120,"y1":440,"x2":220,"y2":480}'); |
1045 | - } |
1046 | - if(i == 5) { |
1047 | - obj = jQuery.parseJSON('{"type":"ERRel","id":"REL6","kind":"Strong","name":"FGFool","x1":460,"y1":160,"x2":520,"y2":220, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"0", "DrawtoCard":"N", "DrawtoRole":"Fumo", "DrawtoXoffs":"20", "DrawtoYoffs":"50", "DrawtoIDDest":"None", "DrawfromSideDest":"None","DrawtoSideDest":"None", "DrawtoPercDest":"0", "DrawtoDestCard":"N", "DrawtoDestRole":"Luma", "DrawtoDestXoffs":"0", "DrawtoDestYoffs":"-50", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":"","DrawX3":"", "DrawY3":"", "DrawX4":"","DrawY4":""}'); |
1048 | - } |
1049 | - if(i == 6) { |
1050 | - obj = jQuery.parseJSON('{"type":"ERRel","id":"REL7","kind":"Weak","name":"PODrool","x1":360,"y1":360,"x2":420,"y2":420, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"0", "DrawtoCard":"N", "DrawtoRole":"Kumo", "DrawtoXoffs":"60", "DrawtoYoffs":"70", "DrawtoIDDest":"None", "DrawfromSideDest":"None","DrawtoSideDest":"None", "DrawtoPercDest":"0", "DrawtoDestCard":"N", "DrawtoDestRole":"Zuuma", "DrawtoDestXoffs":"40", "DrawtoDestYoffs":"50", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":"","DrawX3":"", "DrawY3":"", "DrawX4":"","DrawY4":""}'); |
1051 | - } |
1052 | - objid = obj.id; |
1053 | - Objects[objid] = obj; |
1054 | - Identifiers.push(objid); |
1055 | - } |
1056 | - } |
1057 | - |
1058 | - /* |
1059 | - * prepareobj |
1060 | - * Prepares all kinds of objects, with local movement-offset (scrolling offset is handled with transforms??) |
1061 | - * Ofss in prepare are not finished. |
1062 | - */ |
1063 | - function prepareobj(obji) { |
1064 | - var fromobj = Objects[obji]; |
1065 | - // Attributes are prepared by re-pointing the DrawX1, DrawY1, DrawX2 and DrawY2 variables and Relationships are prepared by re-pointing DrawX1-DrawX4 and DrawY1-DrawY4 |
1066 | - if((fromobj.type == "ERAttribute" || fromobj.type == "ERRel") && fromobj.DrawtoID != "None") { |
1067 | - var toid = fromobj.DrawtoID; |
1068 | - var toobj = Objects[toid]; |
1069 | - var sidek; |
1070 | - if(fromobj.DrawtoIDDest != "None" && fromobj.DrawtoIDDest != undefined) { |
1071 | - var toiddest = fromobj.DrawtoIDDest; |
1072 | - var toobjdest = Objects[toiddest]; |
1073 | - sidek = makeside(fromobj.DrawfromSideDest, fromobj.x1, fromobj.y1, fromobj.x2, fromobj.y2, 0.5); |
1074 | - fromobj.DrawX3 = sidek.x; |
1075 | - fromobj.DrawY3 = sidek.y; |
1076 | - sidek = makeside(fromobj.DrawtoSideDest, toobjdest.x1, toobjdest.y1, toobjdest.x2, toobjdest.y2, fromobj.DrawtoPercDest); |
1077 | - fromobj.DrawX4 = sidek.x; |
1078 | - fromobj.DrawY4 = sidek.y; |
1079 | - } |
1080 | - //printstr=fromobj.DrawfromSide+" "+fromobj.x1+" "+fromobj.y1+" "+fromobj.x2+" "+fromobj.y2+" :: "+fromobj.DrawtoSide+" "+toobj.x1+" "+toobj.y1+" "+toobj.x2+" "+toobj.y2+" "+fromobj.DrawtoPerc; |
1081 | - sidek = makeside(fromobj.DrawfromSide, fromobj.x1, fromobj.y1, fromobj.x2, fromobj.y2, 0.5); |
1082 | - fromobj.DrawX1 = sidek.x; |
1083 | - fromobj.DrawY1 = sidek.y; |
1084 | - sidek = makeside(fromobj.DrawtoSide, toobj.x1, toobj.y1, toobj.x2, toobj.y2, fromobj.DrawtoPerc); |
1085 | - fromobj.DrawX2 = sidek.x; |
1086 | - fromobj.DrawY2 = sidek.y; |
1087 | - } |
1088 | - } |
1089 | - |
1090 | - /* |
1091 | - * Drawobj |
1092 | - * Draws all kinds of objects, with local movement-offset (scrolling offset is handled with transforms??) |
1093 | - */ |
1094 | - function drawobj(obji) { |
1095 | - var obj = Objects[obji]; |
1096 | - var Sel = Selected[obji]; |
1097 | - if(ContextObj == obji) { |
1098 | - Cont = 1; |
1099 | - } else { |
1100 | - Cont = 0; |
1101 | - } |
1102 | - context.strokeStyle = '#000'; |
1103 | - context.lineWidth = 2.0; |
1104 | - // Compute coordinates including offset |
1105 | - if(obj.type == "Entity" || obj.type == "ERAttribute" || obj.type == "ERRel") { |
1106 | - x1 = obj.x1 + offsx; |
1107 | - y1 = obj.y1 + offsy; |
1108 | - x2 = obj.x2 + offsx; |
1109 | - y2 = obj.y2 + offsy; |
1110 | - rx = (x2 - x1) * 0.5; |
1111 | - ry = (y2 - y1) * 0.5; |
1112 | - } |
1113 | - if(obj.type == "Entity") { |
1114 | - //Draw Local Graphic |
1115 | - drawrect(x1, y1, x2, y2, "#000"); |
1116 | - if(obj.kind == "Weak") { |
1117 | - drawrect(x1 + 5, y1 + 5, x2 - 5, y2 - 5, "#000"); |
1118 | - cliptext(x1 + 5, y1 + 5, x2 - 5, y2 - 5, obj.name, "20px Calibri", "center", 8, 6, "#000", 1, 0); |
1119 | - |
1120 | - } else { |
1121 | - cliptext(x1, y1, x2, y2, obj.name, "20px Calibri", "center", 8, 6, "#000", 1, 0); |
1122 | - } |
1123 | - // Draw Select Marker |
1124 | - if(Sel || Cont) { |
1125 | - fourpoints(x1, y1 + ry, x2, y1 + ry, x1 + rx, y1, x1 + rx, y2, "#5f8"); |
1126 | - } |
1127 | - } else if(obj.type == "ERAttribute") { |
1128 | - drawellipse(x1, y1, x2, y2); |
1129 | - if(obj.kind == "Key") { |
1130 | - cliptext(x1, y1, x2, y2, obj.name, "20px Calibri", "center", 8, 6, "#000", 2, 1); |
1131 | - } else { |
1132 | - cliptext(x1, y1, x2, y2, obj.name, "20px Calibri", "center", 8, 6, "#000", 2, 0); |
1133 | - } |
1134 | - if(obj.DrawtoID != "None") { |
1135 | - drawline(obj.DrawX1, obj.DrawY1, obj.DrawX2, obj.DrawY2, "#000", 2.0); |
1136 | - } |
1137 | - // Draw Select Marker |
1138 | - if(Cont && obj.DrawtoID == "None") { |
1139 | - fourpoints(x1, y1 + ry, x2, y1 + ry, x1 + rx, y1, x1 + rx, y2, "#fa2"); |
1140 | - } else if(Sel || (Cont && obj.DrawtoID != "None")) { |
1141 | - fourpoints(x1, y1 + ry, x2, y1 + ry, x1 + rx, y1, x1 + rx, y2, "#5f8"); |
1142 | - } |
1143 | - } else if(obj.type == "ERRel") { |
1144 | - if(obj.DrawtoID != "None") { |
1145 | - drawline(obj.DrawX1, obj.DrawY1, obj.DrawX2, obj.DrawY2, "#000", 2.0); |
1146 | - drawcardinality(obj.DrawX2, obj.DrawY2, obj.DrawtoSide, obj.DrawtoCard, obj.DrawtoXoffsCard, obj.DrawtoYoffsCard, "20px Calibri", 20, 1, "#0a0"); |
1147 | - drawcardinality(obj.DrawX2, obj.DrawY2, obj.DrawtoSide, obj.DrawtoRole, obj.DrawtoXoffsRole, obj.DrawtoYoffsRole, "20px Calibri", 20, 2, "#0a0"); |
1148 | -// function drawcardinality(x,y,side,tex,xoffs,yoffs,font,baseline,sign,color) |
1149 | -// if(i==5) obj = jQuery.parseJSON('{"type":"ERRel","id":"REL6","kind":"Strong","name":"FGFool","x1":460,"y1":160,"x2":520,"y2":220, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"0", "DrawtoCard":"N", "DrawtoRole":"Fumo", "DrawtoXoffsCard":"20", "DrawtoYoffsCard":"50","DrawtoXoffsRole":"20", "DrawtoYoffsRole":"-50", "DrawtoIDDest":"None", "DrawfromSideDest":"None","DrawtoSideDest":"None", "DrawtoPercDest":"0", "DrawtoDestCard":"1", "DrawtoDestRole":"Luma", "DrawtoDestXoffsCard":"0", "DrawtoDestYoffsCard":"-50","DrawtoDestXoffsRole":"0", "DrawtoDestYoffsRole":"-50", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":"","DrawX3":"", "DrawY3":"", "DrawX4":"","DrawY4":""}'); |
1150 | -// if(i==6) obj = jQuery.parseJSON('{"type":"ERRel","id":"REL7","kind":"Weak","name":"PODrool","x1":360,"y1":360,"x2":420,"y2":420, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"0", "DrawtoCard":"1", "DrawtoRole":"Kumo", "DrawtoXoffsCard":"60", "DrawtoYoffsCard":"70", "DrawtoXoffsCard":"80", "DrawtoYoffsCard":"-70", "DrawtoIDDest":"None", "DrawfromSideDest":"None","DrawtoSideDest":"None", "DrawtoPercDest":"0", "DrawtoDestCard":"N", "DrawtoDestRole":"Zuuma", "DrawtoDestXoffsCard":"40", "DrawtoDestYoffsCard":"50", "DrawtoDestXoffsRole":"40", "DrawtoDestYoffsRole":"50", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":"","DrawX3":"", "DrawY3":"", "DrawX4":"","DrawY4":""}'); |
1151 | - } |
1152 | - if(obj.DrawtoIDDest != "None") { |
1153 | - drawline(obj.DrawX3, obj.DrawY3, obj.DrawX4, obj.DrawY4, "#000", 2.0); |
1154 | - } |
1155 | - if(obj.kind == "Weak") { |
1156 | - drawdiamond(x1 - 4, y1 - 4, x2 + 4, y2 + 4); |
1157 | - drawdiamond(x1 + 4, y1 + 4, x2 - 4, y2 - 4); |
1158 | - cliptext(x1 + 8, y1 + 8, x2 - 8, y2 - 8, obj.name, "20px Calibri", "center", 8, 6, "#000", 3, 0); |
1159 | - } else { |
1160 | - drawdiamond(x1, y1, x2, y2, 0); |
1161 | - cliptext(x1, y1, x2, y2, obj.name, "20px Calibri", "center", 8, 6, "#000", 3, 0); |
1162 | - } |
1163 | - // Draw Select Markers |
1164 | - if(Sel || (Cont && obj.DrawtoID != "None" && obj.DrawtoIDDest != "None")) { |
1165 | - fourpoints(x1, y1 + ry, x2, y1 + ry, x1 + rx, y1, x1 + rx, y2, "#5f8"); |
1166 | - } else if(Cont) { |
1167 | - if(obj.DrawfromSide != 1 && obj.DrawfromSideDest != 1) { |
1168 | - point(x1, y1 + ry, "#fa2"); |
1169 | - } |
1170 | - if(obj.DrawfromSide != 2 && obj.DrawfromSideDest != 2) { |
1171 | - point(x1 + rx, y2, "#fa2"); |
1172 | - } |
1173 | - if(obj.DrawfromSide != 3 && obj.DrawfromSideDest != 3) { |
1174 | - point(x2, y1 + ry, "#fa2"); |
1175 | - } |
1176 | - if(obj.DrawfromSide != 4 && obj.DrawfromSideDest != 4) { |
1177 | - point(x1 + rx, y1, "#fa2"); |
1178 | - } |
1179 | - } |
1180 | - } |
1181 | - } |
1182 | - importdata(); |
1183 | - |
1184 | - /* |
1185 | - * |
1186 | - */ |
1187 | - function foo() { |
1188 | - context.clearRect(0, 0, 600, 600); |
1189 | -// overline(gridx,gridy,150,550,550,300,8.0); |
1190 | - // Draw grid lines |
1191 | - context.strokeStyle = '#ddd'; |
1192 | - context.lineWidth = 0.5; |
1193 | - context.beginPath(); |
1194 | - for(i = 0; i < 600; i += 20) { |
1195 | - context.moveTo(i, 0); |
1196 | - context.lineTo(i, 600); |
1197 | - context.moveTo(0, i); |
1198 | - context.lineTo(600, i); |
1199 | - } |
1200 | - context.stroke(); |
1201 | - // Draw drawing line |
1202 | - if(drawlinekind == 1) { |
1203 | - drawline(drawlinesx, drawlinesy, drawlinedx, drawlinedy, "#000", 1.0); |
1204 | - } |
1205 | - // Prepare model objects |
1206 | - for(i = 0; i < Identifiers.length; i++){ |
1207 | - var objid = Identifiers[i]; |
1208 | - prepareobj(objid); |
1209 | - } |
1210 | - // Draw model objects |
1211 | - for(i = 0; i < Identifiers.length; i++){ |
1212 | - var objid = Identifiers[i]; |
1213 | - drawobj(objid); |
1214 | - } |
1215 | - // Draw Crosshair |
1216 | - context.beginPath(); |
1217 | - context.strokeStyle = '#444'; |
1218 | - context.lineWidth = 1.0; |
1219 | - context.moveTo(gridx - gridsize, gridy); |
1220 | - context.lineTo(gridx + gridsize, gridy); |
1221 | - context.moveTo(gridx, gridy - gridsize); |
1222 | - context.lineTo(gridx, gridy + gridsize); |
1223 | - context.stroke(); |
1224 | - context.strokeStyle = '#ddd'; |
1225 | - context.fillStyle = '#000'; |
1226 | - context.font = "bold 16px Arial"; |
1227 | - context.textAlign = "left"; |
1228 | - context.fillText("currop: " + printstr, 20, 576); |
1229 | - setTimeout("foo();", 100); |
1230 | - } |
1231 | - </script> |
1232 | + <link rel="stylesheet" type="text/css" href="canvas.css"> |
1233 | + <script type="text/javascript" src="../js/jquery.js"></script> |
1234 | + <script type="text/javascript" src="canvas.js"></script> |
1235 | <script type="text/javascript" src="dugga.js"></script> |
1236 | </head> |
1237 | <body onload="setupcanvas();"> |
1238 | <table> |
1239 | <tr> |
1240 | <td> |
1241 | - <canvas id='a' width='600' height='600' style='border:2px solid black;'> |
1242 | + <canvas id='a' width='600' height='600'> |
1243 | </canvas> |
1244 | </td> |
1245 | <td valign="top"> |
1246 | - <div style="border:2px solid black;background-color:#fed;width:300;height:450;"> |
1247 | - <div id="infobox" style="padding:4px;"> |
1248 | + <div id="background"> |
1249 | + <div id="infobox"> |
1250 | Change values to update diagram.<br> |
1251 | </div> |
1252 | </div> |
1253 | - </td> |
1254 | + </td> |
1255 | </tr> |
1256 | </table> |
1257 | </body> |
1258 | |
1259 | === added file 'WebGL and Benchmarking/test1shaderstartup.css' |
1260 | --- WebGL and Benchmarking/test1shaderstartup.css 1970-01-01 00:00:00 +0000 |
1261 | +++ WebGL and Benchmarking/test1shaderstartup.css 2013-04-03 11:33:22 +0000 |
1262 | @@ -0,0 +1,2 @@ |
1263 | +#canvas {border: none;" width="400" height="400} |
1264 | +#fps {} |
1265 | \ No newline at end of file |
1266 | |
1267 | === renamed file 'WebGL and Benchmarking/Test1ShaderStartup.html' => 'WebGL and Benchmarking/test1shaderstartup.html' |
1268 | --- WebGL and Benchmarking/Test1ShaderStartup.html 2013-03-28 14:57:59 +0000 |
1269 | +++ WebGL and Benchmarking/test1shaderstartup.html 2013-04-03 11:33:22 +0000 |
1270 | @@ -139,7 +139,7 @@ |
1271 | |
1272 | <body onload="genID('Startup Screenaligned'); webGLStart('canvas');"> |
1273 | |
1274 | - <canvas id="canvas" style="border: none;" width="400" height="400"></canvas> |
1275 | + <canvas id="canvas"></canvas> |
1276 | <div id="fps"></div> |
1277 | |
1278 | </body> |
1279 | |
1280 | === renamed file 'ErModeller/jquery.js' => 'js/jquery.js' |