Mercurial > laserkard
diff onlypaths/js/vmlrenderer.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 |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/onlypaths/js/vmlrenderer.js Sun Jan 31 12:33:33 2010 -0500 1.3 @@ -0,0 +1,1453 @@ 1.4 +//---------------------------------------------------------------------------- 1.5 +// VMLRENDERER 1.0 1.6 +// VML Renderer For RichDraw 1.7 +// Dependencies: 1.8 +// History: 1.9 +// 2006-04-05 | Created 1.10 +// --------------------------------------------------------------------------*/ 1.11 + 1.12 + 1.13 +function VMLRenderer() { 1.14 + this.base = AbstractRenderer; 1.15 +} 1.16 + 1.17 + 1.18 +VMLRenderer.prototype = new AbstractRenderer; 1.19 + 1.20 +VMLRenderer.prototype.bounds = function(shape) { 1.21 + var rect = new Object(); 1.22 + rect['x'] = shape.offsetLeft; 1.23 + rect['y'] = shape.offsetTop; 1.24 + rect['width'] = shape.offsetWidth; 1.25 + rect['height'] = shape.offsetHeight; 1.26 + return rect; 1.27 +} 1.28 + 1.29 +VMLRenderer.prototype.init = function(elem) 1.30 + { 1.31 + this.container = elem; 1.32 + // this.container.style.overflow = 'hidden'; 1.33 + this.container.unselectable = "on"; 1.34 + // Add VML includes and namespace 1.35 + elem.ownerDocument.namespaces.add("v", "urn:schemas-microsoft-com:vml"); 1.36 + var style = elem.ownerDocument.createStyleSheet(); 1.37 + style.addRule('v\\:*', "behavior: url(#default#VML); display:inline-block"); 1.38 + //NOT VML biewBox 1.39 + //http://blogs.msdn.com/ie/archive/2008/03/18/webbrowser-control-rendering-modes-in-ie8.aspx 1.40 + 1.41 + } 1.42 + 1.43 + 1.44 + 1.45 + 1.46 +var proporx=1; 1.47 +var propory=1; 1.48 + 1.49 +VMLRenderer.prototype.view = function(left,top,width,height,viewBox,bgcolor) { 1.50 + var tokens = viewBox.split(' '); 1.51 + 1.52 + var margin=100; 1.53 + var wFront=parseInt(document.getElementById('FRONT').style.width) 1.54 + var hFront=parseInt(document.getElementById('FRONT').style.height) 1.55 + var tC=0 + ' ' + 0 + ' ' + wFront + ' ' + hFront; 1.56 + tokensCanvas= tC.split(' '); 1.57 + 1.58 + var w=parseFloat(tokens[2]); 1.59 + var h=parseFloat(tokens[3]); 1.60 + var wImage = w - parseFloat(tokens[0]); 1.61 + var hImage = h - parseFloat(tokens[1]); 1.62 + var wCanvas = wFront; 1.63 + var hCanvas = hFront; 1.64 + proporImage = hImage / wImage; 1.65 + proporCanvas = hCanvas / wCanvas; 1.66 + 1.67 + document.title= initialFile +' '+wImage+' x '+hImage; 1.68 + 1.69 + 1.70 + if(bgcolor != '') 1.71 + { 1.72 + this.container.style.backgroundColor=bgcolor; 1.73 + } else{ 1.74 + this.container.style.backgroundColor="#ffffff"; 1.75 + } 1.76 +if(viewMode=='preview') 1.77 + { 1.78 + if(proporCanvas==proporImage) 1.79 + { 1.80 + this.container.style.width =wFront+'px'; 1.81 + this.container.style.height =hFront+'px'; 1.82 + this.container.style.left =0+'px' 1.83 + this.container.style.top =0+'px' 1.84 + canvasLeft = 0; 1.85 + canvasTop = 0; 1.86 + canvasWidth =wFront ; 1.87 + canvasHeight = hFront; 1.88 + zoominit1= 0+' '+0+' '+wFront+' '+hFront; 1.89 + zoominit = viewBox; 1.90 + zoominit2 = zoominit1; 1.91 + 1.92 + 1.93 + proporx = 1; 1.94 + propory = 1; 1.95 + 1.96 + } 1.97 + if(proporCanvas<proporImage) 1.98 + { 1.99 + var proportion= wFront/hFront; 1.100 + //var image_proportion= width/height; 1.101 + var image_proportion= w/h; 1.102 + var W=hFront*image_proportion; 1.103 + var leftover=(wFront-W)/2; 1.104 + 1.105 + this.container.style.width =W+'px'; 1.106 + this.container.style.height =hFront+'px'; 1.107 + this.container.style.left =leftover+'px' 1.108 + this.container.style.top =0+'px' 1.109 + //alert('Horizontal '+wFront+','+hFront+' '+image_proportion+' '+W+' '+leftover+' ____'+ this.container.style.width) 1.110 + canvasLeft = leftover; 1.111 + canvasTop = 0; 1.112 + canvasWidth =W ; 1.113 + canvasHeight = hFront; 1.114 + zoominit1= viewBox;//leftover+' '+0+' '+W+' '+hFront; 1.115 + zoominit1=0+' '+0+' '+W+' '+hFront; 1.116 + zoominit = viewBox; 1.117 + zoominit2 = zoominit1; 1.118 + 1.119 + 1.120 + proporx = W/w; 1.121 + propory = hFront/h; 1.122 + 1.123 + 1.124 + } 1.125 + if(proporCanvas>proporImage) 1.126 + { 1.127 + var proportion= hFront/wFront; 1.128 + //var image_proportion= width/height; 1.129 + var image_proportion= h/w; 1.130 + var H=wFront*image_proportion; 1.131 + var leftover=(hFront-H)/2; 1.132 + 1.133 + this.container.style.width =wFront+'px'; 1.134 + this.container.style.height =H+'px'; 1.135 + this.container.style.left =0+'px' 1.136 + this.container.style.top =leftover+'px' 1.137 + 1.138 + canvasLeft = 0; 1.139 + canvasTop = leftover; 1.140 + canvasWidth = wFront; 1.141 + canvasHeight = H; 1.142 + //zoominit1 = 0+' '+leftover+' '+wFront+' '+H; 1.143 + zoominit1 = 0+' '+0+' '+wFront+' '+H; 1.144 + zoominit = viewBox; 1.145 + zoominit2 = viewBox;//zoominit1; 1.146 + 1.147 + proporx = wFront/w; 1.148 + propory = H/h; 1.149 + 1.150 + } 1.151 + // proporx = width/tokens[2]; 1.152 + //propory = height/tokens[2]; 1.153 + 1.154 + 1.155 + 1.156 + } 1.157 +if(viewMode=='canvas') 1.158 + { 1.159 + this.container.style.left = 0 + 'px'; 1.160 + this.container.style.top = 0 + 'px'; 1.161 + this.container.style.width = wFront + 'px'; 1.162 + this.container.style.height = hFront + 'px'; 1.163 + 1.164 + // margins 10% 1.165 + var percent=10; 1.166 + var percentX = wImage / percent; 1.167 + var percentY = hImage / percent; 1.168 + var cornerNEx = parseFloat(tokens[0])-percentX; 1.169 + var cornerNEy = parseFloat(tokens[1])-percentY; 1.170 + var percentRectW=wImage + percentX*2; 1.171 + var percentRectH=hImage + percentY*2; 1.172 + 1.173 + document.title= initialFile +' '+wImage+' x '+hImage; 1.174 + // ajust proporImage to proporCanvas 1.175 + if(proporCanvas==proporImage) 1.176 + { 1.177 + cornerNEx = parseFloat(tokens[0])-percentX 1.178 + cornerNEy = parseFloat(tokens[1])-percentY 1.179 + var wi=percentRectW; 1.180 + var he=percentRectH;//hImage+percentY+addHimage; 1.181 + zoominit=viewBox; 1.182 + zoominit1 = (-percentX) +' '+(-percentY)+' '+wi+' '+he; 1.183 + proporx =(w*(100-percent*2)/100)/w; 1.184 + propory =( h*(100-percent*2)/100)/h; 1.185 + zoominit2=zoominit1; 1.186 + tokensZoom=tokensCanvas;//viewBox.split(' '); ;//zoominit1.split(' '); 1.187 + 1.188 + } 1.189 + 1.190 + if(proporCanvas<proporImage) 1.191 + { 1.192 + 1.193 + // add to hImage 1.194 + var newWimage = percentRectW * ((wCanvas * percentRectH) / (hCanvas * percentRectW)) ;//newRectH * 1.195 + var diffImages=newWimage-w; 1.196 + cornerNEx = parseFloat(tokens[0]) - (diffImages / 2); 1.197 + var wi=newWimage; 1.198 + var he=percentRectH;//hImage+percentY+addHimage; 1.199 + zoominit=viewBox; 1.200 + //zoominit1 = cornerNEx+' '+cornerNEy+' '+wi+' '+he; 1.201 + //zoominit1 = (-percentX) +' '+(-percentY)+' '+wi+' '+he; 1.202 + proporx =wFront/wi; 1.203 + propory = wFront/wi; 1.204 + var invPropor =wi/ wFront; 1.205 + zoominit1 = (proporx*cornerNEx) +' '+(propory*cornerNEy)+' '+wi+' '+he; 1.206 + zoominit2=zoominit1; 1.207 + var tZ = (invPropor*cornerNEx) +' '+(invPropor*cornerNEy)+' '+wi+' '+he; 1.208 + 1.209 + 1.210 + tokensZoom=tokensCanvas;//tZ.split(' ');//viewBox.split(' '); ;//zoominit1.split(' '); 1.211 + } 1.212 + if(proporCanvas>proporImage) 1.213 + { 1.214 + // add to hImage 1.215 + var newHimage = percentRectH * ((hCanvas * percentRectW) / (wCanvas * percentRectH)) ;//newRectH * 1.216 + var diffImages=newHimage-h; 1.217 + cornerNEy = parseFloat(tokens[1]) - (diffImages / 2); 1.218 + var wi=percentRectW; 1.219 + var he=newHimage;//hImage+percentY+addHimage; 1.220 + zoominit=viewBox; 1.221 + proporx =wFront/wi; 1.222 + propory = wFront/wi; 1.223 + 1.224 + zoominit1 = (proporx*cornerNEx) +' '+(propory*cornerNEy)+' '+wi+' '+he; 1.225 + zoominit2=zoominit1; 1.226 + tokensZoom=zoominit1.split(' '); 1.227 + 1.228 + } 1.229 + 1.230 + 1.231 + } 1.232 +} 1.233 + 1.234 + 1.235 + 1.236 +VMLRenderer.prototype.zoomFrame = function(zoom){ 1.237 + myOPF.viewBox=zoom; 1.238 + load(myOPF,c); 1.239 + document.getElementById("source").value=myOPF.toJSONString(); 1.240 +} 1.241 +VMLRenderer.prototype.rectDoc = function(viewBox) { 1.242 + var tokens2 = zoominit2.split(' '); 1.243 + var tokens = zoominit.split(' '); 1.244 + var shape = document.getElementById('rectDoc'); 1.245 + if (shape) { 1.246 + this.remove(shape); 1.247 + } 1.248 + var rect=this.container.ownerDocument.createElement('v:rect'); 1.249 + rect.id='rectDoc'; 1.250 + rect.style.position = 'absolute'; 1.251 + rect.style.left =-parseInt(tokens2[0]); 1.252 + rect.style.top = -parseInt(tokens2[1]); 1.253 + rect.style.width = parseInt(tokens[2]); 1.254 + rect.style.height = parseInt(tokens[3]); 1.255 + rect.setAttribute('filled', 'false'); 1.256 + rect.setAttribute('stroked', 'true'); 1.257 + rect.setAttribute('strokeweight', 2); 1.258 + rect.setAttribute('strokecolor',"#ff0000"); 1.259 + //this.container.appendChild(rect); 1.260 + //this.container.insertBefore(rect, this.container.firstChild ); 1.261 + //alert(docx+' '+docy+' '+docw+' '+doch+' '+viewBox) 1.262 +} 1.263 +VMLRenderer.prototype.rectCanvas = function(docx,docy,docw,doch,viewBox) { 1.264 + 1.265 + var tokens = zoominit1.split(' '); 1.266 + var shape = document.getElementById('rectCanvas'); 1.267 + if (shape) { 1.268 + this.remove(shape); 1.269 + } 1.270 + 1.271 + var rect=this.container.ownerDocument.createElement('v:rect'); 1.272 + rect.id='rectBackground'; 1.273 + rect.style.position = 'absolute'; 1.274 + rect.style.left = tokens[0] ; 1.275 + rect.style.top =tokens[1]; 1.276 + rect.style.width=tokens[2]; 1.277 + rect.style.height= tokens[3] ; 1.278 + rect.setAttribute('filled', 'true'); 1.279 + rect.setAttribute('fillcolor',"#666666"); 1.280 + rect.setAttribute('stroked', 'false'); 1.281 + 1.282 + this.container.insertBefore(rect, this.container.firstChild ); 1.283 + 1.284 +} 1.285 + 1.286 +VMLRenderer.prototype.removeAll = function(){ 1.287 + while (this.container.hasChildNodes()) { 1.288 + this.container.removeChild(this.container.firstChild); 1.289 + } 1.290 +} 1.291 + 1.292 +function VMLviewBox(container,left,top,width,height){ 1.293 + var tokens = zoominit2.split(' '); 1.294 + left *= proporx; 1.295 + left = left - parseFloat(tokens[0]); 1.296 + top *= propory; 1.297 + top = top - parseFloat(tokens[1]); 1.298 + width *= proporx; 1.299 + height *= propory; 1.300 + 1.301 + return {"x":parseFloat(Math.round(left)), "y":parseFloat(Math.round(top)), "w":parseFloat(Math.round(width)), "h":parseFloat(Math.round(height))}; 1.302 +} 1.303 +function VMLviewBox1(container,left,top,width,height){ 1.304 + var tokens = zoominit2.split(' '); 1.305 + left *= proporx; 1.306 + left = left - parseFloat(tokens[0]); 1.307 + top *= propory; 1.308 + top = top - parseFloat(tokens[1]); 1.309 + width *= proporx; 1.310 + height *= propory; 1.311 + 1.312 + return {"x":parseFloat(Math.round(left)), "y":parseFloat(Math.round(top)), "w":parseFloat(Math.round(width)), "h":parseFloat(Math.round(height))}; 1.313 +} 1.314 + 1.315 +VMLRenderer.prototype.create = function(shape, fillColor, lineColor, fillOpac, lineOpac, lineWidth, left, top, width, height, textMessaje, textSize, textFamily, imageHref, points, transform, parent) { 1.316 + var tokens = zoominit2.split(' '); 1.317 + 1.318 + var zoom=VMLviewBox(this.container,left,top,width,height); 1.319 + 1.320 + left=zoom.x; 1.321 + top=zoom.y; 1.322 + width=zoom.w; 1.323 + height=zoom.h; 1.324 + 1.325 + var zoom=VMLviewBox(this.container,left,top,textSize,textSize); 1.326 + //if(zoom.w<1){zoom.w=1} 1.327 + if(zoom.y== undefined){left=0} 1.328 + if(zoom.x== undefined){top=0} 1.329 + if(zoom.w== undefined){width=0} 1.330 + if(zoom.h== undefined){height=0} 1.331 + textSize=zoom.h; 1.332 + 1.333 + var zoom=VMLviewBox(this.container,left,top,lineWidth*2/3,lineWidth); 1.334 + //if(zoom.w<1){zoom.w=1} 1.335 + lineWidth=zoom.w; 1.336 + var vml; 1.337 + var shap=1; 1.338 + if (shape == 'rect') { 1.339 + 1.340 + vml = this.container.ownerDocument.createElement('v:rect'); 1.341 + vml.style.position = 'absolute'; 1.342 + vml.style.left = left; 1.343 + vml.style.top = top; 1.344 + vml.style.width = width; 1.345 + vml.style.height = height; 1.346 + } 1.347 + else if (shape == 'roundrect') { 1.348 + vml = this.container.ownerDocument.createElement('v:roundrect'); 1.349 + vml.style.position = 'absolute'; 1.350 + vml.style.left = left; 1.351 + vml.style.top = top; 1.352 + vml.style.width = width; 1.353 + vml.style.height = height; 1.354 + vml.setAttribute('arcsize', '20%'); 1.355 + 1.356 + } 1.357 + else if (shape == 'ellipse') { 1.358 + vml = this.container.ownerDocument.createElement('v:oval'); 1.359 + vml.style.left = left; 1.360 + vml.style.top = top; 1.361 + vml.style.width = width; 1.362 + vml.style.height = height; 1.363 + vml.style.position = 'absolute'; 1.364 + } 1.365 + else if (shape == 'line') { 1.366 + 1.367 + vml = this.container.ownerDocument.createElement('v:line'); 1.368 + vml.setAttribute('from', left + 'px,' + top + 'px'); 1.369 + vml.setAttribute('to', (left+width) + 'px,' + (top+height) + 'px'); 1.370 + 1.371 + } 1.372 + else if (shape == 'polyline') { 1.373 + vml = this.container.ownerDocument.createElement('v:polyline'); 1.374 + vml.setAttribute("points", points); 1.375 + 1.376 + } 1.377 + else if (shape == 'path') 1.378 + { 1.379 + vml = this.container.ownerDocument.createElement('v:shape'); 1.380 + var tokens = zoominit1.split(' '); 1.381 + var tokens1 = zoominit1.split(' '); 1.382 + var tokens2 = zoominit2.split(' '); 1.383 + tokens[0]=0; 1.384 + tokens[1]=0; 1.385 + var path=points; 1.386 + path=path.replace(/, /g, ','); 1.387 + path=path.replace(/ ,/g, ','); 1.388 + var ps =path.split(" ") 1.389 + var pcc = ""; 1.390 + 1.391 + var re = /^[-]?\d*\.?\d*$/; 1.392 + var contArc=0; 1.393 + var isArc=false; 1.394 + for(var i = 0; i < ps.length; i++) 1.395 + { 1.396 + if(ps[i].indexOf(',')>0){ 1.397 + 1.398 + var point =ps[i].split(","); 1.399 + var char1=point[0].substring(0,1); 1.400 + 1.401 + if (!char1.match(re)) 1.402 + { 1.403 + var num0prev= parseFloat(point[0].substring(1)); 1.404 + var zoom=VMLviewBox(this.container,num0prev*1+(parseInt(tokens2[0])*0),0,parseInt(tokens2[2]),parseInt(tokens2[3])); 1.405 + num0=zoom.x; 1.406 + 1.407 + var text=char1; 1.408 + }else{ 1.409 + var num0prev= parseFloat(point[0]); 1.410 + var zoom=VMLviewBox(this.container,num0prev*1+(parseInt(tokens2[0])*0),0,parseInt(tokens2[2]),parseInt(tokens2[3])); 1.411 + num0=zoom.x; 1.412 + 1.413 + } 1.414 + point[1]= parseFloat(point[1]); 1.415 + var zoom=VMLviewBox(this.container,0,point[1],parseInt(tokens2[2]),parseInt(tokens2[3])); 1.416 + point[1]=zoom.y; 1.417 + var cx=num0+parseInt(tokens2[0]); 1.418 + var cy=point[1]+parseInt(tokens2[1]); 1.419 + pcc+=text+cx+','+cy+' '; 1.420 + } 1.421 + else 1.422 + { 1.423 + pcc+=ps[i]+' '; 1.424 + } 1.425 + 1.426 + } 1.427 + //////////////////// 1.428 + var thispath=pcc; 1.429 + thispath=thispath.replace(/M/g,'m'); 1.430 + thispath=thispath.replace(/C/g,'c'); 1.431 + thispath=thispath.replace(/L/g,'l'); 1.432 + thispath=thispath.replace(/z/g,'x'); 1.433 + 1.434 + //document.getElementById('source').value=points+'\r\n'+thispath +'\r\n'+'________'+'\r\n' 1.435 + var zoom=VMLviewBox(this.container,tokens[0],tokens[1],tokens[2],tokens[3]); 1.436 + 1.437 + vml.style.position="absolute"; 1.438 + vml.style.width= zoom.w+"px"; 1.439 + vml.style.height=zoom.h+"px"; 1.440 + vml.style.left=zoom.x+"px"; 1.441 + vml.style.top=zoom.y+"px"; 1.442 + vml.setAttribute('coordsize', zoom.w+','+zoom.h); 1.443 + 1.444 + var path01 = this.container.ownerDocument.createElement('v:path'); 1.445 + path01.setAttribute("v", thispath+' e'); 1.446 + 1.447 + 1.448 + 1.449 + vml.appendChild(path01) 1.450 + 1.451 + } 1.452 + 1.453 + else if (shape == 'controlpath') 1.454 + { 1.455 + 1.456 + vml = this.container.ownerDocument.createElement('v:shape'); 1.457 + vml.style.position="absolute"; 1.458 + vml.style.width= 700+"px"; 1.459 + vml.style.height=500+"px"; 1.460 + vml.style.left=left+"px"; 1.461 + vml.style.top=top+"px"; 1.462 + vml.setAttribute('coordsize', '700,500'); 1.463 + 1.464 + var path01 = this.container.ownerDocument.createElement('v:path'); 1.465 + path01.setAttribute('v', 'm '+left+','+top+' c'+(left+1)+','+(top+1)+' e '); 1.466 + 1.467 + vml.appendChild(path01) 1.468 + } 1.469 + else if (shape == 'image') { 1.470 + var data =imageHref;//document.forms[0].option_text_message.value; 1.471 + vml = this.container.ownerDocument.createElement('v:image'); 1.472 + vml.setAttribute('src',imageHref); 1.473 + vml.style.position="absolute"; 1.474 + vml.style.width=width+"px"; 1.475 + vml.style.height=height+"px"; 1.476 + vml.style.left=left+"px"; 1.477 + vml.style.top=top+"px"; 1.478 + vml.style.margin=0+"px"; 1.479 + vml.style.padding=0+"px"; 1.480 + if (fillColor != '' || fillColor != 'none') { 1.481 + vml.setAttribute('filled', 'false'); 1.482 + vml.setAttribute('fillcolor', fillColor); 1.483 + } 1.484 + else { 1.485 + vml.setAttribute('filled', 'false'); 1.486 + } 1.487 + vml.setAttribute('strokeweight','0px');// parseFloat(lineWidth)+'px'); 1.488 + vml.setAttribute('stroked', 'false'); 1.489 + vml.setAttribute('strokecolor','#000000');//lineColor); 1.490 + 1.491 + 1.492 + } 1.493 + 1.494 + else if (shape == 'text') 1.495 + { 1.496 + 1.497 + var data =textMessaje; 1.498 + vml = this.container.ownerDocument.createElement('v:shape'); 1.499 + vml.style.position="absolute"; 1.500 + //vml.setAttribute('coordorigin',left+', '+top); 1.501 + //vml.style.coorsize= ''; 1.502 + coordorigin="0, 0" 1.503 + 1.504 + var ts=isNaN(textSize) 1.505 + if(ts==true){ 1.506 + textSize=10; 1.507 + } 1.508 + vml.style.width= textSize+'px';//tokens[2]+'px' 1.509 + vml.style.height=textSize+'px'; 1.510 + vml.style.left=(left+"px"); 1.511 + vml.style.top=(top-(textSize*1/4)+"px"); 1.512 + vml.style.margin=0+"px"; 1.513 + vml.style.padding=0+"px"; 1.514 + vml.setAttribute('path','m '+0+' '+0+' r '+(textSize*data.length)+' '+0+' e'); 1.515 + var textPathObj = this.container.ownerDocument.createElement("v:textpath"); 1.516 + textPathObj.setAttribute('string', data); 1.517 + textPathObj.setAttribute('fitshape','false'); 1.518 + textPathObj.setAttribute('trim', 'false'); 1.519 + textPathObj.setAttribute('fitpath', 'false'); 1.520 + textPathObj.setAttribute('on','true'); 1.521 + textPathObj.style.fontFamily=textFamily; 1.522 + textPathObj.style.fontSize=textSize+'px'; 1.523 + textPathObj.setAttribute('vTextKern','true'); 1.524 + textPathObj.setAttribute('text-align','center'); 1.525 + 1.526 + var pathObj = this.container.ownerDocument.createElement("v:path"); 1.527 + pathObj.setAttribute('textpathok', 'true'); 1.528 + vml.appendChild(textPathObj); 1.529 + vml.appendChild(pathObj); 1.530 + 1.531 + 1.532 + } 1.533 + 1.534 + 1.535 + 1.536 + else if (shape == 'texto') 1.537 + { 1.538 + vml = this.container.ownerDocument.createElement('v:shape'); 1.539 + vml.style.position="absolute"; 1.540 + 1.541 + vml.style.coordsize=1000+', '+1000; 1.542 + vml.style.width= 1000; 1.543 + vml.style.height=1000; 1.544 + vml.style.left=left; 1.545 + vml.style.top=top-parseFloat(textSize); 1.546 + 1.547 + vml.style.padding=0; 1.548 + var textBox = this.container.ownerDocument.createElement("v:textbox"); 1.549 + textBox.setAttribute('mso-rotate-with-shape',true) 1.550 + var divtext = this.container.ownerDocument.createElement("div"); 1.551 + divtext.style.coordorigin=0+', '+(0); 1.552 + divtext.style.margin=0; 1.553 + divtext.style.fontFamily=textFamily; 1.554 + divtext.style.margin=0; 1.555 + divtext.style.padding=0; 1.556 + divtext.style.vRotateLetters=true; 1.557 + divtext.style.fontSize=parseFloat(textSize); 1.558 + 1.559 + 1.560 + 1.561 + 1.562 + 1.563 + 1.564 + divtext.style.color=fillColor; 1.565 + 1.566 + 1.567 + 1.568 + 1.569 + 1.570 + //divtext.setAttribute('v-rotate-letters','true'); 1.571 + if(transform.indexOf('rotate')>=0) 1.572 + { 1.573 + 1.574 + myRotate1=transform.split('rotate('); 1.575 + myRotate2=myRotate1[1].split(')'); 1.576 + myRotate3=myRotate2[0].split(','); 1.577 + 1.578 + //divtext.setAttribute('mso-rotate',myRotate3[0]); 1.579 + //textBox.style.msoRotate= myRotate3[0]; 1.580 + //textBox.style.centerX=myRotate3[1]; 1.581 + //textBox.style.centerY=myRotate3[2]; 1.582 + //vml.style.rotation= myRotate3[0]; 1.583 + //vml.style.centerX=myRotate3[1]; 1.584 + //vml.style.centerY=myRotate3[2]; 1.585 + vml.setAttribute('rotation',myRotate3[0]+'Deg'); 1.586 + } 1.587 + 1.588 + divtext.innerHTML=textMessaje; 1.589 + textBox.appendChild(divtext); 1.590 + 1.591 + vml.appendChild(textBox); 1.592 + 1.593 + } 1.594 + else if (shape == 'defs') { 1.595 + var vml; 1.596 + 1.597 + } 1.598 + 1.599 + else if (shape == 'group') { 1.600 + vml = this.container.ownerDocument.createElement('v:group'); 1.601 + vml.style.left=left+"px"; 1.602 + vml.style.top=top+"px"; 1.603 + } 1.604 + 1.605 + if(shape == 'zoom' || shape == 'defs') 1.606 + { 1.607 + 1.608 + }else 1.609 + { 1.610 + if(transform.indexOf('rotate')>=0) 1.611 + { 1.612 + myRotate1=transform.split('rotate('); 1.613 + myRotate2=myRotate1[1].split(')'); 1.614 + myRotate3=myRotate2[0].split(','); 1.615 + 1.616 + vml.style.rotation= myRotate3[0]+'Deg'; 1.617 + vml.style.centerX=myRotate3[1]; 1.618 + vml.style.centerY=myRotate3[2]; 1.619 + 1.620 + } 1.621 + 1.622 + if(shape != 'image' ) 1.623 + { 1.624 + if (lineColor.length == 0){lineColor = 'none';} 1.625 + if (fillColor.length == 0){fillColor = 'none';} 1.626 + (fillColor!=''|| fillColor!=null )?vml.setAttribute('fillcolor', fillColor):vml.setAttribute('filled', 'true'); 1.627 + 1.628 + if (fillColor != '' || fillColor != 'none' ) 1.629 + { 1.630 + vml.setAttribute('filled', 'true'); 1.631 + vml.setAttribute('fillcolor', fillColor); 1.632 + 1.633 + } 1.634 + else 1.635 + { 1.636 + vml.setAttribute('filled', 'false'); 1.637 + } 1.638 + 1.639 + 1.640 + if(lineWidth==0 || lineWidth=='none' || lineColor== 'none' ) 1.641 + { 1.642 + vml.setAttribute('stroked', 'false'); 1.643 + } 1.644 + else 1.645 + { 1.646 + //if(isNaN(lineColor)==false){alert('-'+lineColor+'-');lineColor='#000000';lineWidth=1;} 1.647 + vml.setAttribute('stroked', 'true'); 1.648 + vml.setAttribute('strokecolor', lineColor); 1.649 + vml.setAttribute('strokeweight', lineWidth); 1.650 + var stroke = this.container.ownerDocument.createElement('v:stroke'); 1.651 + stroke.setAttribute("opacity", parseFloat(lineOpac)); 1.652 + vml.appendChild(stroke); 1.653 + 1.654 + } 1.655 + 1.656 + if (fillOpac != '') 1.657 + { 1.658 + if (fillOpac == 'none' || fillColor=='none'){fillOpac=0;} 1.659 + var fill = this.container.ownerDocument.createElement('v:fill'); 1.660 + fill.setAttribute("opacity",parseFloat(fillOpac)); 1.661 + //alert(fillOpac) 1.662 + vml.appendChild(fill); 1.663 + } 1.664 + } 1.665 + } 1.666 + if(parent==''){ 1.667 + if(vml){ 1.668 + this.container.appendChild(vml);} 1.669 + }else{ 1.670 + if(document.getElementById(parent)){ 1.671 + var parentShape = document.getElementById(parent); 1.672 + if(vml||vml!=null ){ 1.673 + parentShape.appendChild(vml); 1.674 + } 1.675 + } 1.676 + } 1.677 + //var parentDoc = document.getElementById('mydraw'); 1.678 + //parentDoc.appendChild(vml); 1.679 + return vml; 1.680 +}; 1.681 + 1.682 +VMLRenderer.prototype.resize = function(shape, fromX, fromY, toX, toY) { 1.683 + var deltaX = toX - fromX; 1.684 + var deltaY = toY - fromY; 1.685 + if (shape.tagName == 'rect' ) 1.686 + { 1.687 + 1.688 + 1.689 + if (deltaX < 0) { 1.690 + shape.style.left=toX + 'px'; 1.691 + shape.style.width=-deltaX + 'px'; 1.692 + } 1.693 + else 1.694 + { 1.695 + shape.style.width= deltaX + 'px'; 1.696 + } 1.697 + 1.698 + if (deltaY < 0) 1.699 + { 1.700 + shape.style.top=toY + 'px'; 1.701 + shape.style.height=-deltaY + 'px'; 1.702 + } 1.703 + else 1.704 + { 1.705 + shape.style.height=deltaY + 'px'; 1.706 + } 1.707 + } 1.708 +} 1.709 +VMLRenderer.prototype.duplicate = function(shape) 1.710 + { 1.711 + var vml; 1.712 + vml =shape.cloneNode(false); 1.713 + //vml.setAttribute('fillcolor', "#aa00aa"); 1.714 + vml.setAttribute('filled', "false"); 1.715 + this.container.appendChild(vml); 1.716 + return vml; 1.717 + 1.718 + }; 1.719 +VMLRenderer.prototype.querySelected = function(shape,centerx,centery,width,height) 1.720 +{ 1.721 + var result = true; 1.722 + var shapes='names: group, image, rect, path, ellipse, circle, text, line, '; 1.723 + 1.724 + //if(shape.getBBox && shape) 1.725 + if( shapes.indexOf(' '+shape.tagName+',')>0) 1.726 + { 1.727 + 1.728 + var box = this.bounds(shape); 1.729 + }else 1.730 + { 1.731 + return false; 1.732 + } 1.733 + var p1x = box.x; 1.734 + if(Math.abs(p1x-centerx)>width){result = false} 1.735 + 1.736 + var p1y = box.y; 1.737 + if(Math.abs(p1y-centery)>height){result = false} 1.738 + 1.739 + var p2x = box.x+box.width; 1.740 + if(Math.abs(p2x-centerx)>width){result = false} 1.741 + 1.742 + var p2y = box.y; 1.743 + if(Math.abs(p2y-centery)>height){result = false} 1.744 + 1.745 + var p3x = box.x+box.width; 1.746 + if(Math.abs(p3x-centerx)>width){result = false} 1.747 + 1.748 + var p3y = box.y+box.height; 1.749 + if(Math.abs(p3y-centery)>height){result = false} 1.750 + 1.751 + var p4x = box.x; 1.752 +if(Math.abs(p4x-centerx)>width){result = false} 1.753 + 1.754 + var p4y = box.y+box.height; 1.755 + if(Math.abs(p4y-centery)>height){result = false} 1.756 + 1.757 + if(result) 1.758 + { 1.759 + return { 'in':result, 'cornersx': p1x+','+p2x+','+p3x+','+p4x+',' ,'cornersy': p1y+','+p2y+','+p3y+','+p4y+',' }; 1.760 + } 1.761 + else 1.762 + { 1.763 + return { 'in':result } 1.764 + } 1.765 +//center.distanceFrom(point1); 1.766 + 1.767 + 1.768 +} 1.769 + 1.770 +VMLRenderer.prototype.searchBoxes = function() 1.771 +{ 1.772 + var base = this.container; 1.773 + 1.774 + var NumNodes = base.childNodes.length; 1.775 + var chain= ''; 1.776 + for(i = 0;i < NumNodes;i++) 1.777 + { 1.778 + if (this.bounds(base.childNodes[i])) 1.779 + { 1.780 + chain+=base.childNodes[i].id + ';' 1.781 + } 1.782 + } 1.783 + chain+='' 1.784 + return chain; 1.785 + 1.786 +} 1.787 + 1.788 +VMLRenderer.prototype.DrawBorder= function(numNode, targetElement ) 1.789 +{ 1.790 + var shapes='names: group, image, rect, path, ellipse, circle, text, line, '; 1.791 + 1.792 + //if(shape.getBBox && shape) 1.793 + if( shapes.indexOf(' '+targetElement.tagName+',')>0) 1.794 + { 1.795 + var bbox = this.bounds(targetElement); 1.796 + 1.797 + var outline = this.container.ownerDocument.createElement('v:rect'); 1.798 + outline.setAttribute('x', bbox.x - 2 ); 1.799 + outline.setAttribute('y', bbox.y - 2 ); 1.800 + outline.setAttribute('width', bbox.width + 4 ); 1.801 + outline.setAttribute('height', bbox.height + 4 ); 1.802 + outline.setAttribute('stroke', '#ff00ff' ); 1.803 + outline.setAttribute('fill', 'none' ); 1.804 + outline.setAttribute('id', 'shapeBoxed'+numNode ); 1.805 + 1.806 + targetElement.parentNode.insertBefore( outline, targetElement ); 1.807 + return 'shapeBoxed'+numNode; 1.808 + } 1.809 + else 1.810 + { 1.811 + return false 1.812 + } 1.813 +} 1.814 + 1.815 + 1.816 +VMLRenderer.prototype.getMarkup = function() { 1.817 + 1.818 + //return this.container.parentNode.innerHTML; 1.819 + return this.container.innerHTML; 1.820 +} 1.821 + 1.822 +VMLRenderer.prototype.remove = function(shape) { 1.823 + if(shape!=null){ shape.removeNode(true); } 1.824 +} 1.825 + 1.826 +VMLRenderer.prototype.removeAll = function() { 1.827 + while( this.container.hasChildNodes () ){ 1.828 + this.container.removeChild( this.container.firstChild ); 1.829 + //this.container.removeNode( this.container.firstChild ); 1.830 + } 1.831 +} 1.832 + 1.833 +VMLRenderer.prototype.editCommand = function(shape, cmd, value) 1.834 +{ 1.835 + if (shape != null) { 1.836 + if (cmd == 'fillcolor') { 1.837 + if (value == '' || value =='none') 1.838 + shape.style.fill='none'; 1.839 + else 1.840 + shape.style.fill=value; 1.841 + } 1.842 + else if (cmd == 'linecolor') { 1.843 + if (value != '') 1.844 + shape.style.stroke=value; 1.845 + else 1.846 + shape.style.stroke='none'; 1.847 + } 1.848 + else if (cmd == 'linewidth') { 1.849 + if( value=='none' || value=='') 1.850 + { 1.851 + shape.style.strokeWidth=0; 1.852 + }else{ 1.853 + shape.style.strokeWidth=parseInt(value) + 'px'; 1.854 + } 1.855 + } 1.856 + else if (cmd == 'fillopacity') { 1.857 + if(shape.tagName=='image') 1.858 + { 1.859 + shape.style.opacity=parseFloat(value); 1.860 + } 1.861 + else 1.862 + { 1.863 + shape.style.fillOpacity=parseFloat(value); 1.864 + } 1.865 + 1.866 + } 1.867 + else if (cmd == 'lineopacity') { 1.868 + 1.869 + shape.style.strokeOpacity=parseFloat(value); 1.870 + 1.871 + } 1.872 + else if (cmd == 'filter') 1.873 + { 1.874 + if (value != '') 1.875 + { 1.876 + //shape.style.setProperty("filter", value) ; 1.877 + shape.style.filter=value; 1.878 + //alert(value) 1.879 + } 1.880 + } 1.881 + else if (cmd == 'textContent') 1.882 + { 1.883 + if (value != '') 1.884 + { 1.885 + shape.textContent=value; 1.886 + } 1.887 + } 1.888 + else if (cmd == 'textSize') 1.889 + { 1.890 + if (value != '') 1.891 + { 1.892 + shape.style.fontSize=parseFloat(eval(value)); 1.893 + } 1.894 + } 1.895 + else if (cmd == 'textFamily') 1.896 + { 1.897 + if (value != '') 1.898 + { 1.899 + shape.style.fontFamily=value; 1.900 + } 1.901 + } 1.902 + else if (cmd == 'textSpacing') 1.903 + { 1.904 + if (value != '') 1.905 + { 1.906 + shape.style.letterSpacing=''+value+'em'; 1.907 + //alert(value) //bad letter-spacing word-spacing 1.908 + } 1.909 + } 1.910 + else if (cmd == 'textLength') 1.911 + { 1.912 + if (value != '') 1.913 + { 1.914 + //shape.style.=''+value+''; 1.915 + shape.style.lengthAdjust='spacing';//spacing spacingAndGlyphs 1.916 + //alert(value) //bad textLength 1.917 + } 1.918 + } 1.919 + 1.920 + 1.921 + else if (cmd == 'textAnchor') 1.922 + { 1.923 + if (value != '') 1.924 + { 1.925 + shape.style.textAnchor=value; 1.926 + } 1.927 + } 1.928 + else if (cmd == 'textWeight') 1.929 + { 1.930 + if (value != '') 1.931 + { 1.932 + shape.style.fontWeight=value; 1.933 + } 1.934 + } 1.935 + else if (cmd == 'textStyle') 1.936 + { 1.937 + if (value != '') 1.938 + { 1.939 + shape.style.fontStyle=value; 1.940 + } 1.941 + } 1.942 + else if (cmd == 'textDecoration') 1.943 + { 1.944 + if (value != '') 1.945 + { 1.946 + shape.style.textDecoration=value; 1.947 + } 1.948 + //alert(value) //bad textDecoration 1.949 + } 1.950 + else if (cmd == 'textMode') 1.951 + { 1.952 + if (value != '') 1.953 + { 1.954 + shape.style.writingMode=value; 1.955 + } 1.956 + } 1.957 + else if (cmd == 'textDirection') 1.958 + { 1.959 + if (value != '') 1.960 + { 1.961 + shape.style.direction=value; 1.962 + } 1.963 + } 1.964 + else if (cmd == 'textOrientation') 1.965 + { 1.966 + if (value != '') 1.967 + { 1.968 + shape.style.glyphOrientationVertical=value; 1.969 + } 1.970 + } 1.971 + else if (cmd == 'stopcolor') 1.972 + { 1.973 + if (value != '') 1.974 + { 1.975 + shape.style.stopColor=value; 1.976 + } 1.977 + } 1.978 + else if (cmd == 'linearGradient') 1.979 + { 1.980 + if (value != '') 1.981 + { 1.982 + shape.style.x1=value.x1; 1.983 + shape.style.y1=value.y1; 1.984 + shape.style.x2=value.x2; 1.985 + shape.style.y2=value.y2; 1.986 + } 1.987 + } 1.988 + else if (cmd == 'radialGradient') 1.989 + { 1.990 + if (value != '') 1.991 + { 1.992 + shape.style.x1=value.x1; 1.993 + shape.style.y1=value.y1; 1.994 + shape.style.x2=value.x2; 1.995 + shape.style.y2=value.y2; 1.996 + } 1.997 + } 1.998 + else if (cmd == 'leftTop') 1.999 + { 1.1000 + if (value != '') 1.1001 + { 1.1002 + shape.style.left=parseInt(value.left)+'px'; 1.1003 + shape.style.top=parseInt(value.top)+'px'; 1.1004 + 1.1005 + } 1.1006 + } 1.1007 + else if (cmd == 'cxcy') 1.1008 + { 1.1009 + if (value != '') 1.1010 + { 1.1011 + shape.style.cx=value.cx; 1.1012 + shape.style.cy=value.cy; 1.1013 + 1.1014 + } 1.1015 + } 1.1016 + 1.1017 + } 1.1018 +} 1.1019 + 1.1020 + 1.1021 +VMLRenderer.prototype.queryCommand = function(shape, cmd) 1.1022 +{ 1.1023 + var result = ''; 1.1024 + 1.1025 + if (shape != null) { 1.1026 + if (cmd == 'fillcolor') { 1.1027 + result = shape.style.fill; 1.1028 + if (result == 'none') 1.1029 + result = ''; 1.1030 + } 1.1031 + else if (cmd == 'linecolor') { 1.1032 + result = shape.style.stroke; 1.1033 + if (result == 'none') 1.1034 + result = ''; 1.1035 + } 1.1036 + else if (cmd == 'linewidth') { 1.1037 + result = shape.style.stroke; 1.1038 + if (result == 'none') 1.1039 + result = ''; 1.1040 + else 1.1041 + result = shape.style.strokeWidth; 1.1042 + } 1.1043 + else if (cmd == 'fillopacity') { 1.1044 + if(shape.tagName=='image') 1.1045 + { 1.1046 + result= shape.style.opacity; 1.1047 + } 1.1048 + else 1.1049 + { 1.1050 + result= shape.style.fillOpacity; 1.1051 + } 1.1052 + 1.1053 + } 1.1054 + else if (cmd == 'lineopacity') { 1.1055 + 1.1056 + result= shape.style.strokeOpacity; 1.1057 + 1.1058 + } 1.1059 + else if (cmd == 'text') { 1.1060 + var text1=shape.textContent; 1.1061 + var text2=shape.style.fontFamily; 1.1062 + var text3=parseInt(shape.style.fontSize); 1.1063 + 1.1064 + result= {"data":text1,"family":text2,"size":text3}; 1.1065 + 1.1066 + } 1.1067 + else if (cmd == 'points') { 1.1068 + result=shape.style,d; 1.1069 + 1.1070 + } 1.1071 + else if (cmd == 'stopcolor') { 1.1072 + result=shape.style.stopColor 1.1073 + 1.1074 + } 1.1075 + else if (cmd == 'box') { 1.1076 + result= this.bounds(shape); 1.1077 + 1.1078 + } 1.1079 + else if (cmd == 'linearGradient') { 1.1080 + var x1=shape.style.x1; 1.1081 + var y1=shape.style.y1; 1.1082 + var x2=shape.style.x2; 1.1083 + var y2=shape.style.y2; 1.1084 + result= {"x1":x1,"y1":y1,"x2":x2,"y2":y2}; 1.1085 + 1.1086 + } 1.1087 + 1.1088 + 1.1089 + } 1.1090 + 1.1091 + return result; 1.1092 +} 1.1093 + 1.1094 + VMLRenderer.prototype.showTracker01 = function(shape) { 1.1095 + var box = this.bounds(shape); 1.1096 + 1.1097 + var tracker = document.getElementById('tracker'); 1.1098 + if (tracker) { 1.1099 + this.remove(tracker); 1.1100 + } 1.1101 + 1.1102 + tracker = this.container.ownerDocument.createElement('v:rect'); 1.1103 + tracker.id = 'tracker'; 1.1104 + tracker.style.position = 'absolute'; 1.1105 + tracker.style.left = box.x - 10; 1.1106 + tracker.style.top = box.y - 10; 1.1107 + tracker.style.width = box.width + 20; 1.1108 + tracker.style.height = box.height + 20; 1.1109 + tracker.setAttribute('filled', 'false'); 1.1110 + tracker.setAttribute('stroked', 'true'); 1.1111 + tracker.setAttribute('strokecolor', 'blue'); 1.1112 + tracker.setAttribute('strokeweight', '1px'); 1.1113 + this.container.appendChild(tracker); 1.1114 +} 1.1115 + 1.1116 + 1.1117 +VMLRenderer.prototype.showTracker = function(shape) { 1.1118 + var box = this.bounds(shape); 1.1119 + //alert(box.width+' '+shape.id) 1.1120 + var trshape = parseFloat(shape.getAttribute('rotation')); 1.1121 + var tracker = document.getElementById('tracker'); 1.1122 + 1.1123 + if (tracker) { 1.1124 + this.remove(tracker); 1.1125 + } 1.1126 + 1.1127 + if (shape.tagName == 'shape') 1.1128 + { 1.1129 + shap=2; 1.1130 + if(shape.children[0].tagName == 'path') 1.1131 + { 1.1132 + 1.1133 + /* $('option_path_trx').value= box.x; 1.1134 + $('option_path_try').value= box.y; 1.1135 + $('option_path_sclx').value= box.width; 1.1136 + $('option_path_scly').value= box.height; 1.1137 + $('option_path_rot').value= shape.style.rotation; 1.1138 + */ 1.1139 + //var path=shape.children[0].getAttribute('v'); 1.1140 + // $('control_codebase').value=path; 1.1141 + } 1.1142 + } 1.1143 + if (shape.tagName == 'rect') { 1.1144 + /* 1.1145 + $('option_rect_rot').value= shape.getAttribute('rotation'); 1.1146 + $('option_rect_trx').value= box.x; 1.1147 + $('option_rect_try').value= box.y; 1.1148 + $('option_rect_sclx').value= box.width; 1.1149 + $('option_rect_scly').value= box.height; 1.1150 + */ 1.1151 + } 1.1152 + 1.1153 + if (shape.tagName == 'image'){ 1.1154 + /* $('option_img_trx').value= box.x; 1.1155 + $('option_img_try').value= box.y; 1.1156 + $('option_img_sclx').value= box.width; 1.1157 + $('option_img_scly').value= box.height; 1.1158 + $('option_img_rot').value= T.b* (Math.PI * 2 / 360); 1.1159 + */ 1.1160 + } 1.1161 + if (shape.tagName == 'text'){ 1.1162 + /* f$('option_text_trx').value= box.x; 1.1163 + $('option_text_try').value= box.y; 1.1164 + $('option_text_sclx').value= box.width; 1.1165 + $('option_text_scly').value= box.height; 1.1166 + $('option_text_rot').value= T.b* (Math.PI * 2 / 360); 1.1167 + */ 1.1168 + } 1.1169 + if (shape.tagName == 'line'){ 1.1170 + /* 1.1171 + $('option_line_trx').value= box.x; 1.1172 + $('option_line_try').value= box.y; 1.1173 + */ 1.1174 + } 1.1175 + if (shape.tagName == 'oval'){ 1.1176 + /*$('option_ellipse_trx').value= putx; 1.1177 + $('option_ellipse_try').value= puty; 1.1178 + $('option_ellipse_sclx').value= box.width; 1.1179 + $('option_ellipse_scly').value= box.height; 1.1180 + $('option_ellipse_rot').value= T.b* (Math.PI * 2 / 360); 1.1181 + */ 1.1182 + } 1.1183 + 1.1184 + 1.1185 + 1.1186 + /*var matrix = shape.getScreenCTM(); 1.1187 + var trshape= shape.getAttribute('transform'); 1.1188 + var shap=1; 1.1189 + if (shape.tagName == 'path') { shap=2; 1.1190 + 1.1191 + 1.1192 + 1.1193 + } 1.1194 + */ 1.1195 + //if (shape.getAttribute('transform') ) { shap=2; } 1.1196 + //var svgNamespace = 'http://www.w3.org/2000/svg'; 1.1197 + 1.1198 + tracker = this.container.ownerDocument.createElement('v:group'); 1.1199 + tracker.id = 'tracker'; 1.1200 + //tracker.setAttribute('rotation',trshape); 1.1201 + tracker.setAttribute('coordorigin','0, 0'); 1.1202 + //tracker.setAttribute('wrapcoords',true); 1.1203 + 1.1204 + 1.1205 + tracker.setAttribute('coordsize',box.width+','+ box.height); 1.1206 + tracker.style.position = 'absolute'; 1.1207 + tracker.style.left = box.x ; 1.1208 + tracker.style.top = box.y; 1.1209 + tracker.style.width = box.width ; 1.1210 + tracker.style.height = box.height ; 1.1211 + 1.1212 + 1.1213 + //////////////// 1.1214 + 1.1215 + 1.1216 + var corners = []; 1.1217 + var point = createPoint(box.x, box.y, box.width, box.height); 1.1218 + //point = {x:box.x, y:box.y, width: box.width, height:box.height}; 1.1219 +//point = createPoint(box.x, box.y, box.width, box.height); 1.1220 + //1 1.1221 + corners.push( createPoint(box.x + box.width, box.y, box.width, box.height) ); 1.1222 + point.x = box.x + box.width; 1.1223 + point.y = box.y; 1.1224 + //2 1.1225 + corners.push( createPoint(box.x + box.width, box.y + box.height, box.width, box.height) ); 1.1226 + point.x = box.x + box.width; 1.1227 + point.y = box.y + box.height; 1.1228 + //3 1.1229 + //corners.push( point.matrixTransform(matrix) ); 1.1230 + corners.push( createPoint(box.x , box.y + box.height, box.width, box.height) ); 1.1231 + point.x = box.x; 1.1232 + point.y = box.y + box.height; 1.1233 + //4 1.1234 + corners.push( createPoint(box.x + box.width, box.y, box.width, box.height) ); 1.1235 + 1.1236 + var max = createPoint(corners[0].x, corners[0].y); 1.1237 + var min = createPoint(corners[0].x, corners[0].y); 1.1238 + 1.1239 + for (var i = 1; i < corners.length; i++) { 1.1240 + var x = corners[i].x; 1.1241 + var y = corners[i].y; 1.1242 + if (x < min.x) { 1.1243 + min.x = x; 1.1244 + } 1.1245 + else if (x > max.x) { 1.1246 + max.x = x; 1.1247 + } 1.1248 + if (y < min.y) { 1.1249 + min.y = y; 1.1250 + } 1.1251 + else if (y > max.y) { 1.1252 + max.y = y; 1.1253 + } 1.1254 + } 1.1255 + 1.1256 + 1.1257 + var border_square = this.container.ownerDocument.createElement('v:rect'); 1.1258 + 1.1259 + border_square.style.position = 'relative'; 1.1260 + border_square.style.left = 0 - 10; 1.1261 + border_square.style.top = 0 - 10; 1.1262 + border_square.style.width = box.width + 20; 1.1263 + border_square.style.height = box.height + 20; 1.1264 + border_square.setAttribute('filled', 'false'); 1.1265 + border_square.setAttribute('stroked', 'true'); 1.1266 + border_square.setAttribute('strokecolor', 'blue'); 1.1267 + border_square.setAttribute('strokeweight', '1px'); 1.1268 + 1.1269 + 1.1270 + var border_angle = this.container.ownerDocument.createElement('v:polyline'); 1.1271 + border_angle.style.position = 'relative'; 1.1272 + 1.1273 + border_angle.setAttribute('filled', 'false'); 1.1274 + border_angle.setAttribute('stroked', 'true'); 1.1275 + border_angle.setAttribute('strokecolor', 'blue'); 1.1276 + border_angle.setAttribute('strokeweight', '1px'); 1.1277 + border_angle.setAttribute("points", (box.width+10)+","+((box.height/2))+", "+(box.width+10+25)+","+((box.height/2)) ); 1.1278 + 1.1279 + 1.1280 + var circle1 = this.container.ownerDocument.createElement('v:oval'); 1.1281 + circle1.style.position = 'relative'; 1.1282 + circle1.style.left = ( (box.width+40)-5); 1.1283 + circle1.style.top = ( (box.height / 2) -5); 1.1284 + circle1.style.width = (10); 1.1285 + circle1.style.height = (10); 1.1286 + circle1.setAttribute('filled', 'true'); 1.1287 + circle1.setAttribute('stroked', 'true'); 1.1288 + circle1.setAttribute('fillcolor', '#ffffff'); 1.1289 + circle1.setAttribute('strokecolor', 'green'); 1.1290 + circle1.setAttribute('strokeweight', '1px'); 1.1291 + 1.1292 + 1.1293 + var rect1 = this.container.ownerDocument.createElement('v:rect'); 1.1294 + rect1.style.position = 'relative'; 1.1295 + rect1.style.left = - 10-5; 1.1296 + rect1.style.top = - 10-5; 1.1297 + rect1.style.width = 10; 1.1298 + rect1.style.height = 10; 1.1299 + rect1.setAttribute('filled', 'true'); 1.1300 + rect1.setAttribute('stroked', 'true'); 1.1301 + rect1.setAttribute('fillcolor', '#ffffff'); 1.1302 + rect1.setAttribute('strokecolor', 'green'); 1.1303 + rect1.setAttribute('strokeweight', '1px'); 1.1304 + 1.1305 + 1.1306 + var rect2 = this.container.ownerDocument.createElement('v:rect'); 1.1307 + rect2.style.position = 'relative'; 1.1308 + rect2.style.left = box.width +5; 1.1309 + rect2.style.top = -10 -5; 1.1310 + rect2.style.width = 10; 1.1311 + rect2.style.height = 10; 1.1312 + rect2.setAttribute('filled', 'true'); 1.1313 + rect2.setAttribute('stroked', 'true'); 1.1314 + rect2.setAttribute('fillcolor', '#ffffff'); 1.1315 + rect2.setAttribute('strokecolor', 'green'); 1.1316 + rect2.setAttribute('strokeweight', '1px'); 1.1317 + 1.1318 + 1.1319 + var rect3 = this.container.ownerDocument.createElement('v:rect'); 1.1320 + rect3.style.position = 'relative'; 1.1321 + rect3.style.left = box.width+5; 1.1322 + rect3.style.top = box.height+5; 1.1323 + rect3.style.width = 10; 1.1324 + rect3.style.height = 10; 1.1325 + rect3.setAttribute('filled', 'true'); 1.1326 + rect3.setAttribute('stroked', 'true'); 1.1327 + rect3.setAttribute('fillcolor', '#ffffff'); 1.1328 + rect3.setAttribute('strokecolor', 'green'); 1.1329 + rect3.setAttribute('strokeweight', '1px'); 1.1330 + 1.1331 + var rect4 = this.container.ownerDocument.createElement('v:rect'); 1.1332 + rect4.style.position = 'relative'; 1.1333 + rect4.style.left = -10-5; 1.1334 + rect4.style.top = box.height+5; 1.1335 + rect4.style.width = 10; 1.1336 + rect4.style.height = 10; 1.1337 + rect4.setAttribute('filled', 'true'); 1.1338 + rect4.setAttribute('stroked', 'true'); 1.1339 + rect4.setAttribute('fillcolor', '#ffffff'); 1.1340 + rect4.setAttribute('strokecolor', 'green'); 1.1341 + rect4.setAttribute('strokeweight', '1px'); 1.1342 + 1.1343 + 1.1344 + 1.1345 + var rectmid12 = this.container.ownerDocument.createElement('v:rect'); 1.1346 + rectmid12.style.position = 'relative'; 1.1347 + rectmid12.style.left = (box.width/2) -5; 1.1348 + rectmid12.style.top =- 10-5; 1.1349 + rectmid12.style.width = 10; 1.1350 + rectmid12.style.height = 10; 1.1351 + rectmid12.setAttribute('filled', 'true'); 1.1352 + rectmid12.setAttribute('stroked', 'true'); 1.1353 + rectmid12.setAttribute('fillcolor', '#ffffff'); 1.1354 + rectmid12.setAttribute('strokecolor', 'green'); 1.1355 + rectmid12.setAttribute('strokeweight', '1px'); 1.1356 + 1.1357 + var rectmid23 = this.container.ownerDocument.createElement('v:rect'); 1.1358 + rectmid23.style.position = 'relative'; 1.1359 + rectmid23.style.left = box.width +5; 1.1360 + rectmid23.style.top = (box.height/2)-5; 1.1361 + rectmid23.style.width = 10; 1.1362 + rectmid23.style.height = 10; 1.1363 + rectmid23.setAttribute('filled', 'true'); 1.1364 + rectmid23.setAttribute('stroked', 'true'); 1.1365 + rectmid23.setAttribute('fillcolor', '#ffffff'); 1.1366 + rectmid23.setAttribute('strokecolor', 'green'); 1.1367 + rectmid23.setAttribute('strokeweight', '1px'); 1.1368 + 1.1369 + var rectmid34 = this.container.ownerDocument.createElement('v:rect'); 1.1370 + rectmid34.style.position = 'relative'; 1.1371 + rectmid34.style.left = (box.width/2)-5; 1.1372 + rectmid34.style.top = box.height+5; 1.1373 + rectmid34.style.width = 10; 1.1374 + rectmid34.style.height = 10; 1.1375 + rectmid34.setAttribute('filled', 'true'); 1.1376 + rectmid34.setAttribute('stroked', 'true'); 1.1377 + rectmid34.setAttribute('fillcolor', '#ffffff'); 1.1378 + rectmid34.setAttribute('strokecolor', '#000000'); 1.1379 + rectmid34.setAttribute('strokeweight', '1px'); 1.1380 + 1.1381 + 1.1382 + var rectmid41 = this.container.ownerDocument.createElement('v:rect'); 1.1383 + rectmid41.style.position = 'relative'; 1.1384 + rectmid41.style.left = -10-5 ; 1.1385 + rectmid41.style.top =(box.height/2)-5; 1.1386 + rectmid41.style.width = 10; 1.1387 + rectmid41.style.height = 10; 1.1388 + rectmid41.setAttribute('filled', 'true'); 1.1389 + rectmid41.setAttribute('stroked', 'true'); 1.1390 + rectmid41.setAttribute('fillcolor', '#ffffff'); 1.1391 + rectmid41.setAttribute('strokecolor', 'green'); 1.1392 + rectmid41.setAttribute('strokeweight', '1px'); 1.1393 + 1.1394 + 1.1395 + 1.1396 + 1.1397 + var colorin="#ff0000"; 1.1398 + var colorout="#ffffff" 1.1399 + 1.1400 + circle1.attachEvent("onmouseover", function(event) {circle1.style.cursor= 's-resize'; circle1.setAttribute('fillcolor', colorin ); typeTransform='Rotate'; scaleType='nw'; }, false); 1.1401 + circle1.attachEvent("onmouseout", function(event) {circle1.style.cursor= 'default'; circle1.setAttribute('fillcolor', colorout ); typeTransform='Rotate'; }, false); //typeTransform='rotate' 1.1402 + 1.1403 + 1.1404 + rect1.attachEvent("onmouseover", function(event) {rect1.style.cursor= 'nw-resize'; rect1.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='nw'; }, false); 1.1405 + rect1.attachEvent("onmouseout", function(event) {rect1.style.cursor= 'default'; rect1.setAttribute('fillcolor', colorout ); typeTransform='Scale'; }, false); //typeTransform='rotate' 1.1406 + 1.1407 + rect2.attachEvent("onmouseover", function(event) {rect2.style.cursor= 'ne-resize'; rect2.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='ne';}, false); 1.1408 + rect2.attachEvent("onmouseout", function(event) {rect2.style.cursor= 'default'; rect2.setAttribute('fillcolor', colorout ); typeTransform='Scale'; }, false); 1.1409 + 1.1410 + rect3.attachEvent("onmouseover", function(event) {rect3.style.cursor= 'se-resize'; rect3.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='se';}, false); 1.1411 + rect3.attachEvent("onmouseout", function(event) {rect3.style.cursor= 'default'; rect3.setAttribute('fillcolor', colorout ); typeTransform='Scale'; }, false); 1.1412 + 1.1413 + rect4.attachEvent("onmouseover", function(event) {rect4.style.cursor= 'sw-resize'; rect4.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='sw';}, false); 1.1414 + rect4.attachEvent("onmouseout", function(event) {rect4.style.cursor= 'default'; rect4.setAttribute('fillcolor', colorout ); typeTransform='Scale'; }, false); 1.1415 + 1.1416 + rectmid12.attachEvent("onmouseover", function(event) {rectmid12.style.cursor= 'n-resize'; rectmid12.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='n';}, false); 1.1417 + rectmid12.attachEvent("onmouseout", function(event) {rectmid12.style.cursor= 'default'; rectmid12.setAttribute('fillcolor', colorout ); typeTransform=''; }, false); 1.1418 + 1.1419 + rectmid23.attachEvent("onmouseover", function(event) {rectmid23.style.cursor= 'e-resize'; rectmid23.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='e';}, false); 1.1420 + rectmid23.attachEvent("onmouseout", function(event) {rectmid23.style.cursor= 'default'; rectmid23.setAttribute('fillcolor', colorout ); typeTransform=''; }, false); 1.1421 + 1.1422 + rectmid34.attachEvent("onmouseover", function(event) {rectmid34.style.cursor= 's-resize'; rectmid34.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='s';}, false); 1.1423 + rectmid34.attachEvent("onmouseout", function(event) {rectmid34.style.cursor= 'default'; rectmid34.setAttribute('fillcolor', colorout ); typeTransform=''; }, false); 1.1424 + 1.1425 + rectmid41.attachEvent("onmouseover", function(event) {rectmid41.style.cursor= 'w-resize'; rectmid41.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='w'; }, false); 1.1426 + rectmid41.attachEvent("onmouseout", function(event) {rectmid41.style.cursor= 'default'; rectmid41.setAttribute('fillcolor', colorout ); typeTransform=''; }, false); 1.1427 + //tracker.setAttribute('transform',trshape); 1.1428 + 1.1429 + 1.1430 + 1.1431 + tracker.appendChild(border_square); 1.1432 + tracker.appendChild(border_angle); 1.1433 + 1.1434 + tracker.appendChild(circle1); 1.1435 + 1.1436 + tracker.appendChild(rect1); 1.1437 + tracker.appendChild(rect2); 1.1438 + tracker.appendChild(rect3); 1.1439 + tracker.appendChild(rect4); 1.1440 + tracker.appendChild(rectmid12); 1.1441 + tracker.appendChild(rectmid23); 1.1442 + tracker.appendChild(rectmid34); 1.1443 + tracker.appendChild(rectmid41); 1.1444 + 1.1445 + /* 1.1446 + 1.1447 + 1.1448 + 1.1449 + */ 1.1450 + 1.1451 + //alert(shape.id) 1.1452 + this.container.appendChild(tracker); 1.1453 + 1.1454 + 1.1455 + 1.1456 +}