Mercurial > laserkard
diff onlypaths/js/vmlrendererPrev.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/vmlrendererPrev.js Sun Jan 31 12:33:33 2010 -0500 1.3 @@ -0,0 +1,2583 @@ 1.4 +/*---------------------------------------------------------------------------- 1.5 + VMLRENDERER 1.0 1.6 + VML Renderer For RichDraw 1.7 + ----------------------------------------------------------------------------- 1.8 + Created by Mark Finkle (mark.finkle@gmail.com) 1.9 + Implementation of VML based renderer. 1.10 + ----------------------------------------------------------------------------- 1.11 + Copyright (c) 2006 Mark Finkle 1.12 + 1.13 + This program is free software; you can redistribute it and/or modify it 1.14 + under the terms of the MIT License. 1.15 + 1.16 + Permission is hereby granted, free of charge, to any person obtaining a 1.17 + copy of this software and associated documentation files (the "Software"), 1.18 + to deal in the Software without restriction, including without limitation 1.19 + the rights to use, copy, modify, merge, publish, distribute, sublicense, 1.20 + and/or sell copies of the Software, and to permit persons to whom the 1.21 + Software is furnished to do so, subject to the following conditions: 1.22 + The above copyright notice and this permission notice shall be included in 1.23 + all copies or substantial portions of the Software. 1.24 + 1.25 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1.26 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1.27 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1.28 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1.29 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 1.30 + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 1.31 + DEALINGS IN THE SOFTWARE. 1.32 + ----------------------------------------------------------------------------- 1.33 + Dependencies: 1.34 + History: 1.35 + 2006-04-05 | Created 1.36 + --------------------------------------------------------------------------*/ 1.37 + 1.38 + 1.39 + 1.40 +function VMLRenderer() { 1.41 + this.base = AbstractRenderer; 1.42 +} 1.43 + 1.44 + 1.45 +VMLRenderer.prototype = new AbstractRenderer; 1.46 + 1.47 + 1.48 +VMLRenderer.prototype.init = function(elem) 1.49 + { 1.50 + this.container = elem; 1.51 + // this.container.style.overflow = 'hidden'; 1.52 + this.container.unselectable = "on"; 1.53 + // Add VML includes and namespace 1.54 + elem.ownerDocument.namespaces.add("v", "urn:schemas-microsoft-com:vml"); 1.55 + var style = elem.ownerDocument.createStyleSheet(); 1.56 + style.addRule('v\\:*', "behavior: url(#default#VML); display:inline-block"); 1.57 + //NOT VML biewBox 1.58 + //http://blogs.msdn.com/ie/archive/2008/03/18/webbrowser-control-rendering-modes-in-ie8.aspx 1.59 + } 1.60 + 1.61 +var proporx=1; 1.62 +var propory=1; 1.63 + 1.64 +VMLRenderer.prototype.view = function(left,top,width,height,viewBox,bgcolor) { 1.65 + var tokens = viewBox.split(' '); 1.66 + 1.67 + var margin=100; 1.68 + var wFront=parseInt(document.getElementById('FRONT').style.width) 1.69 + var hFront=parseInt(document.getElementById('FRONT').style.height) 1.70 + var tC=0 + ' ' + 0 + ' ' + wFront + ' ' + hFront; 1.71 + tokensCanvas= tC.split(' '); 1.72 + 1.73 + var w=parseFloat(tokens[2]); 1.74 + var h=parseFloat(tokens[3]); 1.75 + var wImage = w - parseFloat(tokens[0]); 1.76 + var hImage = h - parseFloat(tokens[1]); 1.77 + var wCanvas = wFront; 1.78 + var hCanvas = hFront; 1.79 + proporImage = hImage / wImage; 1.80 + proporCanvas = hCanvas / wCanvas; 1.81 + 1.82 + document.title= initialFile +' '+wImage+' x '+hImage; 1.83 + 1.84 + 1.85 + if(bgcolor != '') 1.86 + { 1.87 + this.container.style.backgroundColor=bgcolor; 1.88 + } else{ 1.89 + this.container.style.backgroundColor="#ffffff"; 1.90 + } 1.91 +if(viewMode=='preview') 1.92 + { 1.93 + if(proporCanvas==proporImage) 1.94 + { 1.95 + this.container.style.width =wFront+'px'; 1.96 + this.container.style.height =hFront+'px'; 1.97 + this.container.style.left =0+'px' 1.98 + this.container.style.top =0+'px' 1.99 + canvasLeft = 0; 1.100 + canvasTop = 0; 1.101 + canvasWidth =wFront ; 1.102 + canvasHeight = hFront; 1.103 + zoominit1= 0+' '+0+' '+wFront+' '+hFront; 1.104 + zoominit = viewBox; 1.105 + zoominit2 = zoominit1; 1.106 + 1.107 + 1.108 + proporx = 1; 1.109 + propory = 1; 1.110 + 1.111 + } 1.112 + if(proporCanvas<proporImage) 1.113 + { 1.114 + var proportion= wFront/hFront; 1.115 + //var image_proportion= width/height; 1.116 + var image_proportion= w/h; 1.117 + var W=hFront*image_proportion; 1.118 + var leftover=(wFront-W)/2; 1.119 + 1.120 + this.container.style.width =W+'px'; 1.121 + this.container.style.height =hFront+'px'; 1.122 + this.container.style.left =leftover+'px' 1.123 + this.container.style.top =0+'px' 1.124 + //alert('Horizontal '+wFront+','+hFront+' '+image_proportion+' '+W+' '+leftover+' ____'+ this.container.style.width) 1.125 + canvasLeft = leftover; 1.126 + canvasTop = 0; 1.127 + canvasWidth =W ; 1.128 + canvasHeight = hFront; 1.129 + zoominit1= viewBox;//leftover+' '+0+' '+W+' '+hFront; 1.130 + zoominit1=0+' '+0+' '+W+' '+hFront; 1.131 + zoominit = viewBox; 1.132 + zoominit2 = zoominit1; 1.133 + 1.134 + 1.135 + proporx = W/w; 1.136 + propory = hFront/h; 1.137 + 1.138 + 1.139 + } 1.140 + if(proporCanvas>proporImage) 1.141 + { 1.142 + var proportion= hFront/wFront; 1.143 + //var image_proportion= width/height; 1.144 + var image_proportion= h/w; 1.145 + var H=wFront*image_proportion; 1.146 + var leftover=(hFront-H)/2; 1.147 + 1.148 + this.container.style.width =wFront+'px'; 1.149 + this.container.style.height =H+'px'; 1.150 + this.container.style.left =0+'px' 1.151 + this.container.style.top =leftover+'px' 1.152 + 1.153 + canvasLeft = 0; 1.154 + canvasTop = leftover; 1.155 + canvasWidth = wFront; 1.156 + canvasHeight = H; 1.157 + //zoominit1 = 0+' '+leftover+' '+wFront+' '+H; 1.158 + zoominit1 = 0+' '+0+' '+wFront+' '+H; 1.159 + zoominit = viewBox; 1.160 + zoominit2 = viewBox;//zoominit1; 1.161 + 1.162 + proporx = wFront/w; 1.163 + propory = H/h; 1.164 + 1.165 + } 1.166 + // proporx = width/tokens[2]; 1.167 + //propory = height/tokens[2]; 1.168 + 1.169 + 1.170 + 1.171 + } 1.172 +if(viewMode=='canvas') 1.173 + { 1.174 + this.container.style.left = 0 + 'px'; 1.175 + this.container.style.top = 0 + 'px'; 1.176 + this.container.style.width = wFront + 'px'; 1.177 + this.container.style.height = hFront + 'px'; 1.178 + 1.179 + // margins 10% 1.180 + var percent=10; 1.181 + var percentX = wImage / percent; 1.182 + var percentY = hImage / percent; 1.183 + var cornerNEx = parseFloat(tokens[0])-percentX; 1.184 + var cornerNEy = parseFloat(tokens[1])-percentY; 1.185 + var percentRectW=wImage + percentX*2; 1.186 + var percentRectH=hImage + percentY*2; 1.187 + 1.188 + document.title= initialFile +' '+wImage+' x '+hImage; 1.189 + // ajust proporImage to proporCanvas 1.190 + if(proporCanvas==proporImage) 1.191 + { 1.192 + cornerNEx = parseFloat(tokens[0])-percentX 1.193 + cornerNEy = parseFloat(tokens[1])-percentY 1.194 + var wi=percentRectW; 1.195 + var he=percentRectH;//hImage+percentY+addHimage; 1.196 + zoominit=viewBox; 1.197 + zoominit1 = (-percentX) +' '+(-percentY)+' '+wi+' '+he; 1.198 + proporx =(w*(100-percent*2)/100)/w; 1.199 + propory =( h*(100-percent*2)/100)/h; 1.200 + zoominit2=zoominit1; 1.201 + tokensZoom=tokensCanvas;//viewBox.split(' '); ;//zoominit1.split(' '); 1.202 + 1.203 + } 1.204 + 1.205 + if(proporCanvas<proporImage) 1.206 + { 1.207 + 1.208 + // add to hImage 1.209 + var newWimage = percentRectW * ((wCanvas * percentRectH) / (hCanvas * percentRectW)) ;//newRectH * 1.210 + var diffImages=newWimage-w; 1.211 + cornerNEx = parseFloat(tokens[0]) - (diffImages / 2); 1.212 + var wi=newWimage; 1.213 + var he=percentRectH;//hImage+percentY+addHimage; 1.214 + zoominit=viewBox; 1.215 + //zoominit1 = cornerNEx+' '+cornerNEy+' '+wi+' '+he; 1.216 + //zoominit1 = (-percentX) +' '+(-percentY)+' '+wi+' '+he; 1.217 + proporx =wFront/wi; 1.218 + propory = wFront/wi; 1.219 + var invPropor =wi/ wFront; 1.220 + zoominit1 = (proporx*cornerNEx) +' '+(propory*cornerNEy)+' '+wi+' '+he; 1.221 + zoominit2=zoominit1; 1.222 + var tZ = (invPropor*cornerNEx) +' '+(invPropor*cornerNEy)+' '+wi+' '+he; 1.223 + 1.224 + 1.225 + tokensZoom=tokensCanvas;//tZ.split(' ');//viewBox.split(' '); ;//zoominit1.split(' '); 1.226 + } 1.227 + if(proporCanvas>proporImage) 1.228 + { 1.229 + // add to hImage 1.230 + var newHimage = percentRectH * ((hCanvas * percentRectW) / (wCanvas * percentRectH)) ;//newRectH * 1.231 + var diffImages=newHimage-h; 1.232 + cornerNEy = parseFloat(tokens[1]) - (diffImages / 2); 1.233 + var wi=percentRectW; 1.234 + var he=newHimage;//hImage+percentY+addHimage; 1.235 + zoominit=viewBox; 1.236 + proporx =wFront/wi; 1.237 + propory = wFront/wi; 1.238 + 1.239 + zoominit1 = (proporx*cornerNEx) +' '+(propory*cornerNEy)+' '+wi+' '+he; 1.240 + zoominit2=zoominit1; 1.241 + tokensZoom=zoominit1.split(' '); 1.242 + 1.243 + } 1.244 + 1.245 + 1.246 + } 1.247 +} 1.248 + 1.249 + 1.250 + 1.251 +VMLRenderer.prototype.zoomFrame = function(zoom){ 1.252 + myOPF.viewBox=zoom; 1.253 + load(myOPF,c); 1.254 + document.getElementById("source").value=myOPF.toJSONString(); 1.255 +} 1.256 +VMLRenderer.prototype.rectDoc = function(viewBox) { 1.257 + var tokens2 = zoominit2.split(' '); 1.258 + var tokens = zoominit.split(' '); 1.259 + var shape = document.getElementById('rectDoc'); 1.260 + if (shape) { 1.261 + this.remove(shape); 1.262 + } 1.263 + var rect=this.container.ownerDocument.createElement('v:rect'); 1.264 + rect.id='rectDoc'; 1.265 + rect.style.position = 'absolute'; 1.266 + rect.style.left =-parseInt(tokens2[0]); 1.267 + rect.style.top = -parseInt(tokens2[1]); 1.268 + rect.style.width = parseInt(tokens[2]); 1.269 + rect.style.height = parseInt(tokens[3]); 1.270 + rect.setAttribute('filled', 'false'); 1.271 + rect.setAttribute('stroked', 'true'); 1.272 + rect.setAttribute('strokeweight', 2); 1.273 + rect.setAttribute('strokecolor',"#ff0000"); 1.274 + //this.container.appendChild(rect); 1.275 + //this.container.insertBefore(rect, this.container.firstChild ); 1.276 + //alert(docx+' '+docy+' '+docw+' '+doch+' '+viewBox) 1.277 +} 1.278 +VMLRenderer.prototype.rectCanvas = function(docx,docy,docw,doch,viewBox) { 1.279 + 1.280 + var tokens = zoominit1.split(' '); 1.281 + var shape = document.getElementById('rectCanvas'); 1.282 + if (shape) { 1.283 + this.remove(shape); 1.284 + } 1.285 + 1.286 + var rect=this.container.ownerDocument.createElement('v:rect'); 1.287 + rect.id='rectBackground'; 1.288 + rect.style.position = 'absolute'; 1.289 + rect.style.left = tokens[0] ; 1.290 + rect.style.top =tokens[1]; 1.291 + rect.style.width=tokens[2]; 1.292 + rect.style.height= tokens[3] ; 1.293 + rect.setAttribute('filled', 'true'); 1.294 + rect.setAttribute('fillcolor',"#666666"); 1.295 + rect.setAttribute('stroked', 'false'); 1.296 + 1.297 + this.container.insertBefore(rect, this.container.firstChild ); 1.298 + 1.299 +} 1.300 + 1.301 +VMLRenderer.prototype.removeAll = function(){ 1.302 + while (this.container.hasChildNodes()) { 1.303 + this.container.removeChild(this.container.firstChild); 1.304 + } 1.305 +} 1.306 + 1.307 +function VMLviewBox(container,left,top,width,height){ 1.308 + var tokens = zoominit2.split(' '); 1.309 + left *= proporx; 1.310 + left = left - parseFloat(tokens[0]); 1.311 + top *= propory; 1.312 + top = top - parseFloat(tokens[1]); 1.313 + width *= proporx; 1.314 + height *= propory; 1.315 + 1.316 + return {"x":parseFloat(Math.round(left)), "y":parseFloat(Math.round(top)), "w":parseFloat(Math.round(width)), "h":parseFloat(Math.round(height))}; 1.317 +} 1.318 +function VMLviewBox1(container,left,top,width,height){ 1.319 + var tokens = zoominit2.split(' '); 1.320 + left *= proporx; 1.321 + left = left - parseFloat(tokens[0]); 1.322 + top *= propory; 1.323 + top = top - parseFloat(tokens[1]); 1.324 + width *= proporx; 1.325 + height *= propory; 1.326 + 1.327 + return {"x":parseFloat(Math.round(left)), "y":parseFloat(Math.round(top)), "w":parseFloat(Math.round(width)), "h":parseFloat(Math.round(height))}; 1.328 +} 1.329 + 1.330 +VMLRenderer.prototype.create = function(shape, fillColor, lineColor, fillOpac, lineOpac, lineWidth, left, top, width, height, textMessaje, textSize, textFamily, imageHref, points, transform, parent) { 1.331 + var tokens = zoominit2.split(' '); 1.332 + 1.333 + var zoom=VMLviewBox(this.container,left,top,width,height); 1.334 + 1.335 + left=zoom.x; 1.336 + top=zoom.y; 1.337 + width=zoom.w; 1.338 + height=zoom.h; 1.339 + 1.340 + var zoom=VMLviewBox(this.container,left,top,textSize,textSize); 1.341 + //if(zoom.w<1){zoom.w=1} 1.342 + if(zoom.y== undefined){left=0} 1.343 + if(zoom.x== undefined){top=0} 1.344 + if(zoom.w== undefined){width=0} 1.345 + if(zoom.h== undefined){height=0} 1.346 + textSize=zoom.h; 1.347 + 1.348 + var zoom=VMLviewBox(this.container,left,top,lineWidth*2/3,lineWidth); 1.349 + //if(zoom.w<1){zoom.w=1} 1.350 + lineWidth=zoom.w; 1.351 + var vml; 1.352 + var shap=1; 1.353 + if (shape == 'rect') { 1.354 + 1.355 + vml = this.container.ownerDocument.createElement('v:rect'); 1.356 + vml.style.position = 'absolute'; 1.357 + vml.style.left = left; 1.358 + vml.style.top = top; 1.359 + vml.style.width = width; 1.360 + vml.style.height = height; 1.361 + } 1.362 + else if (shape == 'roundrect') { 1.363 + vml = this.container.ownerDocument.createElement('v:roundrect'); 1.364 + vml.style.position = 'absolute'; 1.365 + vml.style.left = left; 1.366 + vml.style.top = top; 1.367 + vml.style.width = width; 1.368 + vml.style.height = height; 1.369 + vml.setAttribute('arcsize', '20%'); 1.370 + 1.371 + } 1.372 + else if (shape == 'ellipse') { 1.373 + vml = this.container.ownerDocument.createElement('v:oval'); 1.374 + vml.style.left = left; 1.375 + vml.style.top = top; 1.376 + vml.style.width = width; 1.377 + vml.style.height = height; 1.378 + vml.style.position = 'absolute'; 1.379 + } 1.380 + else if (shape == 'line') { 1.381 + 1.382 + vml = this.container.ownerDocument.createElement('v:line'); 1.383 + vml.setAttribute('from', left + 'px,' + top + 'px'); 1.384 + vml.setAttribute('to', left + 'px,' + top + 'px'); 1.385 + 1.386 + } 1.387 + else if (shape == 'polyline') { 1.388 + vml = this.container.ownerDocument.createElement('v:polyline'); 1.389 + vml.setAttribute("points", points); 1.390 + 1.391 + } 1.392 + else if (shape == 'path') 1.393 + { 1.394 + vml = this.container.ownerDocument.createElement('v:shape'); 1.395 + var tokens = zoominit1.split(' '); 1.396 + var tokens1 = zoominit1.split(' '); 1.397 + var tokens2 = zoominit2.split(' '); 1.398 + tokens[0]=0; 1.399 + tokens[1]=0; 1.400 + var path=points; 1.401 + path=path.replace(/, /g, ','); 1.402 + path=path.replace(/ ,/g, ','); 1.403 + var ps =path.split(" ") 1.404 + var pcc = ""; 1.405 + 1.406 + var re = /^[-]?\d*\.?\d*$/; 1.407 + var contArc=0; 1.408 + var isArc=false; 1.409 + for(var i = 0; i < ps.length; i++) 1.410 + { 1.411 + if(ps[i].indexOf(',')>0){ 1.412 + 1.413 + var point =ps[i].split(","); 1.414 + var char1=point[0].substring(0,1); 1.415 + 1.416 + if (!char1.match(re)) 1.417 + { 1.418 + var num0prev= parseFloat(point[0].substring(1)); 1.419 + var zoom=VMLviewBox(this.container,num0prev*1+(parseInt(tokens2[0])*0),0,parseInt(tokens2[2]),parseInt(tokens2[3])); 1.420 + num0=zoom.x; 1.421 + 1.422 + var text=char1; 1.423 + }else{ 1.424 + var num0prev= parseFloat(point[0]); 1.425 + var zoom=VMLviewBox(this.container,num0prev*1+(parseInt(tokens2[0])*0),0,parseInt(tokens2[2]),parseInt(tokens2[3])); 1.426 + num0=zoom.x; 1.427 + 1.428 + } 1.429 + point[1]= parseFloat(point[1]); 1.430 + var zoom=VMLviewBox(this.container,0,point[1],parseInt(tokens2[2]),parseInt(tokens2[3])); 1.431 + point[1]=zoom.y; 1.432 + var cx=num0+parseInt(tokens2[0]); 1.433 + var cy=point[1]+parseInt(tokens2[1]); 1.434 + pcc+=text+cx+','+cy+' '; 1.435 + } 1.436 + else 1.437 + { 1.438 + pcc+=ps[i]+' '; 1.439 + } 1.440 + 1.441 + } 1.442 + //////////////////// 1.443 + var thispath=pcc; 1.444 + thispath=thispath.replace(/M/g,'m'); 1.445 + thispath=thispath.replace(/C/g,'c'); 1.446 + thispath=thispath.replace(/L/g,'l'); 1.447 + thispath=thispath.replace(/z/g,'x'); 1.448 + 1.449 + //document.getElementById('source').value=points+'\r\n'+thispath +'\r\n'+'________'+'\r\n' 1.450 + var zoom=VMLviewBox(this.container,tokens[0],tokens[1],tokens[2],tokens[3]); 1.451 + 1.452 + vml.style.position="absolute"; 1.453 + vml.style.width= zoom.w+"px"; 1.454 + vml.style.height=zoom.h+"px"; 1.455 + vml.style.left=zoom.x+"px"; 1.456 + vml.style.top=zoom.y+"px"; 1.457 + vml.setAttribute('coordsize', zoom.w+','+zoom.h); 1.458 + 1.459 + var path01 = this.container.ownerDocument.createElement('v:path'); 1.460 + path01.setAttribute("v", thispath+' e'); 1.461 + 1.462 + 1.463 + 1.464 + vml.appendChild(path01) 1.465 + 1.466 + } 1.467 + 1.468 + else if (shape == 'controlpath') 1.469 + { 1.470 + 1.471 + vml = this.container.ownerDocument.createElement('v:shape'); 1.472 + vml.style.position="absolute"; 1.473 + vml.style.width= 700+"px"; 1.474 + vml.style.height=500+"px"; 1.475 + vml.style.left=left+"px"; 1.476 + vml.style.top=top+"px"; 1.477 + vml.setAttribute('coordsize', '700,500'); 1.478 + 1.479 + var path01 = this.container.ownerDocument.createElement('v:path'); 1.480 + path01.setAttribute('v', 'm '+left+','+top+' c'+(left+1)+','+(top+1)+' e '); 1.481 + 1.482 + vml.appendChild(path01) 1.483 + } 1.484 + else if (shape == 'image') { 1.485 + var data =imageHref;//document.forms[0].option_text_message.value; 1.486 + vml = this.container.ownerDocument.createElement('v:image'); 1.487 + vml.setAttribute('src',imageHref); 1.488 + vml.style.position="absolute"; 1.489 + vml.style.width=width+"px"; 1.490 + vml.style.height=height+"px"; 1.491 + vml.style.left=left+"px"; 1.492 + vml.style.top=top+"px"; 1.493 + vml.style.margin=0+"px"; 1.494 + vml.style.padding=0+"px"; 1.495 + if (fillColor != '' || fillColor != 'none') { 1.496 + vml.setAttribute('filled', 'false'); 1.497 + vml.setAttribute('fillcolor', fillColor); 1.498 + } 1.499 + else { 1.500 + vml.setAttribute('filled', 'false'); 1.501 + } 1.502 + vml.setAttribute('strokeweight','0px');// parseFloat(lineWidth)+'px'); 1.503 + vml.setAttribute('stroked', 'false'); 1.504 + vml.setAttribute('strokecolor','#000000');//lineColor); 1.505 + 1.506 + 1.507 + } 1.508 + 1.509 + else if (shape == 'text') 1.510 + { 1.511 + 1.512 + var data =textMessaje; 1.513 + vml = this.container.ownerDocument.createElement('v:shape'); 1.514 + vml.style.position="absolute"; 1.515 + //vml.setAttribute('coordorigin',left+', '+top); 1.516 + //vml.style.coorsize= ''; 1.517 + coordorigin="0, 0" 1.518 + 1.519 + var ts=isNaN(textSize) 1.520 + if(ts==true){ 1.521 + textSize=10; 1.522 + } 1.523 + vml.style.width= textSize+'px';//tokens[2]+'px' 1.524 + vml.style.height=textSize+'px'; 1.525 + vml.style.left=(left+"px"); 1.526 + vml.style.top=(top-(textSize*1/4)+"px"); 1.527 + vml.style.margin=0+"px"; 1.528 + vml.style.padding=0+"px"; 1.529 + vml.setAttribute('path','m '+0+' '+0+' r '+(textSize*data.length)+' '+0+' e'); 1.530 + var textPathObj = this.container.ownerDocument.createElement("v:textpath"); 1.531 + textPathObj.setAttribute('string', data); 1.532 + textPathObj.setAttribute('fitshape','false'); 1.533 + textPathObj.setAttribute('trim', 'false'); 1.534 + textPathObj.setAttribute('fitpath', 'false'); 1.535 + textPathObj.setAttribute('on','true'); 1.536 + textPathObj.style.fontFamily=textFamily; 1.537 + textPathObj.style.fontSize=textSize+'px'; 1.538 + textPathObj.setAttribute('vTextKern','true'); 1.539 + textPathObj.setAttribute('text-align','center'); 1.540 + 1.541 + var pathObj = this.container.ownerDocument.createElement("v:path"); 1.542 + pathObj.setAttribute('textpathok', 'true'); 1.543 + vml.appendChild(textPathObj); 1.544 + vml.appendChild(pathObj); 1.545 + 1.546 + 1.547 + } 1.548 + 1.549 + 1.550 + 1.551 + else if (shape == 'texto') 1.552 + { 1.553 + vml = this.container.ownerDocument.createElement('v:shape'); 1.554 + vml.style.position="absolute"; 1.555 + 1.556 + vml.style.coordsize=1000+', '+1000; 1.557 + vml.style.width= 1000; 1.558 + vml.style.height=1000; 1.559 + vml.style.left=left; 1.560 + vml.style.top=top-parseFloat(textSize); 1.561 + 1.562 + vml.style.padding=0; 1.563 + var textBox = this.container.ownerDocument.createElement("v:textbox"); 1.564 + textBox.setAttribute('mso-rotate-with-shape',true) 1.565 + var divtext = this.container.ownerDocument.createElement("div"); 1.566 + divtext.style.coordorigin=0+', '+(0); 1.567 + divtext.style.margin=0; 1.568 + divtext.style.fontFamily=textFamily; 1.569 + divtext.style.margin=0; 1.570 + divtext.style.padding=0; 1.571 + divtext.style.vRotateLetters=true; 1.572 + divtext.style.fontSize=parseFloat(textSize); 1.573 + 1.574 + 1.575 + 1.576 + 1.577 + 1.578 + 1.579 + divtext.style.color=fillColor; 1.580 + 1.581 + 1.582 + 1.583 + 1.584 + 1.585 + //divtext.setAttribute('v-rotate-letters','true'); 1.586 + if(transform.indexOf('rotate')>=0) 1.587 + { 1.588 + 1.589 + myRotate1=transform.split('rotate('); 1.590 + myRotate2=myRotate1[1].split(')'); 1.591 + myRotate3=myRotate2[0].split(','); 1.592 + 1.593 + //divtext.setAttribute('mso-rotate',myRotate3[0]); 1.594 + //textBox.style.msoRotate= myRotate3[0]; 1.595 + //textBox.style.centerX=myRotate3[1]; 1.596 + //textBox.style.centerY=myRotate3[2]; 1.597 + //vml.style.rotation= myRotate3[0]; 1.598 + //vml.style.centerX=myRotate3[1]; 1.599 + //vml.style.centerY=myRotate3[2]; 1.600 + vml.setAttribute('rotation',myRotate3[0]+'Deg'); 1.601 + } 1.602 + 1.603 + divtext.innerHTML=textMessaje; 1.604 + textBox.appendChild(divtext); 1.605 + 1.606 + vml.appendChild(textBox); 1.607 + 1.608 + } 1.609 + else if (shape == 'defs') { 1.610 + var vml; 1.611 + 1.612 + } 1.613 + 1.614 + else if (shape == 'group') { 1.615 + vml = this.container.ownerDocument.createElement('v:group'); 1.616 + vml.style.left=left+"px"; 1.617 + vml.style.top=top+"px"; 1.618 + } 1.619 + 1.620 + if(shape == 'zoom' || shape == 'defs') 1.621 + { 1.622 + 1.623 + }else 1.624 + { 1.625 + if(transform.indexOf('rotate')>=0) 1.626 + { 1.627 + myRotate1=transform.split('rotate('); 1.628 + myRotate2=myRotate1[1].split(')'); 1.629 + myRotate3=myRotate2[0].split(','); 1.630 + 1.631 + vml.style.rotation= myRotate3[0]+'Deg'; 1.632 + vml.style.centerX=myRotate3[1]; 1.633 + vml.style.centerY=myRotate3[2]; 1.634 + 1.635 + } 1.636 + 1.637 + if(shape != 'image' ) 1.638 + { 1.639 + //alert(fillColor) 1.640 + if (fillColor != '' || fillColor != 'none' ) 1.641 + { 1.642 + vml.setAttribute('filled', 'true'); 1.643 + vml.setAttribute('fillcolor', fillColor); 1.644 + 1.645 + } 1.646 + else 1.647 + { 1.648 + vml.setAttribute('filled', 'false'); 1.649 + } 1.650 + 1.651 + 1.652 + if(lineWidth==0 || lineWidth=='none' || lineColor== 'none' ) 1.653 + { 1.654 + vml.setAttribute('stroked', 'false'); 1.655 + } 1.656 + else 1.657 + { 1.658 + //if(isNaN(lineColor)==false){alert('-'+lineColor+'-');lineColor='#000000';lineWidth=1;} 1.659 + vml.setAttribute('stroked', 'true'); 1.660 + vml.setAttribute('strokecolor', lineColor); 1.661 + vml.setAttribute('strokeweight', lineWidth); 1.662 + var stroke = this.container.ownerDocument.createElement('v:stroke'); 1.663 + stroke.setAttribute("opacity", parseFloat(lineOpac)); 1.664 + vml.appendChild(stroke); 1.665 + 1.666 + } 1.667 + 1.668 + if (fillOpac != '') 1.669 + { 1.670 + if (fillOpac == 'none' || fillColor=='none'){fillOpac=0;} 1.671 + var fill = this.container.ownerDocument.createElement('v:fill'); 1.672 + fill.setAttribute("opacity",parseFloat(fillOpac)); 1.673 + //alert(fillOpac) 1.674 + vml.appendChild(fill); 1.675 + } 1.676 + } 1.677 + } 1.678 + if(parent==''){ 1.679 + if(vml){ 1.680 + this.container.appendChild(vml);} 1.681 + }else{ 1.682 + if(document.getElementById(parent)){ 1.683 + var parentShape = document.getElementById(parent); 1.684 + if(vml||vml!=null ){ 1.685 + parentShape.appendChild(vml); 1.686 + } 1.687 + } 1.688 + } 1.689 + //var parentDoc = document.getElementById('mydraw'); 1.690 + //parentDoc.appendChild(vml); 1.691 + return vml; 1.692 +}; 1.693 + 1.694 + 1.695 + 1.696 +VMLRenderer.prototype.zoom = function(clicx,clicy) 1.697 + { 1.698 + } 1.699 + 1.700 +VMLRenderer.prototype.datacreate = function(fillColor, lineColor, fillOpac, lineOpac, lineWidth, left, top, width, height, textMessaje, textSize, textFamily, imageHref, transform) 1.701 + { 1.702 + } 1.703 + 1.704 +VMLRenderer.prototype.duplicate = function(shape) 1.705 + { 1.706 + var vml; 1.707 + vml =shape.cloneNode(false); 1.708 + //vml.setAttribute('fillcolor', "#aa00aa"); 1.709 + //vml.setAttribute('filled', "false"); 1.710 + this.container.appendChild(vml); 1.711 + return vml; 1.712 + 1.713 + }; 1.714 + 1.715 +VMLRenderer.prototype.querySelected = function(shape,centerx,centery,width,height) 1.716 +{ 1.717 + var result = true; 1.718 + var shapes='names: group, image, rect, path, ellipse, circle, text, line, '; 1.719 + 1.720 + //if(shape.getBBox && shape) 1.721 + if( shapes.indexOf(' '+shape.tagName+',')>0) 1.722 + { 1.723 + 1.724 + var box = this.bounds(shape); 1.725 + }else 1.726 + { 1.727 + return false; 1.728 + } 1.729 + var p1x = box.x; 1.730 + if(Math.abs(p1x-centerx)>width){result = false} 1.731 + 1.732 + var p1y = box.y; 1.733 + if(Math.abs(p1y-centery)>height){result = false} 1.734 + 1.735 + var p2x = box.x+box.width; 1.736 + if(Math.abs(p2x-centerx)>width){result = false} 1.737 + 1.738 + var p2y = box.y; 1.739 + if(Math.abs(p2y-centery)>height){result = false} 1.740 + 1.741 + var p3x = box.x+box.width; 1.742 + if(Math.abs(p3x-centerx)>width){result = false} 1.743 + 1.744 + var p3y = box.y+box.height; 1.745 + if(Math.abs(p3y-centery)>height){result = false} 1.746 + 1.747 + var p4x = box.x; 1.748 +if(Math.abs(p4x-centerx)>width){result = false} 1.749 + 1.750 + var p4y = box.y+box.height; 1.751 + if(Math.abs(p4y-centery)>height){result = false} 1.752 + 1.753 + if(result) 1.754 + { 1.755 + return { 'in':result, 'cornersx': p1x+','+p2x+','+p3x+','+p4x+',' ,'cornersy': p1y+','+p2y+','+p3y+','+p4y+',' }; 1.756 + } 1.757 + else 1.758 + { 1.759 + return { 'in':result } 1.760 + } 1.761 +//center.distanceFrom(point1); 1.762 + 1.763 + 1.764 +} 1.765 + 1.766 +VMLRenderer.prototype.searchBoxes = function() 1.767 +{ 1.768 + var base = this.container; 1.769 + 1.770 + var NumNodes = base.childNodes.length; 1.771 + var chain= ''; 1.772 + for(i = 0;i < NumNodes;i++) 1.773 + { 1.774 + if (this.bounds(base.childNodes[i])) 1.775 + { 1.776 + chain+=base.childNodes[i].id + ';' 1.777 + } 1.778 + } 1.779 + chain+='' 1.780 + return chain; 1.781 + 1.782 +} 1.783 + 1.784 +VMLRenderer.prototype.DrawBorder= function(numNode, targetElement ) 1.785 +{ 1.786 + var shapes='names: group, image, rect, path, ellipse, circle, text, line, '; 1.787 + 1.788 + //if(shape.getBBox && shape) 1.789 + if( shapes.indexOf(' '+targetElement.tagName+',')>0) 1.790 + { 1.791 + var bbox = this.bounds(targetElement); 1.792 + 1.793 + var outline = this.container.ownerDocument.createElement('v:rect'); 1.794 + outline.setAttribute('x', bbox.x - 2 ); 1.795 + outline.setAttribute('y', bbox.y - 2 ); 1.796 + outline.setAttribute('width', bbox.width + 4 ); 1.797 + outline.setAttribute('height', bbox.height + 4 ); 1.798 + outline.setAttribute('stroke', '#ff00ff' ); 1.799 + outline.setAttribute('fill', 'none' ); 1.800 + outline.setAttribute('id', 'shapeBoxed'+numNode ); 1.801 + 1.802 + targetElement.parentNode.insertBefore( outline, targetElement ); 1.803 + return 'shapeBoxed'+numNode; 1.804 + } 1.805 + else 1.806 + { 1.807 + return false 1.808 + } 1.809 +} 1.810 + 1.811 + 1.812 +VMLRenderer.prototype.index = function(shape,order) { 1.813 + 1.814 + if(order==-1) 1.815 + { 1.816 + this.container.appendChild( shape ); 1.817 + } 1.818 + if(order==0){ 1.819 + 1.820 + this.container.insertBefore( shape, shape.parentNode.firstChild ); 1.821 + } 1.822 + 1.823 + if(order==1 || order==2) 1.824 + { 1.825 + var id=shape.getAttribute('id'); 1.826 + //alert(id); 1.827 + 1.828 + 1.829 + var numNodes=this.container.childNodes.length; 1.830 + //alert(numNodes); 1.831 + 1.832 + var num=0; 1.833 + for(var i = 1; i < numNodes; i++) 1.834 + { 1.835 + 1.836 + var etiq=this.container.childNodes[i].getAttribute('id'); 1.837 + if (etiq==id) 1.838 + { 1.839 + num=i; 1.840 + 1.841 + } 1.842 + } 1.843 + //alert(num); 1.844 + if(order==1) 1.845 + { 1.846 + if((num-1)>=-1) 1.847 + { 1.848 + this.container.insertBefore( shape, this.container.childNodes[num-1]); 1.849 + } 1.850 + } 1.851 + if(order==2){ 1.852 + if((num+1)<numNodes) 1.853 + { 1.854 + this.container.insertBefore( shape, this.container.childNodes[num+2]); 1.855 + } 1.856 + } 1.857 + 1.858 + } 1.859 + 1.860 + 1.861 + 1.862 +} 1.863 +VMLRenderer.prototype.remove = function(shape) { 1.864 + if(shape!=null){ shape.removeNode(true); } 1.865 +} 1.866 + 1.867 + 1.868 +VMLRenderer.prototype.copy = function(shape) 1.869 + { 1.870 + var vml; 1.871 + vml =shape.cloneNode(false); 1.872 + //vml.setAttribute('fillcolor', "#aa00aa"); 1.873 + return vml; 1.874 + }; 1.875 + 1.876 + 1.877 +VMLRenderer.prototype.paste = function(clipboard,left,top) 1.878 + { 1.879 + this.container.appendChild(clipboard); 1.880 + return clipboard; 1.881 + }; 1.882 + 1.883 + 1.884 + 1.885 +VMLRenderer.prototype.undo = function() 1.886 + { 1.887 + this.container.removeChild( this.container.lastChild ); 1.888 + }; 1.889 + 1.890 + 1.891 +var xshe=0; 1.892 +var yshe=0; 1.893 +var isArc=false; 1.894 +var contArc=0; 1.895 + 1.896 +VMLRenderer.prototype.move = function(shape, left, top,fromX,FromY) { 1.897 + var box = this.bounds(shape); 1.898 + var angle=0; 1.899 + var dist=0; 1.900 + var rotated=false; 1.901 + 1.902 + 1.903 + 1.904 + 1.905 + 1.906 + //contmove++; 1.907 + if (shape.tagName == 'line') { 1.908 + shape.style.marginLeft = left; 1.909 + shape.style.marginTop = top; 1.910 + } 1.911 + if (shape.tagName == 'polyline') { 1.912 + shape.style.marginLeft = left; 1.913 + shape.style.marginTop = top; 1.914 + 1.915 + } 1.916 + if (shape.tagName == 'oval') { 1.917 + shape.style.left = left; 1.918 + shape.style.top = top; 1.919 + } 1.920 + if (shape.tagName == 'rect') { 1.921 + shape.style.left = left; 1.922 + shape.style.top = top; 1.923 + } 1.924 + 1.925 + if (shape.tagName == 'image') { 1.926 + shape.style.left = left; 1.927 + shape.style.top = top; 1.928 + } 1.929 + if (shape.tagName == 'shape') { 1.930 + 1.931 + shape.style.left=left+"px"; 1.932 + shape.style.top=top+"px"; 1.933 + 1.934 + } 1.935 + 1.936 + 1.937 +}; 1.938 + 1.939 + 1.940 +VMLRenderer.prototype.track = function(shape) { 1.941 + // TODO 1.942 +}; 1.943 + 1.944 +VMLRenderer.prototype.clic = function(shape) { 1.945 + var end=''; 1.946 + if(data_path_close==true){end=' ';} 1.947 + 1.948 + var thispath='m '+setPoints[0]+' l'; 1.949 + var maxcont=setPoints.length; 1.950 + 1.951 + for(var conta=1;conta< maxcont;conta++){ 1.952 + thispath+=setPoints[conta]+' '; 1.953 + 1.954 + 1.955 + } 1.956 + var path=thispath+end+' e'; 1.957 + shape.style.position="absolute"; 1.958 + shape.style.width= 700+"px"; 1.959 + shape.style.height=500+"px"; 1.960 + shape.style.left="0px"; 1.961 + shape.style.top="0px"; 1.962 + 1.963 + 1.964 + shape.children[0].setAttribute("v",path); 1.965 + document.forms[0].control_codebase.value=path; 1.966 + 1.967 +} 1.968 + 1.969 + 1.970 +VMLRenderer.prototype.resize = function(shape, fromX, fromY, toX, toY) { 1.971 + //var vml; 1.972 + var deltaX = toX - fromX; 1.973 + var deltaY = toY - fromY; 1.974 + var shap=1; 1.975 + if (shape.tagName == 'line') { shap=0; } 1.976 + if (shape.tagName == 'polyline') { shap=2; } 1.977 + 1.978 + if (shape.tagName == 'line') { 1.979 + shape.setAttribute('to', toX + 'px,' + toY + 'px'); 1.980 + } 1.981 + if (shap == 1) { 1.982 + if (deltaX < 0) { 1.983 + shape.style.left = toX + 'px'; 1.984 + shape.style.width = -deltaX + 'px'; 1.985 + } 1.986 + else { 1.987 + shape.style.width = deltaX + 'px'; 1.988 + } 1.989 + 1.990 + if (deltaY < 0) { 1.991 + shape.style.top = toY + 'px'; 1.992 + shape.style.height = -deltaY + 'px'; 1.993 + } 1.994 + else { 1.995 + shape.style.height = deltaY + 'px'; 1.996 + } 1.997 + } 1.998 + if (shap == 2) { 1.999 + xpArray.push(toX); 1.1000 + ypArray.push(toY); 1.1001 + 1.1002 + //xpArray.push(finetoX); 1.1003 + //ypArray.push(finetoY); 1.1004 + 1.1005 + var thispath=' '+xpArray[1]+','+ypArray[1]; 1.1006 + var maxcont=xpArray.length; 1.1007 + //alert(maxcont); 1.1008 + for(var conta=2;conta< maxcont;conta++){ 1.1009 + thispath+=' '+xpArray[conta]+','+ypArray[conta]; 1.1010 + } 1.1011 + //alert(shape.points[1]); 1.1012 + //shape.setAttribute("points",thispath); 1.1013 + shape.points.Value = thispath; 1.1014 + 1.1015 + /* 1.1016 + var thispath=''+xpArray[0]+','+ypArray[0]; 1.1017 + var thispatho=new Array(); 1.1018 + thispatho.push(toX); 1.1019 + thispatho.push(toY); 1.1020 + var maxcont=xpArray.length; 1.1021 + //alert(maxcont); 1.1022 + for(var conta=2;conta< maxcont;conta++){ 1.1023 + thispath+=','+xpArray[conta]+','+ypArray[conta]; 1.1024 + } 1.1025 + //alert(shape.points[1]); 1.1026 + shape.setAttribute("points",thispath); 1.1027 + */ 1.1028 + } 1.1029 + if(shape.tagName == 'shape') 1.1030 + { 1.1031 + 1.1032 + if (selectmode == 'controlpath') 1.1033 + { 1.1034 + 1.1035 + var end=''; 1.1036 + if(data_path_close==true){end=' ';} 1.1037 + 1.1038 + var thispath='m '+setPoints[0]+' l'; 1.1039 + var maxcont=setPoints.length; 1.1040 + 1.1041 + for(var conta=1;conta< maxcont;conta++){ 1.1042 + thispath+=setPoints[conta]+' '; 1.1043 + 1.1044 + 1.1045 + } 1.1046 + var path=thispath+toX+','+toY+end+' e'; 1.1047 + 1.1048 + shape.style.position="absolute"; 1.1049 + shape.style.width= 700+"px"; 1.1050 + shape.style.height=500+"px"; 1.1051 + shape.style.left="0px"; 1.1052 + shape.style.top="0px"; 1.1053 + 1.1054 + shape.children[0].setAttribute("v",path); 1.1055 + document.forms[0].control_codebase.value=path; 1.1056 + 1.1057 + 1.1058 + } 1.1059 + else 1.1060 + { 1.1061 + 1.1062 + xpArray.push(toX); 1.1063 + ypArray.push(toY); 1.1064 + 1.1065 + //xpArray.push(finetoX); 1.1066 + //ypArray.push(finetoY); 1.1067 + var thispath2=''; 1.1068 + var thispath1=' '+xpArray[1]+','+ypArray[1]; 1.1069 + var maxcont=xpArray.length; 1.1070 + //alert(maxcont); 1.1071 + for(var conta=2;conta< maxcont ;conta++){ 1.1072 + thispath2+=''+xpArray[conta]+','+ypArray[conta]+','; 1.1073 + if((conta+2)%3==0){thispath2+='';} 1.1074 + } 1.1075 + thispath2+=''+xpArray[maxcont]+','+ypArray[maxcont]+''; 1.1076 + 1.1077 + //alert(shape.points[1]); 1.1078 + //appendChild(path01) 1.1079 + //var path01=shape.getFirstChild(); 1.1080 + var path01 = this.container.ownerDocument.createElement('v:path'); 1.1081 + path01.setAttribute("v", "m"+thispath1+" l"+ thispath2+" e"); 1.1082 + //shape.margin-left="300px"; 1.1083 + //shape.margin-top="200px"; 1.1084 + 1.1085 + //shape.setAttribute('path','m '+thispath1+ ' c'+thispath2+' e'); 1.1086 + if(shape.children[0].tagName=='textpath') 1.1087 + { 1.1088 + var path01 = this.container.ownerDocument.createElement('v:path'); 1.1089 + path01.setAttribute("v", 'm 100 100 l 600 100 e'); 1.1090 + 1.1091 + //if(xpArray.length>1) 1.1092 + //{ shap.style.position="absolute"; 1.1093 + shape.style.width=100+"px"; 1.1094 + shape.style.height=100+"px"; 1.1095 + shape.style.left=toX+"px"; 1.1096 + shape.style.top=toY+"px"; 1.1097 + shape.style.margin=0+"px"; 1.1098 + shape.style.padding=0+"px"; 1.1099 + shape.appendChild(path01); 1.1100 + //} 1.1101 + } 1.1102 + else 1.1103 + { 1.1104 + shape.style.position="absolute"; 1.1105 + shape.style.width= 700+"px"; 1.1106 + shape.style.height=500+"px"; 1.1107 + shape.style.left="0px"; 1.1108 + shape.style.top="0px"; 1.1109 + //shape.setAttribute('coordsize', '700,500'); 1.1110 + shape.appendChild(path01); 1.1111 + } 1.1112 + 1.1113 + //shape.setAttribute('position', 'absolute'); 1.1114 + //shape.translate(xpArray[conta+1]+','+ypArray[conta+1]); 1.1115 + //shape.setAttribute('coordsize', '700,500'); 1.1116 + // shape.v.Value ='M '+thispath1+ ' C'+thispath2+' x e'; 1.1117 + //shape.v.Value = 'M '+thispath+ ' c '+thispath2; 1.1118 + //shape.setAttribute("v", 'M '+thispath+ ' C '+thispath2); 1.1119 + //shape.setAttribute('path','M '+thispath+ ' C '+thispath2); 1.1120 + } 1.1121 + } 1.1122 + 1.1123 +}; 1.1124 + 1.1125 + 1.1126 +VMLRenderer.prototype.tocurve = function() { 1.1127 + 1.1128 + 1.1129 +}; 1.1130 + 1.1131 + 1.1132 +VMLRenderer.prototype.info = function(shape) 1.1133 +{ 1.1134 +var shInfo = {}; 1.1135 +shInfo.id = shape.id; 1.1136 + shInfo.type = shape.tagName; 1.1137 + if (shape.tagName == 'rect') 1.1138 + { 1.1139 + shInfo.left = parseFloat(shape.getAttribute( 'x')); 1.1140 + shInfo.top = parseFloat(shape.getAttribute( 'y')); 1.1141 + shInfo.width = parseFloat(shape.getAttribute('width')); 1.1142 + shInfo.height = parseFloat(shape.getAttribute('height')); 1.1143 + //++ 1.1144 + //shInfo.rotate = parseFloat(shape.getAttribute('rotation')); 1.1145 + } 1.1146 + else if (shape.tagName == 'oval') 1.1147 + { 1.1148 + shInfo.width = parseFloat(shape.getAttribute('rx'))*2; 1.1149 + shInfo.height = parseFloat(shape.getAttribute('ry'))*2; 1.1150 + shInfo.left = (shInfo.width * 2) - parseFloat(shape.getAttribute('rx')); 1.1151 + shInfo.top = (shInfo.height * 2) - parseFloat(shape.getAttribute('ry')); 1.1152 + 1.1153 + } 1.1154 + else if (shape.tagName == 'roundrect') 1.1155 + { 1.1156 + shInfo.left = parseFloat(shape.getAttribute('x')); 1.1157 + shInfo.top = parseFloat(shape.getAttribute('y')); 1.1158 + shInfo.width = parseFloat(shape.getAttribute('width')); 1.1159 + shInfo.height = parseFloat(shape.getAttribute('height')); 1.1160 + 1.1161 + } 1.1162 + else if (shape.tagName == 'line') 1.1163 + { 1.1164 + shInfo.left = parseFloat(shape.getAttribute('x1')); 1.1165 + shInfo.top = parseFloat(shape.getAttribute('y1')); 1.1166 + 1.1167 + } 1.1168 + else if (shape.tagName == 'polyline') 1.1169 + { 1.1170 + shInfo.points = shape.getAttribute('points'); 1.1171 + } 1.1172 + else if (shape.tagName == 'image') 1.1173 + { 1.1174 + shInfo.left = parseFloat(shape.getAttribute('x')); 1.1175 + shInfo.top = parseFloat(shape.getAttribute('y')); 1.1176 + shInfo.width = parseFloat(shape.getAttribute('width')); 1.1177 + shInfo.height = parseFloat(shape.getAttribute('height')); 1.1178 + shInfo.src = shape.getAttribute('src'); 1.1179 + } 1.1180 + else 1.1181 + 1.1182 + if (shape.tagName == 'shape') 1.1183 + { 1.1184 + if(shape.children[0].tagName=='path') { 1.1185 + shInfo.d = shape.getAttribute('v'); 1.1186 + this.editor.log(shape.getAttribute('v')); 1.1187 + 1.1188 + } 1.1189 + if(shape.children[0].tagName=='textpath') { 1.1190 + shInfo['font-family'] = shape.children[0].getAttribute('font-family') 1.1191 + shInfo['font-size'] = parseInt(shape.children[0].getAttribute('font-size')) 1.1192 + shInfo.top = parseFloat(shape.children[0].getAttribute('y')) 1.1193 + shInfo.left = parseFloat(shape.children[0].getAttribute('x')) 1.1194 + shInfo.text = shape.textContent 1.1195 + 1.1196 + } 1.1197 + } 1.1198 + return shInfo; 1.1199 + 1.1200 + 1.1201 +} 1.1202 +VMLRenderer.prototype.transformShape = function(shape,data,transform) 1.1203 +{ 1.1204 + 1.1205 + if(shape.tagName == 'rect') 1.1206 + { 1.1207 + 1.1208 + var box = this.bounds(shape); 1.1209 + var sdata=data.split(';'); 1.1210 + 1.1211 + //alert(data[0]); 1.1212 + shape.style.top = parseFloat(sdata[0]) + 'px'; 1.1213 + shape.style.left = parseFloat(sdata[1]) + 'px'; 1.1214 + shape.style.width = parseFloat(sdata[2]) + 'px'; 1.1215 + shape.style.height = parseFloat(sdata[3]) + 'px'; 1.1216 + 1.1217 + 1.1218 + 1.1219 + // var centerx=parseFloat(sdata[0])+parseFloat(box.width/2); 1.1220 + // var centery=parseFloat(sdata[1])+parseFloat(box.height/2); 1.1221 + shape.style.rotation=parseFloat(sdata[4]); 1.1222 + 1.1223 + //shape.nodparseFloatue=data; 1.1224 + } 1.1225 + else 1.1226 + if(shape.tagName == 'text') 1.1227 + { 1.1228 + if(data.indexOf('<;>',0)==-1 ) 1.1229 + { 1.1230 + shape.textContent = data; 1.1231 + } 1.1232 + else 1.1233 + { 1.1234 + var sdata=data.split('<;>'); //????????? 1.1235 + shape.textContent = sdata[0]; 1.1236 + shape.setAttribute('font-size',parseFloat(sdata[1])); 1.1237 + shape.setAttribute('font-family',sdata[2]); 1.1238 + } 1.1239 + //shape.nodparseFloatue=data; 1.1240 + } 1.1241 + else 1.1242 + if (shape.tagName == 'polyline') 1.1243 + { 1.1244 + shape.setAttribute('points',data); 1.1245 + } 1.1246 + else 1.1247 + if (shape.tagName == 'image') 1.1248 + { 1.1249 + //alert(data); 1.1250 + if(data.indexOf(';',0)==-1 ) 1.1251 + { 1.1252 + shape.setAttribute('src',data); 1.1253 + } 1.1254 + else 1.1255 + { 1.1256 + var box = this.bounds(shape); 1.1257 + var sdata=data.split(';'); 1.1258 + shape.style.top = parseFloat(sdata[0]) + 'px'; 1.1259 + shape.style.left = parseFloat(sdata[1]) + 'px'; 1.1260 + shape.style.width = parseFloat(sdata[2]) + 'px'; 1.1261 + shape.style.height = parseFloat(sdata[3]) + 'px'; 1.1262 + var centerx=parseFloat(sdata[0])+parseFloat(box.width/2); 1.1263 + var centery=parseFloat(sdata[1])+parseFloat(box.height/2); 1.1264 + shape.style.rotation=parseFloat(sdata[4]); 1.1265 + 1.1266 + 1.1267 + } 1.1268 + 1.1269 + } 1.1270 + else 1.1271 + if (shape.tagName == 'path') 1.1272 + { 1.1273 + if(data.indexOf(';',0)==-1 ) 1.1274 + { 1.1275 + //shape.setAttribute( 'd', data); //???????? 1.1276 + //shape.setAttribute( 'transform', transform); 1.1277 + } 1.1278 + else 1.1279 + { 1.1280 + var box = this.bounds(shape); 1.1281 + var sdata=data.split(';'); 1.1282 + var centerx=parseFloat(sdata[0])+parseFloat(box.width/2); 1.1283 + var centery=parseFloat(sdata[1])+parseFloat(box.height/2); 1.1284 + //++shape.setAttribute( 'transform','scale('+parseFloat(sdata[2])+','+parseFloat(sdata[3])+')'+' rotate('+parseFloat(sdata[4])+','+centerx+','+centery+')'+' translate('+parseFloat(sdata[0])+','+parseFloat(sdata[1])+')'); 1.1285 + 1.1286 + 1.1287 + } 1.1288 + } 1.1289 + 1.1290 + 1.1291 +} 1.1292 +VMLRenderer.prototype.editShape = function(shape,data) 1.1293 +{ 1.1294 +if(shape.tagName == 'text'){ 1.1295 +shape.textContent = data 1.1296 +}else 1.1297 + if (shape.tagName == 'polyline') 1.1298 + { 1.1299 + shape.setAttribute('points',data); 1.1300 + } 1.1301 + else 1.1302 + 1.1303 + if (shape.tagName == 'path') 1.1304 + { 1.1305 + shape.setAttribute('v', data); 1.1306 + 1.1307 + } 1.1308 + 1.1309 + 1.1310 +} 1.1311 +VMLRenderer.prototype.editCommand = function(shape, cmd, value) 1.1312 +{ 1.1313 + if (shape != null) { 1.1314 + if (cmd == 'fillcolor') { 1.1315 + if (value != '') { 1.1316 + shape.filled = 'true'; 1.1317 + shape.fillcolor = value; 1.1318 + } 1.1319 + else { 1.1320 + shape.filled = 'false'; 1.1321 + shape.fillcolor = ''; 1.1322 + } 1.1323 + } 1.1324 + else if (cmd == 'linecolor') { 1.1325 + if (value != '') { 1.1326 + shape.stroked = 'true'; 1.1327 + shape.strokecolor = value; 1.1328 + } 1.1329 + else { 1.1330 + shape.stroked = 'false'; 1.1331 + shape.strokecolor = ''; 1.1332 + } 1.1333 + } 1.1334 + else if (cmd == 'linewidth') { 1.1335 + shape.strokeweight = parseInt(value) + 'px'; 1.1336 + } 1.1337 + else if (cmd == 'fillopacity') { 1.1338 + 1.1339 + shape.fill.opacity= parseFloat(value); 1.1340 + //shape.style.fill.setAttribute("opacity", parseFloat(value)); 1.1341 + 1.1342 + } 1.1343 + } 1.1344 +} 1.1345 + 1.1346 + 1.1347 +VMLRenderer.prototype.queryCommand = function(shape, cmd) 1.1348 +{ 1.1349 + if (shape != null) { 1.1350 + if (cmd == 'fillcolor') { 1.1351 + if (shape.filled == 'false') 1.1352 + return ''; 1.1353 + else 1.1354 + return shape.fillcolor; 1.1355 + } 1.1356 + else if (cmd == 'linecolor') { 1.1357 + if (shape.stroked == 'false') 1.1358 + return ''; 1.1359 + else 1.1360 + return shape.strokecolor; 1.1361 + } 1.1362 + else if (cmd == 'linewidth') { 1.1363 + if (shape.stroked == 'false') { 1.1364 + return ''; 1.1365 + } 1.1366 + else { 1.1367 + // VML always transforms the pixels to points, so we have to convert them back 1.1368 + return (parseFloat(shape.strokeweight) * (screen.logicalXDPI / 72)) + 'px'; 1.1369 + } 1.1370 + } 1.1371 + } 1.1372 +} 1.1373 + 1.1374 +VMLRenderer.prototype.getProperties = function(shape) 1.1375 +{ 1.1376 + var result = ''; 1.1377 + 1.1378 + if (shape != null) 1.1379 + { 1.1380 + result = shape.getAttribute('fillcolor'); 1.1381 + if (result == 'none') 1.1382 + { 1.1383 + mefillColor.visible = 'hidden'; 1.1384 + mefillColor.hex = '#000000'; 1.1385 + filldraw=true; 1.1386 + setbe(1,'img_okfill'); 1.1387 + } 1.1388 + else 1.1389 + { 1.1390 + //alert(mefillColor.hex+' '+result); 1.1391 + mefillColor.visible = 'visible'; 1.1392 + mefillColor.hex = result; 1.1393 + var rgb=hex2rgb(result) 1.1394 + mefillColor.r=rgb[0]; 1.1395 + mefillColor.g=rgb[1]; 1.1396 + mefillColor.b=rgb[2]; 1.1397 + filldraw=false; 1.1398 + setbe(1,'img_okfill'); 1.1399 + 1.1400 + } 1.1401 + 1.1402 + result = shape.getAttribute('strokecolor'); 1.1403 + if (result == 'none') 1.1404 + { 1.1405 + mestrokeColor.visible = 'hidden'; 1.1406 + mestrokeColor.hex = '#000000'; 1.1407 + mestrokeColor.width = 0; 1.1408 + strokedraw=true; 1.1409 + setbe(2,'img_okstroke'); 1.1410 + 1.1411 + } 1.1412 + else 1.1413 + { 1.1414 + mestrokeColor.visible = 'visible'; 1.1415 + mestrokeColor.hex = result; 1.1416 + var rgb=hex2rgb(result) 1.1417 + mestrokeColor.r=rgb[0]; 1.1418 + mestrokeColor.g=rgb[1]; 1.1419 + mestrokeColor.b=rgb[2]; 1.1420 + strokedraw=false; 1.1421 + setbe(2,'img_okstroke'); 1.1422 + 1.1423 + } 1.1424 + 1.1425 + result = shape.getAttribute('strokeweight'); 1.1426 + mestrokeColor.width = result; 1.1427 + 1.1428 + result = shape.fill.getAttribute('opacity'); 1.1429 + mefillColor.opacity = result; 1.1430 + 1.1431 + result = shape.stroke.getAttribute('opacity'); 1.1432 + mestrokeColor.opacity = result; 1.1433 + 1.1434 + setProperties(); 1.1435 + } 1.1436 +} 1.1437 + 1.1438 + 1.1439 +VMLRenderer.prototype.showMultiSelect = function(iniX,iniY) { 1.1440 + var tracker = document.getElementById('trackerMultiSelect'); 1.1441 + if (tracker) { 1.1442 + this.remove(tracker); 1.1443 + } 1.1444 + var coord=this.editor.inputxy; 1.1445 + toX=parseFloat(coord[0]); 1.1446 + toY=parseFloat(coord[1]); 1.1447 + 1.1448 + tracker = this.container.ownerDocument.createElement('v:rect'); 1.1449 + 1.1450 + tracker.style.position = 'relative'; 1.1451 + tracker.style.left = iniX; 1.1452 + tracker.style.top = iniY; 1.1453 + tracker.style.width = toX ; 1.1454 + tracker.style.height = toY; 1.1455 + tracker.setAttribute('filled', 'false'); 1.1456 + tracker.setAttribute('stroked', 'true'); 1.1457 + tracker.setAttribute('strokecolor', 'blue'); 1.1458 + tracker.setAttribute('strokeweight', '1px'); 1.1459 + 1.1460 + this.container.appendChild(tracker); 1.1461 +} 1.1462 + 1.1463 +function mouseCoord() 1.1464 +{ 1.1465 + var coord=this.editor.inputxy; 1.1466 + coord[0]=parseFloat(coord[0]); 1.1467 + coord[1]=parseFloat(coord[1]); 1.1468 + return coord 1.1469 +} 1.1470 + 1.1471 +var memoNode=null; 1.1472 +var memoPrevControl=new Array(); 1.1473 +var memoNextControl=new Array(); 1.1474 +VMLRenderer.prototype.nodeMove = function(newx,newy) { 1.1475 + var mypath=$('control_codebase').value; 1.1476 + var x= $('option_path_x').value; 1.1477 + var y= $('option_path_y').value; 1.1478 + var precoord=x+','+y; 1.1479 + 1.1480 + $('option_path_x').value=newx; 1.1481 + $('option_path_y').value=newy; 1.1482 + 1.1483 + var cadx= newx; 1.1484 + var cady= newy; 1.1485 + 1.1486 + var coord=cadx+','+cady; 1.1487 + var cad1=new RegExp(precoord,"g"); 1.1488 + 1.1489 + 1.1490 + var result=mypath.replace(cad1, coord); 1.1491 + 1.1492 + 1.1493 + $('control_codebase').value=result; 1.1494 + 1.1495 + $('someinfo').value=precoord; 1.1496 + setShape(); 1.1497 + 1.1498 +} 1.1499 + 1.1500 +function drawNodeControl(vml,numId){ 1.1501 + var color1='#0066ff'; 1.1502 + // if(parseInt(memoNode.id)==a){ 1.1503 + 1.1504 + var pointprev=memoPrevControl[numId].split(','); 1.1505 + var controlNode1 = this.container.ownerDocument.createElement('v:rect'); 1.1506 + controlNode1.setAttribute('x', pointprev[0]-2); 1.1507 + controlNode1.setAttribute('y', pointprev[1]-2); 1.1508 + 1.1509 + controlNode1.setAttribute('width', 4); 1.1510 + controlNode1.setAttribute('height', 4); 1.1511 + controlNode1.setAttribute('fillcolor', color1); 1.1512 + controlNode1.setAttribute('strokecolor', '#000000'); 1.1513 + controlNode1.setAttribute('strokeweight', '0'); 1.1514 + controlNode1.setAttribute('id', 'controlNode1'); 1.1515 + controlNode1.addEventListener("mousedown", function(event) {if(memoNode != null){memoNode.setAttribute('strokeweight', 0 );} memoNode=this; this.setAttribute('fillcolor', '#ffff00' );this.setAttribute('strokeweight', 1 );$('option_path_num').value=this.getAttributeNS(null,'id'); $('option_path_x').value=parseFloat(this.getAttribute('x'))+2; $('option_path_y').value=parseFloat(this.getAttribute('y'))+2; }, false); 1.1516 + vml.appendChild(controlNode1); 1.1517 + 1.1518 + var pointnext=memoNextControl[numId].split(','); 1.1519 + 1.1520 + 1.1521 + var controlNode2 =this.container.ownerDocument.createElement('v:rect'); 1.1522 + controlNode2.setAttribute('x', pointnext[0]-2); 1.1523 + controlNode2.setAttribute('y', pointnext[1]-2); 1.1524 + 1.1525 + controlNode2.setAttribute('width', 4); 1.1526 + controlNode2.setAttribute('height', 4); 1.1527 + controlNode2.setAttribute('fillcolor', color1); 1.1528 + controlNode2.setAttribute('strokecolor', '#000000'); 1.1529 + controlNode2.setAttribute('strokeweight', '0'); 1.1530 + controlNode2.setAttribute('id', 'controlNode1'); 1.1531 + controlNode2.addEventListener("mousedown", function(event) {if(memoNode != null){memoNode.setAttribute('strokeweight', 0 );} memoNode=this; this.setAttribute('fillcolor', '#ffff00' );this.setAttribute('strokeweight', 1 );$('option_path_num').value=this.getAttributeNS(null,'id'); $('option_path_x').value=parseFloat(this.getAttribute('x'))+2; $('option_path_y').value=parseFloat(this.getAttribute('y'))+2; }, false); 1.1532 + vml.appendChild(controlNode2); 1.1533 + 1.1534 + //} 1.1535 + 1.1536 + 1.1537 +} 1.1538 + 1.1539 +VMLRenderer.prototype.showNodesCurve = function(path){ 1.1540 + var points=path.split('c'); 1.1541 + var chain=''; 1.1542 + var segment=' '; 1.1543 + var numpoints=points.length-1; 1.1544 + for(var a=1;a<numpoints;a++) 1.1545 + { 1.1546 + segment=points[a].split(' '); 1.1547 + chain+=segment[0]+' '; 1.1548 + } 1.1549 + 1.1550 + $('someinfo').value=numpoints+ ' nodes '; 1.1551 + return chain; 1.1552 + 1.1553 +}; 1.1554 + 1.1555 + 1.1556 + 1.1557 +VMLRenderer.prototype.showTracker = function(shape) { 1.1558 + var box = this.bounds(shape); 1.1559 + var trshape = parseFloat(shape.getAttribute('rotation')); 1.1560 + var tracker = document.getElementById('tracker'); 1.1561 + if (tracker) { 1.1562 + this.remove(tracker); 1.1563 + } 1.1564 + 1.1565 + if (shape.tagName == 'shape') 1.1566 + { 1.1567 + shap=2; 1.1568 + if(shape.children[0].tagName == 'path') 1.1569 + { 1.1570 + 1.1571 + /* $('option_path_trx').value= box.x; 1.1572 + $('option_path_try').value= box.y; 1.1573 + $('option_path_sclx').value= box.width; 1.1574 + $('option_path_scly').value= box.height; 1.1575 + $('option_path_rot').value= shape.style.rotation; 1.1576 + */ 1.1577 + var path=shape.children[0].getAttribute('v'); 1.1578 + $('control_codebase').value=path; 1.1579 + } 1.1580 + } 1.1581 + if (shape.tagName == 'rect') { 1.1582 + 1.1583 + $('option_rect_rot').value= shape.getAttribute('rotation'); 1.1584 + $('option_rect_trx').value= box.x; 1.1585 + $('option_rect_try').value= box.y; 1.1586 + $('option_rect_sclx').value= box.width; 1.1587 + $('option_rect_scly').value= box.height; 1.1588 + 1.1589 + } 1.1590 + 1.1591 + if (shape.tagName == 'image'){ 1.1592 + /* $('option_img_trx').value= box.x; 1.1593 + $('option_img_try').value= box.y; 1.1594 + $('option_img_sclx').value= box.width; 1.1595 + $('option_img_scly').value= box.height; 1.1596 + $('option_img_rot').value= T.b* (Math.PI * 2 / 360); 1.1597 + */ 1.1598 + } 1.1599 + if (shape.tagName == 'text'){ 1.1600 + /* f$('option_text_trx').value= box.x; 1.1601 + $('option_text_try').value= box.y; 1.1602 + $('option_text_sclx').value= box.width; 1.1603 + $('option_text_scly').value= box.height; 1.1604 + $('option_text_rot').value= T.b* (Math.PI * 2 / 360); 1.1605 + */ 1.1606 + } 1.1607 + if (shape.tagName == 'line'){ 1.1608 + /* 1.1609 + $('option_line_trx').value= box.x; 1.1610 + $('option_line_try').value= box.y; 1.1611 + */ 1.1612 + } 1.1613 + if (shape.tagName == 'oval'){ 1.1614 + /*$('option_ellipse_trx').value= putx; 1.1615 + $('option_ellipse_try').value= puty; 1.1616 + $('option_ellipse_sclx').value= box.width; 1.1617 + $('option_ellipse_scly').value= box.height; 1.1618 + $('option_ellipse_rot').value= T.b* (Math.PI * 2 / 360); 1.1619 + */ 1.1620 + } 1.1621 + 1.1622 + 1.1623 + 1.1624 + /*var matrix = shape.getScreenCTM(); 1.1625 + var trshape= shape.getAttribute('transform'); 1.1626 + var shap=1; 1.1627 + if (shape.tagName == 'path') { shap=2; 1.1628 + 1.1629 + 1.1630 + 1.1631 + } 1.1632 + */ 1.1633 + //if (shape.getAttribute('transform') ) { shap=2; } 1.1634 + //var svgNamespace = 'http://www.w3.org/2000/svg'; 1.1635 + 1.1636 + tracker = this.container.ownerDocument.createElement('v:group'); 1.1637 + tracker.id = 'tracker'; 1.1638 + //tracker.setAttribute('rotation',trshape); 1.1639 + tracker.setAttribute('coordorigin','0, 0'); 1.1640 + //tracker.setAttribute('wrapcoords',true); 1.1641 + 1.1642 + 1.1643 + tracker.setAttribute('coordsize',box.width+','+ box.height); 1.1644 + tracker.style.position = 'absolute'; 1.1645 + tracker.style.left = box.x ; 1.1646 + tracker.style.top = box.y; 1.1647 + tracker.style.width = box.width ; 1.1648 + tracker.style.height = box.height ; 1.1649 + 1.1650 + 1.1651 + 1.1652 + 1.1653 + 1.1654 + 1.1655 + 1.1656 + 1.1657 + 1.1658 + //////////////// 1.1659 + 1.1660 + /* 1.1661 + 1.1662 + var trshape='translate (0,0) rotate(0) translate(0,0) '; 1.1663 + var trshape_split=trshape.split(') '); 1.1664 + 1.1665 + // get_between (trshape, s1, s2) ; 1.1666 + if(shape.getAttribute('transform')){ 1.1667 + var trshape=shape.getAttribute('transform') ; 1.1668 + //var spl=trshape.replace(', ',' '); 1.1669 + //var spl1=spl.replace(')',' '); 1.1670 + var trshape_split=trshape.split(') '); 1.1671 + 1.1672 + 1.1673 + } 1.1674 + */ 1.1675 + 1.1676 + var corners = []; 1.1677 + var point = createPoint(box.x, box.y, box.width, box.height); 1.1678 + //point = {x:box.x, y:box.y, width: box.width, height:box.height}; 1.1679 +//point = createPoint(box.x, box.y, box.width, box.height); 1.1680 + //1 1.1681 + corners.push( createPoint(box.x + box.width, box.y, box.width, box.height) ); 1.1682 + point.x = box.x + box.width; 1.1683 + point.y = box.y; 1.1684 + //2 1.1685 + corners.push( createPoint(box.x + box.width, box.y + box.height, box.width, box.height) ); 1.1686 + point.x = box.x + box.width; 1.1687 + point.y = box.y + box.height; 1.1688 + //3 1.1689 + //corners.push( point.matrixTransform(matrix) ); 1.1690 + corners.push( createPoint(box.x , box.y + box.height, box.width, box.height) ); 1.1691 + point.x = box.x; 1.1692 + point.y = box.y + box.height; 1.1693 + //4 1.1694 + corners.push( createPoint(box.x + box.width, box.y, box.width, box.height) ); 1.1695 + 1.1696 + var max = createPoint(corners[0].x, corners[0].y); 1.1697 + var min = createPoint(corners[0].x, corners[0].y); 1.1698 + 1.1699 + // identify the new corner coordinates of the 1.1700 + // fully transformed bounding box 1.1701 + 1.1702 + for (var i = 1; i < corners.length; i++) { 1.1703 + var x = corners[i].x; 1.1704 + var y = corners[i].y; 1.1705 + if (x < min.x) { 1.1706 + min.x = x; 1.1707 + } 1.1708 + else if (x > max.x) { 1.1709 + max.x = x; 1.1710 + } 1.1711 + if (y < min.y) { 1.1712 + min.y = y; 1.1713 + } 1.1714 + else if (y > max.y) { 1.1715 + max.y = y; 1.1716 + } 1.1717 + } 1.1718 + 1.1719 + 1.1720 + var border_square = this.container.ownerDocument.createElement('v:rect'); 1.1721 + 1.1722 + border_square.style.position = 'relative'; 1.1723 + border_square.style.left = 0 - 10; 1.1724 + border_square.style.top = 0 - 10; 1.1725 + border_square.style.width = box.width + 20; 1.1726 + border_square.style.height = box.height + 20; 1.1727 + border_square.setAttribute('filled', 'false'); 1.1728 + border_square.setAttribute('stroked', 'true'); 1.1729 + border_square.setAttribute('strokecolor', 'blue'); 1.1730 + border_square.setAttribute('strokeweight', '1px'); 1.1731 + 1.1732 + 1.1733 + var border_angle = this.container.ownerDocument.createElement('v:polyline'); 1.1734 + border_angle.style.position = 'relative'; 1.1735 + 1.1736 + //border_angle.setAttribute('from',(box.width+10) + 'px,' + (box.height/2) + 'px'); 1.1737 + //border_angle.setAttribute('to', (box.width+10+25) + 'px,' + (box.width+10) + 'px'); 1.1738 + border_angle.setAttribute('filled', 'false'); 1.1739 + border_angle.setAttribute('stroked', 'true'); 1.1740 + border_angle.setAttribute('strokecolor', 'blue'); 1.1741 + border_angle.setAttribute('strokeweight', '1px'); 1.1742 + border_angle.setAttribute("points", (box.width+10)+","+((box.height/2))+", " 1.1743 + +(box.width+10+25)+","+((box.height/2)) ); 1.1744 + 1.1745 + 1.1746 + /* var path01 = this.container.ownerDocument.createElement('v:path'); 1.1747 + //path01.setAttribute("v", "m "+thispath+" c"+ thispath2+" e "); 1.1748 + path01.setAttribute("v", "m"+(min.x-10)+","+ (min.y-10)+" r"+(box.width+20)+","+(0)+" r"+(0)+","+(box.height+20)+" r"+(-box.width-20)+','+(0)+"x e m"+(box.x+box.width+10)+","+ (box.y+(box.height/2))+" r"+(25)+",0 e "); 1.1749 + border.appendChild(path01) 1.1750 + */ 1.1751 + //border.setAttribute('stroke-width', '1'); 1.1752 + 1.1753 +// createRect(min.x, min.y, max.x - min.x, max.y - min.y); 1.1754 + 1.1755 + 1.1756 + /* tracker = this.container.ownerDocument.createElement('v:rect'); 1.1757 + tracker.id = 'tracker'; 1.1758 + tracker.style.position = 'absolute'; 1.1759 + tracker.style.left = box.x - 10; 1.1760 + tracker.style.top = box.y - 10; 1.1761 + tracker.style.width = box.width + 20; 1.1762 + tracker.style.height = box.height + 20; 1.1763 + tracker.setAttribute('filled', 'false'); 1.1764 + tracker.setAttribute('stroked', 'true'); 1.1765 + tracker.setAttribute('strokecolor', 'blue'); 1.1766 + tracker.setAttribute('strokeweight', '1px'); 1.1767 + this.container.appendChild(tracker); 1.1768 + */ 1.1769 + var circle1 = this.container.ownerDocument.createElement('v:oval'); 1.1770 + circle1.style.position = 'relative'; 1.1771 + circle1.style.left = ( (box.width+40)-5); 1.1772 + circle1.style.top = ( (box.height / 2) -5); 1.1773 + circle1.style.width = (10); 1.1774 + circle1.style.height = (10); 1.1775 + circle1.setAttribute('filled', 'true'); 1.1776 + circle1.setAttribute('stroked', 'true'); 1.1777 + circle1.setAttribute('fillcolor', '#ffffff'); 1.1778 + circle1.setAttribute('strokecolor', 'green'); 1.1779 + circle1.setAttribute('strokeweight', '1px'); 1.1780 + 1.1781 + 1.1782 + var rect1 = this.container.ownerDocument.createElement('v:rect'); 1.1783 + rect1.style.position = 'relative'; 1.1784 + rect1.style.left = - 10-5; 1.1785 + rect1.style.top = - 10-5; 1.1786 + rect1.style.width = 10; 1.1787 + rect1.style.height = 10; 1.1788 + rect1.setAttribute('filled', 'true'); 1.1789 + rect1.setAttribute('stroked', 'true'); 1.1790 + rect1.setAttribute('fillcolor', '#ffffff'); 1.1791 + rect1.setAttribute('strokecolor', 'green'); 1.1792 + rect1.setAttribute('strokeweight', '1px'); 1.1793 + 1.1794 + 1.1795 + var rect2 = this.container.ownerDocument.createElement('v:rect'); 1.1796 + rect2.style.position = 'relative'; 1.1797 + rect2.style.left = box.width +5; 1.1798 + rect2.style.top = -10 -5; 1.1799 + rect2.style.width = 10; 1.1800 + rect2.style.height = 10; 1.1801 + rect2.setAttribute('filled', 'true'); 1.1802 + rect2.setAttribute('stroked', 'true'); 1.1803 + rect2.setAttribute('fillcolor', '#ffffff'); 1.1804 + rect2.setAttribute('strokecolor', 'green'); 1.1805 + rect2.setAttribute('strokeweight', '1px'); 1.1806 + 1.1807 + 1.1808 + var rect3 = this.container.ownerDocument.createElement('v:rect'); 1.1809 + rect3.style.position = 'relative'; 1.1810 + rect3.style.left = box.width+5; 1.1811 + rect3.style.top = box.height+5; 1.1812 + rect3.style.width = 10; 1.1813 + rect3.style.height = 10; 1.1814 + rect3.setAttribute('filled', 'true'); 1.1815 + rect3.setAttribute('stroked', 'true'); 1.1816 + rect3.setAttribute('fillcolor', '#ffffff'); 1.1817 + rect3.setAttribute('strokecolor', 'green'); 1.1818 + rect3.setAttribute('strokeweight', '1px'); 1.1819 + 1.1820 + var rect4 = this.container.ownerDocument.createElement('v:rect'); 1.1821 + rect4.style.position = 'relative'; 1.1822 + rect4.style.left = -10-5; 1.1823 + rect4.style.top = box.height+5; 1.1824 + rect4.style.width = 10; 1.1825 + rect4.style.height = 10; 1.1826 + rect4.setAttribute('filled', 'true'); 1.1827 + rect4.setAttribute('stroked', 'true'); 1.1828 + rect4.setAttribute('fillcolor', '#ffffff'); 1.1829 + rect4.setAttribute('strokecolor', 'green'); 1.1830 + rect4.setAttribute('strokeweight', '1px'); 1.1831 + 1.1832 + 1.1833 + 1.1834 + var rectmid12 = this.container.ownerDocument.createElement('v:rect'); 1.1835 + rectmid12.style.position = 'relative'; 1.1836 + rectmid12.style.left = (box.width/2) -5; 1.1837 + rectmid12.style.top =- 10-5; 1.1838 + rectmid12.style.width = 10; 1.1839 + rectmid12.style.height = 10; 1.1840 + rectmid12.setAttribute('filled', 'true'); 1.1841 + rectmid12.setAttribute('stroked', 'true'); 1.1842 + rectmid12.setAttribute('fillcolor', '#ffffff'); 1.1843 + rectmid12.setAttribute('strokecolor', 'green'); 1.1844 + rectmid12.setAttribute('strokeweight', '1px'); 1.1845 + 1.1846 + var rectmid23 = this.container.ownerDocument.createElement('v:rect'); 1.1847 + rectmid23.style.position = 'relative'; 1.1848 + rectmid23.style.left = box.width +5; 1.1849 + rectmid23.style.top = (box.height/2)-5; 1.1850 + rectmid23.style.width = 10; 1.1851 + rectmid23.style.height = 10; 1.1852 + rectmid23.setAttribute('filled', 'true'); 1.1853 + rectmid23.setAttribute('stroked', 'true'); 1.1854 + rectmid23.setAttribute('fillcolor', '#ffffff'); 1.1855 + rectmid23.setAttribute('strokecolor', 'green'); 1.1856 + rectmid23.setAttribute('strokeweight', '1px'); 1.1857 + 1.1858 + var rectmid34 = this.container.ownerDocument.createElement('v:rect'); 1.1859 + rectmid34.style.position = 'relative'; 1.1860 + rectmid34.style.left = (box.width/2)-5; 1.1861 + rectmid34.style.top = box.height+5; 1.1862 + rectmid34.style.width = 10; 1.1863 + rectmid34.style.height = 10; 1.1864 + rectmid34.setAttribute('filled', 'true'); 1.1865 + rectmid34.setAttribute('stroked', 'true'); 1.1866 + rectmid34.setAttribute('fillcolor', '#ffffff'); 1.1867 + rectmid34.setAttribute('strokecolor', 'green'); 1.1868 + rectmid34.setAttribute('strokeweight', '1px'); 1.1869 + 1.1870 + 1.1871 + var rectmid41 = this.container.ownerDocument.createElement('v:rect'); 1.1872 + rectmid41.style.position = 'relative'; 1.1873 + rectmid41.style.left = -10-5 ; 1.1874 + rectmid41.style.top =(box.height/2)-5; 1.1875 + rectmid41.style.width = 10; 1.1876 + rectmid41.style.height = 10; 1.1877 + rectmid41.setAttribute('filled', 'true'); 1.1878 + rectmid41.setAttribute('stroked', 'true'); 1.1879 + rectmid41.setAttribute('fillcolor', '#ffffff'); 1.1880 + rectmid41.setAttribute('strokecolor', 'green'); 1.1881 + rectmid41.setAttribute('strokeweight', '1px'); 1.1882 + 1.1883 + 1.1884 + 1.1885 + 1.1886 + var colorin="#ff0000"; 1.1887 + var colorout="#ffffff" 1.1888 + 1.1889 + circle1.attachEvent("onmouseover", function(event) {circle1.style.cursor= 's-resize'; circle1.setAttribute('fillcolor', colorin ); typeTransform='Rotate'; scaleType='nw'; }, false); 1.1890 + circle1.attachEvent("onmouseout", function(event) {circle1.style.cursor= 'default'; circle1.setAttribute('fillcolor', colorout ); typeTransform='Rotate'; }, false); //typeTransform='rotate' 1.1891 + 1.1892 + 1.1893 + rect1.attachEvent("onmouseover", function(event) {rect1.style.cursor= 'nw-resize'; rect1.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='nw'; }, false); 1.1894 + rect1.attachEvent("onmouseout", function(event) {rect1.style.cursor= 'default'; rect1.setAttribute('fillcolor', colorout ); typeTransform='Scale'; }, false); //typeTransform='rotate' 1.1895 + 1.1896 + rect2.attachEvent("onmouseover", function(event) {rect2.style.cursor= 'ne-resize'; rect2.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='ne';}, false); 1.1897 + rect2.attachEvent("onmouseout", function(event) {rect2.style.cursor= 'default'; rect2.setAttribute('fillcolor', colorout ); typeTransform='Scale'; }, false); 1.1898 + 1.1899 + rect3.attachEvent("onmouseover", function(event) {rect3.style.cursor= 'se-resize'; rect3.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='se';}, false); 1.1900 + rect3.attachEvent("onmouseout", function(event) {rect3.style.cursor= 'default'; rect3.setAttribute('fillcolor', colorout ); typeTransform='Scale'; }, false); 1.1901 + 1.1902 + rect4.attachEvent("onmouseover", function(event) {rect4.style.cursor= 'sw-resize'; rect4.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='sw';}, false); 1.1903 + rect4.attachEvent("onmouseout", function(event) {rect4.style.cursor= 'default'; rect4.setAttribute('fillcolor', colorout ); typeTransform='Scale'; }, false); 1.1904 + 1.1905 + rectmid12.attachEvent("onmouseover", function(event) {rectmid12.style.cursor= 'n-resize'; rectmid12.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='n';}, false); 1.1906 + rectmid12.attachEvent("onmouseout", function(event) {rectmid12.style.cursor= 'default'; rectmid12.setAttribute('fillcolor', colorout ); typeTransform=''; }, false); 1.1907 + 1.1908 + rectmid23.attachEvent("onmouseover", function(event) {rectmid23.style.cursor= 'e-resize'; rectmid23.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='e';}, false); 1.1909 + rectmid23.attachEvent("onmouseout", function(event) {rectmid23.style.cursor= 'default'; rectmid23.setAttribute('fillcolor', colorout ); typeTransform=''; }, false); 1.1910 + 1.1911 + rectmid34.attachEvent("onmouseover", function(event) {rectmid34.style.cursor= 's-resize'; rectmid34.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='s';}, false); 1.1912 + rectmid34.attachEvent("onmouseout", function(event) {rectmid34.style.cursor= 'default'; rectmid34.setAttribute('fillcolor', colorout ); typeTransform=''; }, false); 1.1913 + 1.1914 + rectmid41.attachEvent("onmouseover", function(event) {rectmid41.style.cursor= 'w-resize'; rectmid41.setAttribute('fillcolor', colorin ); typeTransform='Scale'; scaleType='w'; }, false); 1.1915 + rectmid41.attachEvent("onmouseout", function(event) {rectmid41.style.cursor= 'default'; rectmid41.setAttribute('fillcolor', colorout ); typeTransform=''; }, false); 1.1916 + //tracker.setAttribute('transform',trshape); 1.1917 + 1.1918 + 1.1919 + 1.1920 + tracker.appendChild(border_square); 1.1921 + tracker.appendChild(border_angle); 1.1922 + 1.1923 + tracker.appendChild(circle1); 1.1924 + 1.1925 + tracker.appendChild(rect1); 1.1926 + tracker.appendChild(rect2); 1.1927 + tracker.appendChild(rect3); 1.1928 + tracker.appendChild(rect4); 1.1929 + tracker.appendChild(rectmid12); 1.1930 + tracker.appendChild(rectmid23); 1.1931 + tracker.appendChild(rectmid34); 1.1932 + tracker.appendChild(rectmid41); 1.1933 + 1.1934 + /* 1.1935 + 1.1936 + 1.1937 + 1.1938 + */ 1.1939 + 1.1940 + 1.1941 + this.container.appendChild(tracker); 1.1942 + 1.1943 + 1.1944 + 1.1945 +} 1.1946 + 1.1947 + 1.1948 + 1.1949 + 1.1950 + 1.1951 + 1.1952 + 1.1953 + 1.1954 + 1.1955 + 1.1956 +VMLRenderer.prototype.getMarkup = function() { 1.1957 + 1.1958 + return this.container.innerHTML; 1.1959 +} 1.1960 + 1.1961 + 1.1962 + 1.1963 +///////////////////////////////// 1.1964 + 1.1965 + 1.1966 + 1.1967 +var rotatexxx=0; 1.1968 + 1.1969 +var scaleType=''; 1.1970 +var xrot=0; 1.1971 +var yrot=0; 1.1972 + 1.1973 +var point = {x:0, y:0, width: 0, height:0}; 1.1974 + 1.1975 +function createPoint (x, y, width, height) { 1.1976 + //var point = {x:34, y:22, width: 22, height:23}; 1.1977 + //point.x = x; 1.1978 + //point.y = y; 1.1979 + point = {x:x, y:y, width: width, height:height}; 1.1980 + return point; 1.1981 + } 1.1982 + 1.1983 + 1.1984 +///////////////////////////////// 1.1985 + 1.1986 +VMLRenderer.prototype.restruct= function(shape) 1.1987 +{ 1.1988 +}; 1.1989 + 1.1990 + 1.1991 + 1.1992 +VMLRenderer.prototype.transform = function() { 1.1993 + 1.1994 +}; 1.1995 + 1.1996 +VMLRenderer.prototype.scaleShape = function(shape, previus,toX, toY) { 1.1997 +// document.forms[0].code.value="escala"; 1.1998 + 1.1999 + //document.forms[0].code.value="escala"; 1.2000 + var box = this.bounds(shape); 1.2001 + var prevbox=this.bounds(previus); 1.2002 + var centerx= box.x+(box.width/2); 1.2003 + var centery= box.y+(box.height/2); 1.2004 + var coord=this.editor.inputxy; 1.2005 + toX=parseFloat(coord[0]); 1.2006 + toY=parseFloat(coord[1]); 1.2007 + var d2p_center=dist2p(centerx,centery,toX,toY); 1.2008 + 1.2009 + var d2p=dist2p(box.x,box.y,toX,toY); 1.2010 + 1.2011 + var shareScale=box.width/d2p; 1.2012 + 1.2013 + var trans_ShareScale=''; 1.2014 + var tx, ty, tw, yh; 1.2015 + 1.2016 + if(scaleType.length==1){ 1.2017 + if(scaleType== 'w') 1.2018 + { 1.2019 + trans_ShareScale=shareScale+",1"; 1.2020 + tx=toX; 1.2021 + ty=prevbox.y; 1.2022 + var dist=prevbox.x-toX; 1.2023 + var w=dist+prevbox.width; 1.2024 + if(w<1){w=1;} 1.2025 + tw=w; 1.2026 + th=prevbox.height; 1.2027 + //document.forms[0].code.value=box.x+' '+toX+' '+dist+''; 1.2028 + } 1.2029 + if(scaleType== 'e') 1.2030 + { 1.2031 + trans_ShareScale=shareScale+",1"; 1.2032 + tx=prevbox.x; 1.2033 + ty=prevbox.y; 1.2034 + var dist=toX-(prevbox.x+prevbox.width); //dist2p(toX,b,c,d); 1.2035 + var w=dist+prevbox.width; 1.2036 + if(w<1){w=1;} 1.2037 + tw=w; 1.2038 + th=prevbox.height; 1.2039 + 1.2040 + } 1.2041 + if(scaleType== 'n') 1.2042 + { 1.2043 + trans_ShareScale="1,"+shareScale; 1.2044 + 1.2045 + tx=prevbox.x; 1.2046 + ty=toY; 1.2047 + var dist=prevbox.y-toY; 1.2048 + var h=dist+prevbox.height; 1.2049 + if(h<1){h=1;} 1.2050 + tw=prevbox.width; 1.2051 + th=h; 1.2052 + 1.2053 + } 1.2054 + if( scaleType== 's') 1.2055 + { 1.2056 + trans_ShareScale="1,"+shareScale; 1.2057 + 1.2058 + tx=prevbox.x; 1.2059 + ty=prevbox.y; 1.2060 + var dist=toY-(prevbox.y+prevbox.height); //dist2p(toX,b,c,d); 1.2061 + var h=dist+prevbox.height; 1.2062 + if(h<1){h=1;} 1.2063 + tw=prevbox.width; 1.2064 + th=h; 1.2065 + 1.2066 + } 1.2067 + } 1.2068 + if(scaleType.length==2){ 1.2069 + if(scaleType== 'nw'){ 1.2070 + trans_ShareScale=shareScale+","+shareScale; 1.2071 + 1.2072 + //var angle_diagonal=getAngle(prevbox.width,prevbox.height); 1.2073 + var angle_diagonal=ang2v(prevbox.x,prevbox.y,prevbox.x+prevbox.width,prevbox.y+prevbox.height) 1.2074 + 1.2075 + var ax= prevbox.x; 1.2076 + var ay= prevbox.y; 1.2077 + var bx= prevbox.x+prevbox.width; 1.2078 + var by= prevbox.y+prevbox.height; 1.2079 + 1.2080 + var cx= toX; 1.2081 + var cy= toY; 1.2082 + var dx= toX+10*Math.cos(angle_diagonal+(Math.PI/2)); 1.2083 + var dy= toY+10*Math.sin(angle_diagonal+(Math.PI/2)); 1.2084 + var section_a=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy); 1.2085 + this.editor.log(angle_diagonal* 180 / Math.PI); 1.2086 + 1.2087 + var tx= section_a[1]; 1.2088 + var ty= section_a[2]; 1.2089 + 1.2090 + var ax= section_a[1]; 1.2091 + var ay= section_a[2]; 1.2092 + var bx= 0; 1.2093 + var by= section_a[2] ; 1.2094 + 1.2095 + var cx=prevbox.x+prevbox.width; 1.2096 + var cy= prevbox.y; 1.2097 + 1.2098 + var dx= prevbox.x+prevbox.width; 1.2099 + var dy= 0; 1.2100 + 1.2101 + 1.2102 + var section_b=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy); 1.2103 + 1.2104 + var distx=dist2p(section_a[1],section_a[2],section_b[1],section_b[2]); 1.2105 + 1.2106 + var ax= section_a[1]; 1.2107 + var ay= section_a[2]; 1.2108 + var bx= section_a[1] 1.2109 + var by= 0; 1.2110 + 1.2111 + var cx= prevbox.x; 1.2112 + var cy= prevbox.y+prevbox.height; 1.2113 + 1.2114 + var dx= 0; 1.2115 + var dy= prevbox.y+prevbox.height; 1.2116 + 1.2117 + 1.2118 + var section_c=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy); 1.2119 + 1.2120 + var disty=dist2p(section_a[1],section_a[2],section_c[1],section_c[2]); 1.2121 + 1.2122 + 1.2123 + 1.2124 + 1.2125 + 1.2126 + if(distx<1){distx=1;} 1.2127 + 1.2128 + 1.2129 + if(disty<1){disty=1;} 1.2130 + //document.forms[0].code.value=distx+' '+disty; 1.2131 + tw=distx; 1.2132 + th=disty; 1.2133 + 1.2134 + 1.2135 + } 1.2136 + 1.2137 + //////////////////// SE 1.2138 + 1.2139 + if( scaleType== 'se'){ 1.2140 + trans_ShareScale=shareScale+","+shareScale; 1.2141 + 1.2142 + 1.2143 + //var angle_diagonal=getAngle(prevbox.width,prevbox.height); 1.2144 + var angle_diagonal=ang2v(prevbox.x,prevbox.y,prevbox.x+prevbox.width,prevbox.y+prevbox.height) 1.2145 + 1.2146 + 1.2147 + 1.2148 + var ax= prevbox.x; 1.2149 + var ay= prevbox.y; 1.2150 + var bx= prevbox.x+prevbox.width; 1.2151 + var by= prevbox.y+prevbox.height; 1.2152 + 1.2153 + var cx= toX; 1.2154 + var cy= toY; 1.2155 + var dx= toX+10*Math.cos(angle_diagonal+(Math.PI/2)); 1.2156 + var dy= toY+10*Math.sin(angle_diagonal+(Math.PI/2)); 1.2157 + 1.2158 + var section_a=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy); 1.2159 + 1.2160 + 1.2161 + 1.2162 + ////////// 1.2163 + var tx= prevbox.x; 1.2164 + var ty= prevbox.y; 1.2165 + 1.2166 + var ax= section_a[1]; 1.2167 + var ay= section_a[2]; 1.2168 + var bx= 0; 1.2169 + var by= section_a[2] ; 1.2170 + 1.2171 + var cx=prevbox.x; 1.2172 + var cy= prevbox.y; 1.2173 + 1.2174 + var dx= prevbox.x; 1.2175 + var dy= 0; 1.2176 + 1.2177 + 1.2178 + var section_b=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy); 1.2179 + 1.2180 + ///////////////// 1.2181 + 1.2182 + 1.2183 + var distx=dist2p(section_a[1],section_a[2],section_b[1],section_b[2]); 1.2184 + 1.2185 + 1.2186 + var ax= section_a[1]; 1.2187 + var ay= section_a[2]; 1.2188 + var bx= section_a[1] 1.2189 + var by= 0; 1.2190 + 1.2191 + var cx= prevbox.x; 1.2192 + var cy= prevbox.y; 1.2193 + 1.2194 + var dx=0; 1.2195 + var dy= prevbox.y; 1.2196 + 1.2197 + 1.2198 + var section_c=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy); 1.2199 + 1.2200 + /////////////// 1.2201 + 1.2202 + var disty=dist2p(section_a[1],section_a[2],section_c[1],section_c[2]); 1.2203 + 1.2204 + 1.2205 + 1.2206 + if(distx<1){distx=1;} 1.2207 + 1.2208 + 1.2209 + if(disty<1){disty=1;} 1.2210 + 1.2211 + tw=distx; 1.2212 + th=disty; 1.2213 + 1.2214 + 1.2215 + } 1.2216 + 1.2217 + if(scaleType== 'ne'){ 1.2218 + 1.2219 + trans_ShareScale=shareScale+","+shareScale; 1.2220 + 1.2221 + var angle_diagonal=ang2v(prevbox.x,prevbox.y+prevbox.height,prevbox.x+prevbox.width,prevbox.y) 1.2222 + //var angle_diagonal=getAngle(prevbox.width,prevbox.height); 1.2223 + 1.2224 + 1.2225 + 1.2226 + 1.2227 + var ax= prevbox.x; 1.2228 + var ay= prevbox.y+prevbox.height; 1.2229 + var bx= prevbox.x+prevbox.width; 1.2230 + var by= prevbox.y; 1.2231 + 1.2232 + var cx= toX; 1.2233 + var cy= toY; 1.2234 + var dx= toX+10*Math.cos(angle_diagonal+(Math.PI/2)); 1.2235 + var dy= toY+10*Math.sin(angle_diagonal+(Math.PI/2)); 1.2236 + 1.2237 + 1.2238 + this.editor.log(angle_diagonal); 1.2239 + 1.2240 + 1.2241 + var section_a=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy); 1.2242 + 1.2243 + 1.2244 + 1.2245 + ////////// 1.2246 + var tx= prevbox.x; 1.2247 + var ty= section_a[2]; 1.2248 + 1.2249 + var ax= section_a[1]; 1.2250 + var ay= section_a[2]; 1.2251 + var bx= 0; 1.2252 + var by= section_a[2] ; 1.2253 + 1.2254 + var cx=prevbox.x; 1.2255 + var cy= prevbox.y; 1.2256 + 1.2257 + var dx= prevbox.x; 1.2258 + var dy= 0; 1.2259 + 1.2260 + 1.2261 + var section_b=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy); 1.2262 + 1.2263 + ///////////////// 1.2264 + 1.2265 + 1.2266 + var distx=dist2p(section_a[1],section_a[2],section_b[1],section_b[2]); 1.2267 + 1.2268 + 1.2269 + var ax= section_a[1]; 1.2270 + var ay= section_a[2]; 1.2271 + var bx= section_a[1]; 1.2272 + var by= 0; 1.2273 + 1.2274 + var cx= prevbox.x; 1.2275 + var cy= prevbox.y+prevbox.height; 1.2276 + 1.2277 + var dx=0; 1.2278 + var dy= prevbox.y+prevbox.height; 1.2279 + 1.2280 + 1.2281 + var section_c=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy); 1.2282 + 1.2283 + /////////////// 1.2284 + 1.2285 + var disty=dist2p(section_a[1],section_a[2],section_c[1],section_c[2]); 1.2286 + 1.2287 + 1.2288 + 1.2289 + if(distx<1){distx=1;} 1.2290 + 1.2291 + 1.2292 + if(disty<1){disty=1;} 1.2293 + //document.forms[0].code.value=distx+' '+disty; 1.2294 + tw=distx; 1.2295 + th=disty; 1.2296 + 1.2297 + 1.2298 + 1.2299 + 1.2300 + 1.2301 + } 1.2302 + if(scaleType== 'sw'){ 1.2303 + trans_ShareScale=shareScale+","+shareScale; 1.2304 + 1.2305 + 1.2306 + 1.2307 + 1.2308 + var angle_diagonal=ang2v(prevbox.x,prevbox.y+prevbox.height,prevbox.x+prevbox.width,prevbox.y) 1.2309 + //var angle_diagonal=getAngle(prevbox.width,prevbox.height); 1.2310 + 1.2311 + 1.2312 + 1.2313 + 1.2314 + var ax= prevbox.x; 1.2315 + var ay= prevbox.y+prevbox.height; 1.2316 + var bx= prevbox.x+prevbox.width; 1.2317 + var by= prevbox.y; 1.2318 + 1.2319 + var cx= toX; 1.2320 + var cy= toY; 1.2321 + var dx= toX+10*Math.cos(angle_diagonal+(Math.PI/2)); 1.2322 + var dy= toY+10*Math.sin(angle_diagonal+(Math.PI/2)); 1.2323 + 1.2324 + 1.2325 + this.editor.log(angle_diagonal); 1.2326 + 1.2327 + 1.2328 + var section_a=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy); 1.2329 + 1.2330 + 1.2331 + ////////// 1.2332 + var tx= section_a[1]; 1.2333 + var ty= prevbox.y; 1.2334 + 1.2335 + var ax= section_a[1]; 1.2336 + var ay= section_a[2]; 1.2337 + var bx= 0; 1.2338 + var by= section_a[2] ; 1.2339 + 1.2340 + var cx=prevbox.x+prevbox.width; 1.2341 + var cy= prevbox.y+prevbox.height; 1.2342 + 1.2343 + var dx= prevbox.x+prevbox.width; 1.2344 + var dy= 0; 1.2345 + 1.2346 + 1.2347 + var section_b=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy); 1.2348 + var distx=dist2p(section_a[1],section_a[2],section_b[1],section_b[2]); 1.2349 + 1.2350 + ///////////////// 1.2351 + var ax= section_a[1]; 1.2352 + var ay= section_a[2]; 1.2353 + var bx= section_a[1]; 1.2354 + var by= 0; 1.2355 + 1.2356 + var cx= prevbox.x; 1.2357 + var cy= prevbox.y; 1.2358 + 1.2359 + var dx=0; 1.2360 + var dy= prevbox.y; 1.2361 + 1.2362 + 1.2363 + var section_c=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy); 1.2364 + var disty=dist2p(section_a[1],section_a[2],section_c[1],section_c[2]); 1.2365 + /////////////// 1.2366 + 1.2367 + 1.2368 + 1.2369 + if(distx<1){distx=1;} 1.2370 + 1.2371 + 1.2372 + if(disty<1){disty=1;} 1.2373 + //document.forms[0].code.value=distx+' '+disty; 1.2374 + tw=distx; 1.2375 + th=disty; 1.2376 + 1.2377 + } 1.2378 + 1.2379 + } 1.2380 + 1.2381 + 1.2382 + 1.2383 + if(shape.tagName == 'rect') 1.2384 + { 1.2385 + //alert(data[0]); 1.2386 + 1.2387 + 1.2388 + shape.style.left = tx + 'px'; 1.2389 + shape.style.top = ty + 'px'; 1.2390 + shape.style.height = th + 'px'; 1.2391 + shape.style.width = tw + 'px'; 1.2392 + 1.2393 + } 1.2394 + else 1.2395 + if(shape.tagName == 'text') 1.2396 + { 1.2397 + /* 1.2398 + shape.setAttribute('x',tx); 1.2399 + shape.setAttribute('y',ty); 1.2400 + shape.setAttribute('width', tw); 1.2401 + shape.setAttribute('height', th); 1.2402 + 1.2403 + //previus.setAttribute('transform', "scale("+trans_ShareScale+")"); 1.2404 + shape.setAttribute('x', tx + 'px'); 1.2405 + shape.setAttribute('y', ty + 'px'); 1.2406 + 1.2407 + shape.setAttribute('textLength', parseInt(Math.round(tw))); 1.2408 + 1.2409 + */ 1.2410 + } 1.2411 + else 1.2412 + if(shape.tagName == 'oval') 1.2413 + { 1.2414 + //shape.getAttribute('transform) 1.2415 + 1.2416 + shape.style.left = tx + 'px'; 1.2417 + shape.style.top = ty + 'px'; 1.2418 + shape.style.height = th + 'px'; 1.2419 + shape.style.width = tw + 'px'; 1.2420 + 1.2421 + 1.2422 + } 1.2423 + else 1.2424 + if(shape.tagName == 'line') 1.2425 + { 1.2426 + shape.setAttribute('to',tx + 'px,' + ty + 'px'); 1.2427 + shape.setAttribute('from', tw + 'px,' + th + 'px'); 1.2428 + 1.2429 + 1.2430 + } 1.2431 + else 1.2432 + if (shape.tagName == 'polyline') 1.2433 + { 1.2434 + 1.2435 + } 1.2436 + else 1.2437 + if (shape.tagName == 'image') 1.2438 + { 1.2439 + 1.2440 + shape.style.left = tx + 'px'; 1.2441 + shape.style.top = ty + 'px'; 1.2442 + shape.style.height = th + 'px'; 1.2443 + shape.style.width = tw + 'px'; 1.2444 + 1.2445 + } 1.2446 + else 1.2447 + if (shape.tagName == 'shape') 1.2448 + { 1.2449 + 1.2450 + shape.style.left = tx + 'px'; 1.2451 + shape.style.top = ty + 'px'; 1.2452 + shape.style.height = th + 'px'; 1.2453 + shape.style.width = tw + 'px'; 1.2454 + 1.2455 + //document.forms[0].code.value=''; 1.2456 + //shape.setAttribute('transform', "scale("+trans_ShareScale+")"); 1.2457 + 1.2458 + } 1.2459 + 1.2460 + 1.2461 + 1.2462 + 1.2463 + 1.2464 +}; 1.2465 + 1.2466 + 1.2467 + 1.2468 +VMLRenderer.prototype.rotateShape = function(shape, previus,toX, toY) { 1.2469 + 1.2470 + 1.2471 + 1.2472 + //document.forms[0].code.value=$('xyinput').innerHTML; 1.2473 + //document.getElementById('richdraw').style.cursor='e-resize'; 1.2474 + var box = this.bounds(shape); 1.2475 + var prevbox=this.bounds(previus); 1.2476 + var centerx= box.x+(box.width/2); 1.2477 + var centery= box.y+(box.height/2); 1.2478 + var coord=this.editor.inputxy; 1.2479 + 1.2480 + var actual_angle=ang2v(centerx,centery,coord[0], coord[1]); 1.2481 + 1.2482 + if(xrot<toX) { rotatexxx+=1;}else{rotatexxx-=1;} 1.2483 + xrot=toX; 1.2484 + yrot=toY; 1.2485 + 1.2486 + var xtr=0; 1.2487 + var ytr=0; 1.2488 + 1.2489 + //var box= shape.getBBox(); 1.2490 + var tr1x= box.x; 1.2491 + var tr1y= box.y; 1.2492 + 1.2493 + 1.2494 + 1.2495 + toX+=xtr; 1.2496 + toY+=xtr; 1.2497 + 1.2498 + //var trax=parseFloat(toX-box.x); var tray= parseFloat(toY-box.y); 1.2499 + var trax=parseFloat(box.x/2); var tray= parseFloat(box.y/2); 1.2500 + var angler=Math.atan2(toX,toY); 1.2501 + var angle=angler*180/Math.PI; 1.2502 + // var T = shape.getCTM(); 1.2503 + //var rotini=T.a*(180 / Math.PI); 1.2504 + //var angle=rotini*180/Math.PI; 1.2505 + //var rot_angle=actual_angle*180/Math.PI; 1.2506 + //document.forms[0].code.value=centerx+' '+centery+' '+coord[0]+' '+coord[1]+'____ '+rot_angle+' '+actual_angle*180/Math.PI; 1.2507 + 1.2508 + 1.2509 + // matrix( a, b, c, d, e, f ) 1.2510 + // a c e 1.2511 + // b d f 1.2512 + // 0 0 1 1.2513 + //a scale factor of 2, a rotation of 30 deg and a translation of (500,50) 1.2514 + //T 1.732 -1 500 1 1.732 50 0 0 1 1.2515 + //T 1 ad-bc d -c -de+cf -b a be-df 0 0 1 1.2516 + 1.2517 + //shape.setAttribute('transform', "translate("+(-xshe)+","+(-yshe)+")"); 1.2518 + 1.2519 + // shape.setAttribute("transform", " matrix( a, b, c, d, e, f )"); 1.2520 + // shape.setAttribute('transform', "translate("+(box.x+(box.width/2))+","+(box.y+(box.height/2))+") rotate("+rotatexxx+") "); 1.2521 + //shape.setAttribute('transform', "translate("+(box.x+(box.width/2))+","+(box.y+(box.height/2))+") rotate("+rotatexxx+") translate("+(-box.x-(box.width/2))+","+(-box.y-(box.height/2))+") "); 1.2522 + //shape.setAttribute('transform', "rotate("+rotatexxx+","+(box.x+(box.width/2))+","+(box.y+(box.height/2))+")"); 1.2523 + //shape.setAttribute('transform', "rotate("+rotatexxx+","+(prevbox.x+(prevbox.width/2))+","+(prevbox.y+(prevbox.height/2))+")"); 1.2524 + //shape.setAttribute('rotation', rot_angle); 1.2525 + shape.setAttribute('rotation', angle); 1.2526 + //(prevbox.x+(prevbox.width/2))+","+(prevbox.y+(prevbox.height/2))+")"); 1.2527 + 1.2528 + 1.2529 + 1.2530 + } 1.2531 + 1.2532 +////////////////////////////// 1.2533 +/*H = 0; 1.2534 +W = 0; 1.2535 +LX = new Array(); 1.2536 +S = new Array(); 1.2537 +i = 0; 1.2538 +b = true; 1.2539 + 1.2540 +function SVG2VML(i){ 1.2541 + l = L[i]; 1.2542 + if(l.indexOf(" d=")>0){ 1.2543 + p = l.indexOf("fill:")+6; 1.2544 + C = l.substring(p,p+7); 1.2545 + p = l.indexOf(" d=")+4; 1.2546 + q = l.lastIndexOf("z")-1; 1.2547 + l = l.substring(p,q); 1.2548 + l = l.replace(/M/g,"m"); 1.2549 + l = l.replace(/c/g,"v"); 1.2550 + l = l.replace(/l/g,"r"); 1.2551 + S = l.split(" "); 1.2552 + l=""; 1.2553 + for(var j in S){ 1.2554 + c = S[j]; 1.2555 + p = c.substring(0,1); 1.2556 + d = p>"9"?p:""; 1.2557 + n = Math.round(c.substring(d!="") * 100); 1.2558 + l+= (d+n+" "); 1.2559 + } 1.2560 + LX[i] = l; 1.2561 + code = '<v:shape coordsize="'+(W*100)+','+(H*100)+'" class=vml strokeweight="2" strokecolor="'+C+'" filled="false" fillcolor = "'+C+'"/>'; 1.2562 + VML.insertAdjacentHTML("beforeEnd",code); 1.2563 + } else { 1.2564 + L[i] = LX[i] = "" 1.2565 + VML.insertAdjacentHTML("beforeEnd","<span></span>"); 1.2566 + } 1.2567 +} 1.2568 +*/ 1.2569 +//http://msdn2.microsoft.com/en-us/library/bb263897(VS.85).aspx 1.2570 +//http://www.w3.org/TR/NOTE-VML 1.2571 +//http://trac.openlayers.org/changeset/5285 1.2572 +//http://vectorconverter.sourceforge.net/index.html 1.2573 +//http://www.dhteumeuleu.com/colorsyntax/viewJS.php?src=svg2vml1.html 1.2574 + 1.2575 + 1.2576 +VMLRenderer.prototype.getshapes = function(){ 1.2577 +return this.container.childNodes; 1.2578 +} 1.2579 + 1.2580 + 1.2581 +VMLRenderer.prototype.reflect = function(HorV) { 1.2582 +}; 1.2583 + 1.2584 + 1.2585 + 1.2586 +