Mercurial > laserkard
view onlypaths/js/format.js @ 58:9d156039944e laserkard
[svn r59] final modifacatios wqith kevin
author | rlm |
---|---|
date | Sun, 14 Mar 2010 01:51:23 -0500 |
parents | 26c2b3ad21c7 |
children |
line wrap: on
line source
1 /*2 JSON Richdraw Abstraction Layer4 ---------------------5 Also,7 JSON Rich Draw Format9 ---------------------11 */15 function canvas(richdraw,format){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 }29 var fullscreen=false;30 function load(code,draw)31 {33 var noattachlistener=false;34 var renderdoc=false;35 var renderinfo=false36 for(var i = 0; i < code.length; i++)37 {38 var rendering=true;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 }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 else68 {69 draw.renderer.view(70 0,71 0,72 screenW,73 screenH,74 code[i].viewBox,75 ''76 );77 }78 }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:'');100 co.id = ""+code[i].id;101 if (!noattachlistener)102 {103 Ext.get(co).on("mousedown", draw.onHit, draw);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 else124 {125 draw.renderer.view(0,0,screenW,screenH,'0 0 700 400','');126 }127 }128 if(renderinfo == false)129 {130 }131 }