矩形箭头竖.js 61 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420
  1. ht.lib = ht.lib || {};
  2. if (!ht.lib['矩形箭头竖']) {
  3. ht.lib['矩形箭头竖'] = function (x, y, width, height, angle, localVarObj, localDynamicVar, nodename) {
  4. _ratio = GD.getRatioWithRotation(0, ratio);
  5. ht.lib['矩形箭头竖'].superClass.constructor.apply(this);
  6. this.localVarObj = localVarObj;
  7. this.localDynamicVar = localDynamicVar;
  8. this.childNodes = [];
  9. this._styleObject = {};
  10. this._originWidth = 19.12164*_ratio.ratioX;
  11. this._originHeight = 56.61331*_ratio.ratioY;
  12. this._baseClass = "ht.lib.矩形箭头竖";
  13. this._background = new ht.Node();
  14. this._background.setWidth(this._originWidth);
  15. this._background.setHeight(this._originHeight);
  16. this._background.setPosition(this._originWidth/2, this._originHeight/2);
  17. this._background.setImage({
  18. width: width,
  19. height: height,
  20. clip: true,
  21. comps: [
  22. {
  23. type: 'rect',
  24. background: 'rgba(0,255,0,0)',
  25. rect: [0,0,width, height]
  26. }
  27. ]
  28. });
  29. this._background.__parentLib = nodename;
  30. this._background.isLibBackground = true;
  31. this.childNodes.push(this._background);
  32. dataModel.add(this._background);
  33. /*@PageBackgroundInit@*/
  34. /*@PageBeforeInit@*/
  35. _ratio = GD.getRatioWithRotation(0*Math.PI/180, ratio);
  36. var Lib_矩形箭头竖Node0type = 'rect';
  37. var Lib_矩形箭头竖Node0 = new ht.Node(),
  38. Lib_矩形箭头竖Node0BorderWidth = 2*2;
  39. if (Lib_矩形箭头竖Node0type === 'arc') {
  40. Lib_矩形箭头竖Node0BorderWidth *= 2;
  41. }
  42. Lib_矩形箭头竖Node0.setImage(GD.getRectJSON(15.36963*_ratio.ratioX, 25.91444*_ratio.ratioY, Lib_矩形箭头竖Node0type, '@arcFrom@', '@arcTo@', '@arcClose@'));
  43. Lib_矩形箭头竖Node0.setPosition(9*ratio.ratioX, 28*ratio.ratioY);
  44. Lib_矩形箭头竖Node0.setSize(15.36963*_ratio.ratioX, 25.91444*_ratio.ratioY);
  45. Lib_矩形箭头竖Node0.s({
  46. 'pixelPerfect':true
  47. /*@AddPara@*/
  48. });
  49. Lib_矩形箭头竖Node0.a('node.width', 15.36963*_ratio.ratioX);
  50. Lib_矩形箭头竖Node0.a('node.height', 25.91444*_ratio.ratioY);
  51. Lib_矩形箭头竖Node0.a('node.type', Lib_矩形箭头竖Node0type);
  52. Lib_矩形箭头竖Node0.a('node.rect', [0, 0, 15.36963*_ratio.ratioX, 25.91444*_ratio.ratioY]);
  53. Lib_矩形箭头竖Node0.a('node.background', 'rgba(255,255,255,0.003921569)');
  54. Lib_矩形箭头竖Node0.a('node.gradientcolor', '');
  55. Lib_矩形箭头竖Node0.a('node.gradient', '');
  56. Lib_矩形箭头竖Node0.a('node.borderwidth', Lib_矩形箭头竖Node0BorderWidth);
  57. Lib_矩形箭头竖Node0.a('node.color', 'rgba(255,0,255,1)');
  58. Lib_矩形箭头竖Node0.a('node.fillrect', [0,0,0,0]);
  59. Lib_矩形箭头竖Node0.a('node.fillbackcolor', 'rgba(0,0,0,0)');
  60. Lib_矩形箭头竖Node0.a('node.fillgradientcolor', 'rgba(0,0,0,0)');
  61. Lib_矩形箭头竖Node0.a('node.fillgradient', '');
  62. if (Lib_矩形箭头竖Node0type !== 'rect') {
  63. Lib_矩形箭头竖Node0.a('node.arcFrom', parseFloat('@arcFrom@'));
  64. Lib_矩形箭头竖Node0.a('node.arcTo', parseFloat('@arcTo@'));
  65. Lib_矩形箭头竖Node0.a('node.arcClose', '@arcClose@' === 'true' ? true : false);
  66. }
  67. if (Lib_矩形箭头竖Node0type === 'arc') {
  68. Lib_矩形箭头竖Node0.a('node.arcOval', true);
  69. }
  70. Lib_矩形箭头竖Node0.setRotation(0*Math.PI/180);
  71. Lib_矩形箭头竖Node0.borderWidth = Lib_矩形箭头竖Node0BorderWidth;
  72. Lib_矩形箭头竖Node0.borderFillwidth = Lib_矩形箭头竖Node0BorderWidth;
  73. dataModel.add(Lib_矩形箭头竖Node0);
  74. Lib_矩形箭头竖Node0._nodename = 'Lib_矩形箭头竖Node0'
  75. Lib_矩形箭头竖Node0._nodeType = 'rect';
  76. zoomNodeList.push({
  77. node: Lib_矩形箭头竖Node0,
  78. attr: 'node.borderwidth'
  79. });
  80. (function (node, _img) {
  81. var setWidth = node.setWidth,
  82. setHeight = node.setHeight;
  83. node.setWidth = function (width) {
  84. if (width === this.getWidth()) return ;
  85. var height = this.getHeight();
  86. this.a('node.width', width);
  87. this.a('node.rect', [0,0,width, height]);
  88. setWidth.apply(this, arguments);
  89. }
  90. node.setHeight = function (height) {
  91. if (height === this.getHeight()) return ;
  92. var width = this.getWidth();
  93. this.a('node.height', height);
  94. this.a('node.rect', [0,0,width, height]);
  95. setHeight.apply(this, arguments);
  96. }
  97. })(Lib_矩形箭头竖Node0, Lib_矩形箭头竖Node0.getImage());var Lib_矩形箭头竖Node1points=[9, 41,9, 50],
  98. Lib_矩形箭头竖Node1rect=ht.Default.unionPoint([{x:9,y:41},{x:9,y:50}]),
  99. Lib_矩形箭头竖Node1compspts=[];
  100. _ratio = GD.getRatioWithRotation(0, ratio);
  101. var _startratio = GD.getRatioWithRotation(4.71238898038469, ratio),
  102. _endratio = GD.getRatioWithRotation(7.85398163397448, ratio);
  103. for(var i=0;i<Lib_矩形箭头竖Node1points.length;i++){
  104. if(i%2==0){
  105. Lib_矩形箭头竖Node1compspts.push(Lib_矩形箭头竖Node1points[i]-Lib_矩形箭头竖Node1rect.x);
  106. }else{
  107. Lib_矩形箭头竖Node1compspts.push(Lib_矩形箭头竖Node1points[i]-Lib_矩形箭头竖Node1rect.y);
  108. }
  109. }
  110. var Lib_矩形箭头竖Node1ptslength=Lib_矩形箭头竖Node1compspts.length;
  111. if (Lib_矩形箭头竖Node1rect.height === 0) {
  112. Lib_矩形箭头竖Node1compspts[0] -= 0;
  113. Lib_矩形箭头竖Node1compspts[Lib_矩形箭头竖Node1ptslength-2] += 0;
  114. } else if (Lib_矩形箭头竖Node1rect.width === 0){
  115. Lib_矩形箭头竖Node1compspts[1] -= 0;
  116. Lib_矩形箭头竖Node1compspts[Lib_矩形箭头竖Node1ptslength-1] += 0;
  117. } else {
  118. Lib_矩形箭头竖Node1compspts[0] -= 0;
  119. Lib_矩形箭头竖Node1compspts[1] -= 0;
  120. Lib_矩形箭头竖Node1compspts[Lib_矩形箭头竖Node1ptslength-2] += 0;
  121. Lib_矩形箭头竖Node1compspts[Lib_矩形箭头竖Node1ptslength-1] += 0;
  122. }
  123. Lib_矩形箭头竖Node1 = new ht.Node();
  124. Lib_矩形箭头竖Node1.borderWidth = 2;
  125. Lib_矩形箭头竖Node1rect.width = Lib_矩形箭头竖Node1rect.width === 0 ? 0.0001 : Lib_矩形箭头竖Node1rect.width;
  126. Lib_矩形箭头竖Node1rect.height = Lib_矩形箭头竖Node1rect.height === 0 ? 0.0001 : Lib_矩形箭头竖Node1rect.height;
  127. var Lib_矩形箭头竖Node1endCompspts = [Lib_矩形箭头竖Node1compspts[Lib_矩形箭头竖Node1ptslength-2],Lib_矩形箭头竖Node1compspts[Lib_矩形箭头竖Node1ptslength-1],0,0];
  128. var Lib_矩形箭头竖Node1startCompspts = [Lib_矩形箭头竖Node1compspts[0],Lib_矩形箭头竖Node1compspts[1],0,0];
  129. Lib_矩形箭头竖Node1.setImage(GD.getPolyLineJSON());
  130. Lib_矩形箭头竖Node1.setPosition(Lib_矩形箭头竖Node1rect.x+Lib_矩形箭头竖Node1rect.width/2,Lib_矩形箭头竖Node1rect.y+Lib_矩形箭头竖Node1rect.height/2);
  131. Lib_矩形箭头竖Node1.setSize(Lib_矩形箭头竖Node1rect.width,Lib_矩形箭头竖Node1rect.height);
  132. Lib_矩形箭头竖Node1.setStyle("opacity",1);
  133. Lib_矩形箭头竖Node1.s({'pixelPerfect':true});
  134. Lib_矩形箭头竖Node1borderwidth=2;
  135. Lib_矩形箭头竖Node1.setRotation(0);
  136. dataModel.add(Lib_矩形箭头竖Node1);
  137. Lib_矩形箭头竖Node1.a('node.points',Lib_矩形箭头竖Node1compspts);
  138. Lib_矩形箭头竖Node1.a('node.segments',[1,2]);
  139. Lib_矩形箭头竖Node1.a('node.color','rgba(255,0,255,1)');
  140. Lib_矩形箭头竖Node1.a('node.borderPattern',getDashStyle("@borderPattern@"));
  141. Lib_矩形箭头竖Node1.a('node.borderColor','rgba(255,0,255,1)');
  142. Lib_矩形箭头竖Node1.a('node.background','rgba(255,0,255,1)');
  143. Lib_矩形箭头竖Node1.a('node.gradient','');
  144. Lib_矩形箭头竖Node1.a('node.gradientcolor','rgba(255,0,255,1)');
  145. Lib_矩形箭头竖Node1.a('node.endCompspts',Lib_矩形箭头竖Node1endCompspts);
  146. Lib_矩形箭头竖Node1.a('node.startCompspts',Lib_矩形箭头竖Node1startCompspts);
  147. (function (node, img, compspts, endCompspts, startCompspts) {
  148. var position = node.getPosition(),
  149. w = node.getWidth()*_ratio.ratioX,
  150. h = node.getHeight()*_ratio.ratioY;
  151. function resetPoints(rx, ry) {
  152. for (var i = 0, len = compspts.length; i < len; i++) {
  153. if (i%2 === 0) {
  154. compspts[i]*=rx;
  155. } else {
  156. compspts[i]*=ry;
  157. }
  158. }
  159. endCompspts[0] = compspts[compspts.length-2];
  160. endCompspts[1] = compspts[compspts.length-1];
  161. endCompspts[2] *= rx;
  162. endCompspts[3] *= ry;
  163. node.a('node.offsetEndY', -(endCompspts[3]*0.5));
  164. node.a('node.offsetEndX', -(endCompspts[2]*0.5));
  165. startCompspts[0] = compspts[0];
  166. startCompspts[1] = compspts[1];
  167. startCompspts[2] *= rx;
  168. startCompspts[3] *= ry;
  169. node.a('node.offsetStartY', -(startCompspts[3]*0.5));
  170. node.a('node.offsetStartX', -(startCompspts[2]*0.5));
  171. node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
  172. node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
  173. }
  174. node.setSize(w, h);
  175. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  176. node.a('node.width', w);
  177. node.a('node.height', h);
  178. resetPoints(_ratio.ratioX, _ratio.ratioY);
  179. node.borderWidth = 2;
  180. node.a('node.borderwidth',node.borderWidth);
  181. node._nodename = 'Lib_矩形箭头竖Node1';
  182. node._nodeType = 'line';
  183. zoomNodeList.push({
  184. node: node,
  185. attr: 'node.borderwidth'
  186. });
  187. var setWidth = node.setWidth,
  188. setHeight = node.setHeight,
  189. timer, rx = 1, ry = 1;
  190. node.setWidth = function (width) {
  191. var _width = this.getWidth();
  192. rx = width / _width;
  193. node.a('node.width', width);
  194. setWidth.apply(this, arguments);
  195. resetPoints(rx, 1);
  196. }
  197. node.setHeight = function (height) {
  198. var _height = this.getHeight();
  199. ry = height / _height;
  200. node.a('node.height', height);
  201. setHeight.apply(this, arguments);
  202. resetPoints(1, ry);
  203. }
  204. })(Lib_矩形箭头竖Node1, Lib_矩形箭头竖Node1.getImage(), Lib_矩形箭头竖Node1compspts, Lib_矩形箭头竖Node1endCompspts, Lib_矩形箭头竖Node1startCompspts);
  205. var Lib_矩形箭头竖Node2points=[9, 0,9, 27],
  206. Lib_矩形箭头竖Node2rect=ht.Default.unionPoint([{x:9,y:0},{x:9,y:27}]),
  207. Lib_矩形箭头竖Node2compspts=[];
  208. _ratio = GD.getRatioWithRotation(0, ratio);
  209. var _startratio = GD.getRatioWithRotation(4.71238898038469, ratio),
  210. _endratio = GD.getRatioWithRotation(7.85398163397448, ratio);
  211. for(var i=0;i<Lib_矩形箭头竖Node2points.length;i++){
  212. if(i%2==0){
  213. Lib_矩形箭头竖Node2compspts.push(Lib_矩形箭头竖Node2points[i]-Lib_矩形箭头竖Node2rect.x);
  214. }else{
  215. Lib_矩形箭头竖Node2compspts.push(Lib_矩形箭头竖Node2points[i]-Lib_矩形箭头竖Node2rect.y);
  216. }
  217. }
  218. var Lib_矩形箭头竖Node2ptslength=Lib_矩形箭头竖Node2compspts.length;
  219. if (Lib_矩形箭头竖Node2rect.height === 0) {
  220. Lib_矩形箭头竖Node2compspts[0] -= 0;
  221. Lib_矩形箭头竖Node2compspts[Lib_矩形箭头竖Node2ptslength-2] += 0;
  222. } else if (Lib_矩形箭头竖Node2rect.width === 0){
  223. Lib_矩形箭头竖Node2compspts[1] -= 0;
  224. Lib_矩形箭头竖Node2compspts[Lib_矩形箭头竖Node2ptslength-1] += 0;
  225. } else {
  226. Lib_矩形箭头竖Node2compspts[0] -= 0;
  227. Lib_矩形箭头竖Node2compspts[1] -= 0;
  228. Lib_矩形箭头竖Node2compspts[Lib_矩形箭头竖Node2ptslength-2] += 0;
  229. Lib_矩形箭头竖Node2compspts[Lib_矩形箭头竖Node2ptslength-1] += 0;
  230. }
  231. Lib_矩形箭头竖Node2 = new ht.Node();
  232. Lib_矩形箭头竖Node2.borderWidth = 2;
  233. Lib_矩形箭头竖Node2rect.width = Lib_矩形箭头竖Node2rect.width === 0 ? 0.0001 : Lib_矩形箭头竖Node2rect.width;
  234. Lib_矩形箭头竖Node2rect.height = Lib_矩形箭头竖Node2rect.height === 0 ? 0.0001 : Lib_矩形箭头竖Node2rect.height;
  235. var Lib_矩形箭头竖Node2endCompspts = [Lib_矩形箭头竖Node2compspts[Lib_矩形箭头竖Node2ptslength-2],Lib_矩形箭头竖Node2compspts[Lib_矩形箭头竖Node2ptslength-1],0,0];
  236. var Lib_矩形箭头竖Node2startCompspts = [Lib_矩形箭头竖Node2compspts[0],Lib_矩形箭头竖Node2compspts[1],0,0];
  237. Lib_矩形箭头竖Node2.setImage(GD.getPolyLineJSON());
  238. Lib_矩形箭头竖Node2.setPosition(Lib_矩形箭头竖Node2rect.x+Lib_矩形箭头竖Node2rect.width/2,Lib_矩形箭头竖Node2rect.y+Lib_矩形箭头竖Node2rect.height/2);
  239. Lib_矩形箭头竖Node2.setSize(Lib_矩形箭头竖Node2rect.width,Lib_矩形箭头竖Node2rect.height);
  240. Lib_矩形箭头竖Node2.setStyle("opacity",1);
  241. Lib_矩形箭头竖Node2.s({'pixelPerfect':true});
  242. Lib_矩形箭头竖Node2borderwidth=2;
  243. Lib_矩形箭头竖Node2.setRotation(0);
  244. dataModel.add(Lib_矩形箭头竖Node2);
  245. Lib_矩形箭头竖Node2.a('node.points',Lib_矩形箭头竖Node2compspts);
  246. Lib_矩形箭头竖Node2.a('node.segments',[1,2]);
  247. Lib_矩形箭头竖Node2.a('node.color','rgba(255,0,255,1)');
  248. Lib_矩形箭头竖Node2.a('node.borderPattern',getDashStyle("@borderPattern@"));
  249. Lib_矩形箭头竖Node2.a('node.borderColor','rgba(255,0,255,1)');
  250. Lib_矩形箭头竖Node2.a('node.background','rgba(255,0,255,1)');
  251. Lib_矩形箭头竖Node2.a('node.gradient','');
  252. Lib_矩形箭头竖Node2.a('node.gradientcolor','rgba(255,0,255,1)');
  253. Lib_矩形箭头竖Node2.a('node.endCompspts',Lib_矩形箭头竖Node2endCompspts);
  254. Lib_矩形箭头竖Node2.a('node.startCompspts',Lib_矩形箭头竖Node2startCompspts);
  255. (function (node, img, compspts, endCompspts, startCompspts) {
  256. var position = node.getPosition(),
  257. w = node.getWidth()*_ratio.ratioX,
  258. h = node.getHeight()*_ratio.ratioY;
  259. function resetPoints(rx, ry) {
  260. for (var i = 0, len = compspts.length; i < len; i++) {
  261. if (i%2 === 0) {
  262. compspts[i]*=rx;
  263. } else {
  264. compspts[i]*=ry;
  265. }
  266. }
  267. endCompspts[0] = compspts[compspts.length-2];
  268. endCompspts[1] = compspts[compspts.length-1];
  269. endCompspts[2] *= rx;
  270. endCompspts[3] *= ry;
  271. node.a('node.offsetEndY', -(endCompspts[3]*0.5));
  272. node.a('node.offsetEndX', -(endCompspts[2]*0.5));
  273. startCompspts[0] = compspts[0];
  274. startCompspts[1] = compspts[1];
  275. startCompspts[2] *= rx;
  276. startCompspts[3] *= ry;
  277. node.a('node.offsetStartY', -(startCompspts[3]*0.5));
  278. node.a('node.offsetStartX', -(startCompspts[2]*0.5));
  279. node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
  280. node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
  281. }
  282. node.setSize(w, h);
  283. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  284. node.a('node.width', w);
  285. node.a('node.height', h);
  286. resetPoints(_ratio.ratioX, _ratio.ratioY);
  287. node.borderWidth = 2;
  288. node.a('node.borderwidth',node.borderWidth);
  289. node._nodename = 'Lib_矩形箭头竖Node2';
  290. node._nodeType = 'line';
  291. zoomNodeList.push({
  292. node: node,
  293. attr: 'node.borderwidth'
  294. });
  295. var setWidth = node.setWidth,
  296. setHeight = node.setHeight,
  297. timer, rx = 1, ry = 1;
  298. node.setWidth = function (width) {
  299. var _width = this.getWidth();
  300. rx = width / _width;
  301. node.a('node.width', width);
  302. setWidth.apply(this, arguments);
  303. resetPoints(rx, 1);
  304. }
  305. node.setHeight = function (height) {
  306. var _height = this.getHeight();
  307. ry = height / _height;
  308. node.a('node.height', height);
  309. setHeight.apply(this, arguments);
  310. resetPoints(1, ry);
  311. }
  312. })(Lib_矩形箭头竖Node2, Lib_矩形箭头竖Node2.getImage(), Lib_矩形箭头竖Node2compspts, Lib_矩形箭头竖Node2endCompspts, Lib_矩形箭头竖Node2startCompspts);
  313. var Lib_矩形箭头竖Node3rect=ht.Default.unionPoint([{x: 4, y: 20},{x: 4, y: 20},{x: 13, y: 20},{x: 9, y: 28}]),
  314. Lib_矩形箭头竖Node3points=[4,20,4,20,13,20,9,28],
  315. Lib_矩形箭头竖Node3compsPoints=[],
  316. Lib_矩形箭头竖Node3SetPoints = [{x: 4, y: 20},{x: 4, y: 20},{x: 13, y: 20},{x: 9, y: 28}],
  317. Lib_矩形箭头竖Node3setSegments = [1,2,2,2];
  318. _ratio = GD.getRatioWithRotation(0, ratio);
  319. for(var i=0;i<Lib_矩形箭头竖Node3points.length;i++){
  320. if(i%2==0){
  321. Lib_矩形箭头竖Node3compsPoints.push(Lib_矩形箭头竖Node3points[i]-Lib_矩形箭头竖Node3rect.x);
  322. }else{
  323. Lib_矩形箭头竖Node3compsPoints.push(Lib_矩形箭头竖Node3points[i]-Lib_矩形箭头竖Node3rect.y);
  324. }
  325. }
  326. var Lib_矩形箭头竖Node3 = new ht.Node();
  327. Lib_矩形箭头竖Node3.setImage(GD.getPolyGonJSON());
  328. Lib_矩形箭头竖Node3.setPosition(Lib_矩形箭头竖Node3rect.x + Lib_矩形箭头竖Node3rect.width/2, Lib_矩形箭头竖Node3rect.y + Lib_矩形箭头竖Node3rect.height/2);
  329. Lib_矩形箭头竖Node3.setSize(Lib_矩形箭头竖Node3rect.width, Lib_矩形箭头竖Node3rect.height);
  330. Lib_矩形箭头竖Node3.setRotation(0);
  331. Lib_矩形箭头竖Node3.borderWidth=2;
  332. Lib_矩形箭头竖Node3.borderFillwidth=2*2;
  333. Lib_矩形箭头竖Node3.s({'pixelPerfect':true});
  334. dataModel.add(Lib_矩形箭头竖Node3);
  335. // Lib_矩形箭头竖Node3.a('node.width', Lib_矩形箭头竖Node3rect.width*_ratio.ratioX);
  336. // Lib_矩形箭头竖Node3.a('node.height', Lib_矩形箭头竖Node3rect.height*_ratio.ratioY);
  337. Lib_矩形箭头竖Node3.a('node.clip', function(g,width,height,data) {
  338. var clippoints = Lib_矩形箭头竖Node3SetPoints;
  339. if(clippoints.length<=3) return;
  340. if(Lib_矩形箭头竖Node3.a('Lib_矩形箭头竖Node3.isFill')=="false") return;
  341. var clipcompsPoints=[];
  342. var rect = ht.Default.unionPoint(clippoints);
  343. for(var i=0;i<clippoints.length;i++){
  344. clipcompsPoints.push({x:clippoints[i].x-rect.x,y:clippoints[i].y-rect.y});
  345. }
  346. var clipsegments=Lib_矩形箭头竖Node3setSegments;
  347. g.beginPath();
  348. drawPoints(g,clipcompsPoints,clipsegments);
  349. g.clip();
  350. })
  351. Lib_矩形箭头竖Node3.a('node.type', 'shape');
  352. Lib_矩形箭头竖Node3.a('node.comsPoints', Lib_矩形箭头竖Node3compsPoints);
  353. Lib_矩形箭头竖Node3.a('node.closePath', true);
  354. Lib_矩形箭头竖Node3.a('node.borderwidth', 2);
  355. Lib_矩形箭头竖Node3.a('node.color', 'rgba(255,0,255,1)');
  356. Lib_矩形箭头竖Node3.a('node.background','rgba(255,128,0,1)');
  357. Lib_矩形箭头竖Node3.a('node.closePath', true);
  358. Lib_矩形箭头竖Node3.a('node.closePath', true);
  359. Lib_矩形箭头竖Node3.a('node.gradient','');
  360. Lib_矩形箭头竖Node3.a('node.gradientcolor','rgba(255,128,0,1)');
  361. Lib_矩形箭头竖Node3.a('node.isFill','false');
  362. Lib_矩形箭头竖Node3.a('node.original',[0,0,0,0]);
  363. Lib_矩形箭头竖Node3.a('node.fillrect',[0,0,0,0]);
  364. Lib_矩形箭头竖Node3.a('node.fillbackcolor','rgba(255,128,0,1)');
  365. Lib_矩形箭头竖Node3.a('node.fillgradient','');
  366. Lib_矩形箭头竖Node3.a('node.fillgradientcolor','rgba(255,128,0,1)');
  367. Lib_矩形箭头竖Node3.a('node.segments',Lib_矩形箭头竖Node3setSegments);
  368. Lib_矩形箭头竖Node3.a('node.borderPattern',"");
  369. (function (node, nodecompsPoints, setPoints) {
  370. var w = node.getWidth()*_ratio.ratioX,
  371. h = node.getHeight()*_ratio.ratioY,
  372. img = node.getImage();
  373. function resetPoints(rx, ry) {
  374. for (var i = 0, len = nodecompsPoints.length; i < len; i++) {
  375. if (i%2 === 0) {
  376. nodecompsPoints[i]*=rx;
  377. } else {
  378. nodecompsPoints[i]*=ry;
  379. }
  380. if (setPoints[i]) {
  381. setPoints[i].x *= rx;
  382. setPoints[i].y *= ry;
  383. }
  384. }
  385. }
  386. node.setSize(w, h);
  387. node.a('node.width', w);
  388. node.a('node.height', h);
  389. resetPoints(_ratio.ratioX, _ratio.ratioY);
  390. var position = node.getPosition();
  391. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  392. node._nodename = 'Lib_矩形箭头竖Node3';
  393. node._nodeType = 'polygon';
  394. zoomNodeList.push({
  395. node: node,
  396. attr: 'node.borderwidth'
  397. });
  398. // 重载setWidth, setHeight
  399. var setWidth = node.setWidth,
  400. setHeight = node.setHeight,
  401. timer, rx = 1, ry = 1;
  402. node.setWidth = function (width) {
  403. var _width = this.getWidth();
  404. rx = width / _width;
  405. node.a('node.width', width);
  406. setWidth.apply(this, arguments);
  407. resetPoints(rx, 1);
  408. }
  409. node.setHeight = function (height) {
  410. var _height = this.getHeight();
  411. ry = height / _height;
  412. node.a('node.height', height);
  413. setHeight.apply(this, arguments);
  414. resetPoints(1, ry);
  415. }
  416. })(Lib_矩形箭头竖Node3, Lib_矩形箭头竖Node3compsPoints, Lib_矩形箭头竖Node3SetPoints );
  417. var Lib_矩形箭头竖Node4points=[5, 55,13, 55],
  418. Lib_矩形箭头竖Node4rect=ht.Default.unionPoint([{x:5,y:55},{x:13,y:55}]),
  419. Lib_矩形箭头竖Node4compspts=[];
  420. _ratio = GD.getRatioWithRotation(0, ratio);
  421. var _startratio = GD.getRatioWithRotation(3.14159265358979, ratio),
  422. _endratio = GD.getRatioWithRotation(0, ratio);
  423. for(var i=0;i<Lib_矩形箭头竖Node4points.length;i++){
  424. if(i%2==0){
  425. Lib_矩形箭头竖Node4compspts.push(Lib_矩形箭头竖Node4points[i]-Lib_矩形箭头竖Node4rect.x);
  426. }else{
  427. Lib_矩形箭头竖Node4compspts.push(Lib_矩形箭头竖Node4points[i]-Lib_矩形箭头竖Node4rect.y);
  428. }
  429. }
  430. var Lib_矩形箭头竖Node4ptslength=Lib_矩形箭头竖Node4compspts.length;
  431. if (Lib_矩形箭头竖Node4rect.height === 0) {
  432. Lib_矩形箭头竖Node4compspts[0] -= 0;
  433. Lib_矩形箭头竖Node4compspts[Lib_矩形箭头竖Node4ptslength-2] += 0;
  434. } else if (Lib_矩形箭头竖Node4rect.width === 0){
  435. Lib_矩形箭头竖Node4compspts[1] -= 0;
  436. Lib_矩形箭头竖Node4compspts[Lib_矩形箭头竖Node4ptslength-1] += 0;
  437. } else {
  438. Lib_矩形箭头竖Node4compspts[0] -= 0;
  439. Lib_矩形箭头竖Node4compspts[1] -= 0;
  440. Lib_矩形箭头竖Node4compspts[Lib_矩形箭头竖Node4ptslength-2] += 0;
  441. Lib_矩形箭头竖Node4compspts[Lib_矩形箭头竖Node4ptslength-1] += 0;
  442. }
  443. Lib_矩形箭头竖Node4 = new ht.Node();
  444. Lib_矩形箭头竖Node4.borderWidth = 2;
  445. Lib_矩形箭头竖Node4rect.width = Lib_矩形箭头竖Node4rect.width === 0 ? 0.0001 : Lib_矩形箭头竖Node4rect.width;
  446. Lib_矩形箭头竖Node4rect.height = Lib_矩形箭头竖Node4rect.height === 0 ? 0.0001 : Lib_矩形箭头竖Node4rect.height;
  447. var Lib_矩形箭头竖Node4endCompspts = [Lib_矩形箭头竖Node4compspts[Lib_矩形箭头竖Node4ptslength-2],Lib_矩形箭头竖Node4compspts[Lib_矩形箭头竖Node4ptslength-1],0,0];
  448. var Lib_矩形箭头竖Node4startCompspts = [Lib_矩形箭头竖Node4compspts[0],Lib_矩形箭头竖Node4compspts[1],0,0];
  449. Lib_矩形箭头竖Node4.setImage(GD.getPolyLineJSON());
  450. Lib_矩形箭头竖Node4.setPosition(Lib_矩形箭头竖Node4rect.x+Lib_矩形箭头竖Node4rect.width/2,Lib_矩形箭头竖Node4rect.y+Lib_矩形箭头竖Node4rect.height/2);
  451. Lib_矩形箭头竖Node4.setSize(Lib_矩形箭头竖Node4rect.width,Lib_矩形箭头竖Node4rect.height);
  452. Lib_矩形箭头竖Node4.setStyle("opacity",1);
  453. Lib_矩形箭头竖Node4.s({'pixelPerfect':true});
  454. Lib_矩形箭头竖Node4borderwidth=2;
  455. Lib_矩形箭头竖Node4.setRotation(0);
  456. dataModel.add(Lib_矩形箭头竖Node4);
  457. Lib_矩形箭头竖Node4.a('node.points',Lib_矩形箭头竖Node4compspts);
  458. Lib_矩形箭头竖Node4.a('node.segments',[1,2]);
  459. Lib_矩形箭头竖Node4.a('node.color','rgba(255,0,255,1)');
  460. Lib_矩形箭头竖Node4.a('node.borderPattern',getDashStyle("@borderPattern@"));
  461. Lib_矩形箭头竖Node4.a('node.borderColor','rgba(255,0,255,1)');
  462. Lib_矩形箭头竖Node4.a('node.background','rgba(255,0,255,1)');
  463. Lib_矩形箭头竖Node4.a('node.gradient','');
  464. Lib_矩形箭头竖Node4.a('node.gradientcolor','rgba(255,0,255,1)');
  465. Lib_矩形箭头竖Node4.a('node.endCompspts',Lib_矩形箭头竖Node4endCompspts);
  466. Lib_矩形箭头竖Node4.a('node.startCompspts',Lib_矩形箭头竖Node4startCompspts);
  467. (function (node, img, compspts, endCompspts, startCompspts) {
  468. var position = node.getPosition(),
  469. w = node.getWidth()*_ratio.ratioX,
  470. h = node.getHeight()*_ratio.ratioY;
  471. function resetPoints(rx, ry) {
  472. for (var i = 0, len = compspts.length; i < len; i++) {
  473. if (i%2 === 0) {
  474. compspts[i]*=rx;
  475. } else {
  476. compspts[i]*=ry;
  477. }
  478. }
  479. endCompspts[0] = compspts[compspts.length-2];
  480. endCompspts[1] = compspts[compspts.length-1];
  481. endCompspts[2] *= rx;
  482. endCompspts[3] *= ry;
  483. node.a('node.offsetEndY', -(endCompspts[3]*0.5));
  484. node.a('node.offsetEndX', -(endCompspts[2]*0.5));
  485. startCompspts[0] = compspts[0];
  486. startCompspts[1] = compspts[1];
  487. startCompspts[2] *= rx;
  488. startCompspts[3] *= ry;
  489. node.a('node.offsetStartY', -(startCompspts[3]*0.5));
  490. node.a('node.offsetStartX', -(startCompspts[2]*0.5));
  491. node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
  492. node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
  493. }
  494. node.setSize(w, h);
  495. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  496. node.a('node.width', w);
  497. node.a('node.height', h);
  498. resetPoints(_ratio.ratioX, _ratio.ratioY);
  499. node.borderWidth = 2;
  500. node.a('node.borderwidth',node.borderWidth);
  501. node._nodename = 'Lib_矩形箭头竖Node4';
  502. node._nodeType = 'line';
  503. zoomNodeList.push({
  504. node: node,
  505. attr: 'node.borderwidth'
  506. });
  507. var setWidth = node.setWidth,
  508. setHeight = node.setHeight,
  509. timer, rx = 1, ry = 1;
  510. node.setWidth = function (width) {
  511. var _width = this.getWidth();
  512. rx = width / _width;
  513. node.a('node.width', width);
  514. setWidth.apply(this, arguments);
  515. resetPoints(rx, 1);
  516. }
  517. node.setHeight = function (height) {
  518. var _height = this.getHeight();
  519. ry = height / _height;
  520. node.a('node.height', height);
  521. setHeight.apply(this, arguments);
  522. resetPoints(1, ry);
  523. }
  524. })(Lib_矩形箭头竖Node4, Lib_矩形箭头竖Node4.getImage(), Lib_矩形箭头竖Node4compspts, Lib_矩形箭头竖Node4endCompspts, Lib_矩形箭头竖Node4startCompspts);
  525. var Lib_矩形箭头竖Node5points=[1, 52,16, 52],
  526. Lib_矩形箭头竖Node5rect=ht.Default.unionPoint([{x:1,y:52},{x:16,y:52}]),
  527. Lib_矩形箭头竖Node5compspts=[];
  528. _ratio = GD.getRatioWithRotation(0, ratio);
  529. var _startratio = GD.getRatioWithRotation(3.14159265358979, ratio),
  530. _endratio = GD.getRatioWithRotation(0, ratio);
  531. for(var i=0;i<Lib_矩形箭头竖Node5points.length;i++){
  532. if(i%2==0){
  533. Lib_矩形箭头竖Node5compspts.push(Lib_矩形箭头竖Node5points[i]-Lib_矩形箭头竖Node5rect.x);
  534. }else{
  535. Lib_矩形箭头竖Node5compspts.push(Lib_矩形箭头竖Node5points[i]-Lib_矩形箭头竖Node5rect.y);
  536. }
  537. }
  538. var Lib_矩形箭头竖Node5ptslength=Lib_矩形箭头竖Node5compspts.length;
  539. if (Lib_矩形箭头竖Node5rect.height === 0) {
  540. Lib_矩形箭头竖Node5compspts[0] -= 0;
  541. Lib_矩形箭头竖Node5compspts[Lib_矩形箭头竖Node5ptslength-2] += 0;
  542. } else if (Lib_矩形箭头竖Node5rect.width === 0){
  543. Lib_矩形箭头竖Node5compspts[1] -= 0;
  544. Lib_矩形箭头竖Node5compspts[Lib_矩形箭头竖Node5ptslength-1] += 0;
  545. } else {
  546. Lib_矩形箭头竖Node5compspts[0] -= 0;
  547. Lib_矩形箭头竖Node5compspts[1] -= 0;
  548. Lib_矩形箭头竖Node5compspts[Lib_矩形箭头竖Node5ptslength-2] += 0;
  549. Lib_矩形箭头竖Node5compspts[Lib_矩形箭头竖Node5ptslength-1] += 0;
  550. }
  551. Lib_矩形箭头竖Node5 = new ht.Node();
  552. Lib_矩形箭头竖Node5.borderWidth = 2;
  553. Lib_矩形箭头竖Node5rect.width = Lib_矩形箭头竖Node5rect.width === 0 ? 0.0001 : Lib_矩形箭头竖Node5rect.width;
  554. Lib_矩形箭头竖Node5rect.height = Lib_矩形箭头竖Node5rect.height === 0 ? 0.0001 : Lib_矩形箭头竖Node5rect.height;
  555. var Lib_矩形箭头竖Node5endCompspts = [Lib_矩形箭头竖Node5compspts[Lib_矩形箭头竖Node5ptslength-2],Lib_矩形箭头竖Node5compspts[Lib_矩形箭头竖Node5ptslength-1],0,0];
  556. var Lib_矩形箭头竖Node5startCompspts = [Lib_矩形箭头竖Node5compspts[0],Lib_矩形箭头竖Node5compspts[1],0,0];
  557. Lib_矩形箭头竖Node5.setImage(GD.getPolyLineJSON());
  558. Lib_矩形箭头竖Node5.setPosition(Lib_矩形箭头竖Node5rect.x+Lib_矩形箭头竖Node5rect.width/2,Lib_矩形箭头竖Node5rect.y+Lib_矩形箭头竖Node5rect.height/2);
  559. Lib_矩形箭头竖Node5.setSize(Lib_矩形箭头竖Node5rect.width,Lib_矩形箭头竖Node5rect.height);
  560. Lib_矩形箭头竖Node5.setStyle("opacity",1);
  561. Lib_矩形箭头竖Node5.s({'pixelPerfect':true});
  562. Lib_矩形箭头竖Node5borderwidth=2;
  563. Lib_矩形箭头竖Node5.setRotation(0);
  564. dataModel.add(Lib_矩形箭头竖Node5);
  565. Lib_矩形箭头竖Node5.a('node.points',Lib_矩形箭头竖Node5compspts);
  566. Lib_矩形箭头竖Node5.a('node.segments',[1,2]);
  567. Lib_矩形箭头竖Node5.a('node.color','rgba(255,0,255,1)');
  568. Lib_矩形箭头竖Node5.a('node.borderPattern',getDashStyle("@borderPattern@"));
  569. Lib_矩形箭头竖Node5.a('node.borderColor','rgba(255,0,255,1)');
  570. Lib_矩形箭头竖Node5.a('node.background','rgba(255,0,255,1)');
  571. Lib_矩形箭头竖Node5.a('node.gradient','');
  572. Lib_矩形箭头竖Node5.a('node.gradientcolor','rgba(255,0,255,1)');
  573. Lib_矩形箭头竖Node5.a('node.endCompspts',Lib_矩形箭头竖Node5endCompspts);
  574. Lib_矩形箭头竖Node5.a('node.startCompspts',Lib_矩形箭头竖Node5startCompspts);
  575. (function (node, img, compspts, endCompspts, startCompspts) {
  576. var position = node.getPosition(),
  577. w = node.getWidth()*_ratio.ratioX,
  578. h = node.getHeight()*_ratio.ratioY;
  579. function resetPoints(rx, ry) {
  580. for (var i = 0, len = compspts.length; i < len; i++) {
  581. if (i%2 === 0) {
  582. compspts[i]*=rx;
  583. } else {
  584. compspts[i]*=ry;
  585. }
  586. }
  587. endCompspts[0] = compspts[compspts.length-2];
  588. endCompspts[1] = compspts[compspts.length-1];
  589. endCompspts[2] *= rx;
  590. endCompspts[3] *= ry;
  591. node.a('node.offsetEndY', -(endCompspts[3]*0.5));
  592. node.a('node.offsetEndX', -(endCompspts[2]*0.5));
  593. startCompspts[0] = compspts[0];
  594. startCompspts[1] = compspts[1];
  595. startCompspts[2] *= rx;
  596. startCompspts[3] *= ry;
  597. node.a('node.offsetStartY', -(startCompspts[3]*0.5));
  598. node.a('node.offsetStartX', -(startCompspts[2]*0.5));
  599. node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
  600. node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
  601. }
  602. node.setSize(w, h);
  603. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  604. node.a('node.width', w);
  605. node.a('node.height', h);
  606. resetPoints(_ratio.ratioX, _ratio.ratioY);
  607. node.borderWidth = 2;
  608. node.a('node.borderwidth',node.borderWidth);
  609. node._nodename = 'Lib_矩形箭头竖Node5';
  610. node._nodeType = 'line';
  611. zoomNodeList.push({
  612. node: node,
  613. attr: 'node.borderwidth'
  614. });
  615. var setWidth = node.setWidth,
  616. setHeight = node.setHeight,
  617. timer, rx = 1, ry = 1;
  618. node.setWidth = function (width) {
  619. var _width = this.getWidth();
  620. rx = width / _width;
  621. node.a('node.width', width);
  622. setWidth.apply(this, arguments);
  623. resetPoints(rx, 1);
  624. }
  625. node.setHeight = function (height) {
  626. var _height = this.getHeight();
  627. ry = height / _height;
  628. node.a('node.height', height);
  629. setHeight.apply(this, arguments);
  630. resetPoints(1, ry);
  631. }
  632. })(Lib_矩形箭头竖Node5, Lib_矩形箭头竖Node5.getImage(), Lib_矩形箭头竖Node5compspts, Lib_矩形箭头竖Node5endCompspts, Lib_矩形箭头竖Node5startCompspts);
  633. var Lib_矩形箭头竖Node6points=[0, 49,19, 49],
  634. Lib_矩形箭头竖Node6rect=ht.Default.unionPoint([{x:0,y:49},{x:19,y:49}]),
  635. Lib_矩形箭头竖Node6compspts=[];
  636. _ratio = GD.getRatioWithRotation(0, ratio);
  637. var _startratio = GD.getRatioWithRotation(3.14159265358979, ratio),
  638. _endratio = GD.getRatioWithRotation(0, ratio);
  639. for(var i=0;i<Lib_矩形箭头竖Node6points.length;i++){
  640. if(i%2==0){
  641. Lib_矩形箭头竖Node6compspts.push(Lib_矩形箭头竖Node6points[i]-Lib_矩形箭头竖Node6rect.x);
  642. }else{
  643. Lib_矩形箭头竖Node6compspts.push(Lib_矩形箭头竖Node6points[i]-Lib_矩形箭头竖Node6rect.y);
  644. }
  645. }
  646. var Lib_矩形箭头竖Node6ptslength=Lib_矩形箭头竖Node6compspts.length;
  647. if (Lib_矩形箭头竖Node6rect.height === 0) {
  648. Lib_矩形箭头竖Node6compspts[0] -= 0;
  649. Lib_矩形箭头竖Node6compspts[Lib_矩形箭头竖Node6ptslength-2] += 0;
  650. } else if (Lib_矩形箭头竖Node6rect.width === 0){
  651. Lib_矩形箭头竖Node6compspts[1] -= 0;
  652. Lib_矩形箭头竖Node6compspts[Lib_矩形箭头竖Node6ptslength-1] += 0;
  653. } else {
  654. Lib_矩形箭头竖Node6compspts[0] -= 0;
  655. Lib_矩形箭头竖Node6compspts[1] -= 0;
  656. Lib_矩形箭头竖Node6compspts[Lib_矩形箭头竖Node6ptslength-2] += 0;
  657. Lib_矩形箭头竖Node6compspts[Lib_矩形箭头竖Node6ptslength-1] += 0;
  658. }
  659. Lib_矩形箭头竖Node6 = new ht.Node();
  660. Lib_矩形箭头竖Node6.borderWidth = 2;
  661. Lib_矩形箭头竖Node6rect.width = Lib_矩形箭头竖Node6rect.width === 0 ? 0.0001 : Lib_矩形箭头竖Node6rect.width;
  662. Lib_矩形箭头竖Node6rect.height = Lib_矩形箭头竖Node6rect.height === 0 ? 0.0001 : Lib_矩形箭头竖Node6rect.height;
  663. var Lib_矩形箭头竖Node6endCompspts = [Lib_矩形箭头竖Node6compspts[Lib_矩形箭头竖Node6ptslength-2],Lib_矩形箭头竖Node6compspts[Lib_矩形箭头竖Node6ptslength-1],0,0];
  664. var Lib_矩形箭头竖Node6startCompspts = [Lib_矩形箭头竖Node6compspts[0],Lib_矩形箭头竖Node6compspts[1],0,0];
  665. Lib_矩形箭头竖Node6.setImage(GD.getPolyLineJSON());
  666. Lib_矩形箭头竖Node6.setPosition(Lib_矩形箭头竖Node6rect.x+Lib_矩形箭头竖Node6rect.width/2,Lib_矩形箭头竖Node6rect.y+Lib_矩形箭头竖Node6rect.height/2);
  667. Lib_矩形箭头竖Node6.setSize(Lib_矩形箭头竖Node6rect.width,Lib_矩形箭头竖Node6rect.height);
  668. Lib_矩形箭头竖Node6.setStyle("opacity",1);
  669. Lib_矩形箭头竖Node6.s({'pixelPerfect':true});
  670. Lib_矩形箭头竖Node6borderwidth=2;
  671. Lib_矩形箭头竖Node6.setRotation(0);
  672. dataModel.add(Lib_矩形箭头竖Node6);
  673. Lib_矩形箭头竖Node6.a('node.points',Lib_矩形箭头竖Node6compspts);
  674. Lib_矩形箭头竖Node6.a('node.segments',[1,2]);
  675. Lib_矩形箭头竖Node6.a('node.color','rgba(255,0,255,1)');
  676. Lib_矩形箭头竖Node6.a('node.borderPattern',getDashStyle("@borderPattern@"));
  677. Lib_矩形箭头竖Node6.a('node.borderColor','rgba(255,0,255,1)');
  678. Lib_矩形箭头竖Node6.a('node.background','rgba(255,0,255,1)');
  679. Lib_矩形箭头竖Node6.a('node.gradient','');
  680. Lib_矩形箭头竖Node6.a('node.gradientcolor','rgba(255,0,255,1)');
  681. Lib_矩形箭头竖Node6.a('node.endCompspts',Lib_矩形箭头竖Node6endCompspts);
  682. Lib_矩形箭头竖Node6.a('node.startCompspts',Lib_矩形箭头竖Node6startCompspts);
  683. (function (node, img, compspts, endCompspts, startCompspts) {
  684. var position = node.getPosition(),
  685. w = node.getWidth()*_ratio.ratioX,
  686. h = node.getHeight()*_ratio.ratioY;
  687. function resetPoints(rx, ry) {
  688. for (var i = 0, len = compspts.length; i < len; i++) {
  689. if (i%2 === 0) {
  690. compspts[i]*=rx;
  691. } else {
  692. compspts[i]*=ry;
  693. }
  694. }
  695. endCompspts[0] = compspts[compspts.length-2];
  696. endCompspts[1] = compspts[compspts.length-1];
  697. endCompspts[2] *= rx;
  698. endCompspts[3] *= ry;
  699. node.a('node.offsetEndY', -(endCompspts[3]*0.5));
  700. node.a('node.offsetEndX', -(endCompspts[2]*0.5));
  701. startCompspts[0] = compspts[0];
  702. startCompspts[1] = compspts[1];
  703. startCompspts[2] *= rx;
  704. startCompspts[3] *= ry;
  705. node.a('node.offsetStartY', -(startCompspts[3]*0.5));
  706. node.a('node.offsetStartX', -(startCompspts[2]*0.5));
  707. node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
  708. node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
  709. }
  710. node.setSize(w, h);
  711. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  712. node.a('node.width', w);
  713. node.a('node.height', h);
  714. resetPoints(_ratio.ratioX, _ratio.ratioY);
  715. node.borderWidth = 2;
  716. node.a('node.borderwidth',node.borderWidth);
  717. node._nodename = 'Lib_矩形箭头竖Node6';
  718. node._nodeType = 'line';
  719. zoomNodeList.push({
  720. node: node,
  721. attr: 'node.borderwidth'
  722. });
  723. var setWidth = node.setWidth,
  724. setHeight = node.setHeight,
  725. timer, rx = 1, ry = 1;
  726. node.setWidth = function (width) {
  727. var _width = this.getWidth();
  728. rx = width / _width;
  729. node.a('node.width', width);
  730. setWidth.apply(this, arguments);
  731. resetPoints(rx, 1);
  732. }
  733. node.setHeight = function (height) {
  734. var _height = this.getHeight();
  735. ry = height / _height;
  736. node.a('node.height', height);
  737. setHeight.apply(this, arguments);
  738. resetPoints(1, ry);
  739. }
  740. })(Lib_矩形箭头竖Node6, Lib_矩形箭头竖Node6.getImage(), Lib_矩形箭头竖Node6compspts, Lib_矩形箭头竖Node6endCompspts, Lib_矩形箭头竖Node6startCompspts);
  741. /*@GraphList@*/
  742. /*@PageInit@*/
  743. var localVarObj = this.localVarObj;
  744. var localDynamicVarObj = this.localDynamicVar();
  745. this['Lib_矩形箭头竖Node0'] = Lib_矩形箭头竖Node0;
  746. Lib_矩形箭头竖Node0.__parentLib = nodename;
  747. Lib_矩形箭头竖Node0.__parent = this;
  748. this.childNodes.push(Lib_矩形箭头竖Node0);
  749. this['Lib_矩形箭头竖Node1'] = Lib_矩形箭头竖Node1;
  750. Lib_矩形箭头竖Node1.__parentLib = nodename;
  751. Lib_矩形箭头竖Node1.__parent = this;
  752. this.childNodes.push(Lib_矩形箭头竖Node1);
  753. this['Lib_矩形箭头竖Node2'] = Lib_矩形箭头竖Node2;
  754. Lib_矩形箭头竖Node2.__parentLib = nodename;
  755. Lib_矩形箭头竖Node2.__parent = this;
  756. this.childNodes.push(Lib_矩形箭头竖Node2);
  757. this['Lib_矩形箭头竖Node3'] = Lib_矩形箭头竖Node3;
  758. Lib_矩形箭头竖Node3.__parentLib = nodename;
  759. Lib_矩形箭头竖Node3.__parent = this;
  760. this.childNodes.push(Lib_矩形箭头竖Node3);
  761. this['Lib_矩形箭头竖Node4'] = Lib_矩形箭头竖Node4;
  762. Lib_矩形箭头竖Node4.__parentLib = nodename;
  763. Lib_矩形箭头竖Node4.__parent = this;
  764. this.childNodes.push(Lib_矩形箭头竖Node4);
  765. this['Lib_矩形箭头竖Node5'] = Lib_矩形箭头竖Node5;
  766. Lib_矩形箭头竖Node5.__parentLib = nodename;
  767. Lib_矩形箭头竖Node5.__parent = this;
  768. this.childNodes.push(Lib_矩形箭头竖Node5);
  769. this['Lib_矩形箭头竖Node6'] = Lib_矩形箭头竖Node6;
  770. Lib_矩形箭头竖Node6.__parentLib = nodename;
  771. Lib_矩形箭头竖Node6.__parent = this;
  772. this.childNodes.push(Lib_矩形箭头竖Node6);
  773. /*@ControlContextMenu@*/
  774. /*@Declare@*/
  775. this.init(x, y, width, height, angle);
  776. };
  777. ht.Default.def('ht.lib.矩形箭头竖', Object, {
  778. refresh10ms: function () {
  779. var localVarObj = this.localVarObj;
  780. var localDynamicVarObj = this.localDynamicVar();
  781. var Lib_矩形箭头竖Node0= this.Lib_矩形箭头竖Node0;
  782. var Lib_矩形箭头竖Node1= this.Lib_矩形箭头竖Node1;
  783. var Lib_矩形箭头竖Node2= this.Lib_矩形箭头竖Node2;
  784. var Lib_矩形箭头竖Node3= this.Lib_矩形箭头竖Node3;
  785. var Lib_矩形箭头竖Node4= this.Lib_矩形箭头竖Node4;
  786. var Lib_矩形箭头竖Node5= this.Lib_矩形箭头竖Node5;
  787. var Lib_矩形箭头竖Node6= this.Lib_矩形箭头竖Node6;
  788. /*@refresh10ms@*/
  789. },
  790. refresh100ms: function () {
  791. var localVarObj = this.localVarObj;
  792. var localDynamicVarObj = this.localDynamicVar();
  793. var Lib_矩形箭头竖Node0= this.Lib_矩形箭头竖Node0;
  794. var Lib_矩形箭头竖Node1= this.Lib_矩形箭头竖Node1;
  795. var Lib_矩形箭头竖Node2= this.Lib_矩形箭头竖Node2;
  796. var Lib_矩形箭头竖Node3= this.Lib_矩形箭头竖Node3;
  797. var Lib_矩形箭头竖Node4= this.Lib_矩形箭头竖Node4;
  798. var Lib_矩形箭头竖Node5= this.Lib_矩形箭头竖Node5;
  799. var Lib_矩形箭头竖Node6= this.Lib_矩形箭头竖Node6;
  800. /*@refresh100ms@*/
  801. },
  802. refresh500ms: function () {
  803. var localVarObj = this.localVarObj;
  804. var localDynamicVarObj = this.localDynamicVar();
  805. var Lib_矩形箭头竖Node0= this.Lib_矩形箭头竖Node0;
  806. var Lib_矩形箭头竖Node1= this.Lib_矩形箭头竖Node1;
  807. var Lib_矩形箭头竖Node2= this.Lib_矩形箭头竖Node2;
  808. var Lib_矩形箭头竖Node3= this.Lib_矩形箭头竖Node3;
  809. var Lib_矩形箭头竖Node4= this.Lib_矩形箭头竖Node4;
  810. var Lib_矩形箭头竖Node5= this.Lib_矩形箭头竖Node5;
  811. var Lib_矩形箭头竖Node6= this.Lib_矩形箭头竖Node6;
  812. /*@refresh500ms@*/
  813. },
  814. refresh1s: function () {
  815. var Counter1s = arguments[0] || 0;
  816. var localVarObj = this.localVarObj;
  817. var localDynamicVarObj = this.localDynamicVar();
  818. var Lib_矩形箭头竖Node0= this.Lib_矩形箭头竖Node0;
  819. var Lib_矩形箭头竖Node1= this.Lib_矩形箭头竖Node1;
  820. var Lib_矩形箭头竖Node2= this.Lib_矩形箭头竖Node2;
  821. var Lib_矩形箭头竖Node3= this.Lib_矩形箭头竖Node3;
  822. var Lib_矩形箭头竖Node4= this.Lib_矩形箭头竖Node4;
  823. var Lib_矩形箭头竖Node5= this.Lib_矩形箭头竖Node5;
  824. var Lib_矩形箭头竖Node6= this.Lib_矩形箭头竖Node6;
  825. /*@refresh1s@*/
  826. },
  827. refresh5s: function () {
  828. var localVarObj = this.localVarObj;
  829. var localDynamicVarObj = this.localDynamicVar();
  830. var Lib_矩形箭头竖Node0= this.Lib_矩形箭头竖Node0;
  831. var Lib_矩形箭头竖Node1= this.Lib_矩形箭头竖Node1;
  832. var Lib_矩形箭头竖Node2= this.Lib_矩形箭头竖Node2;
  833. var Lib_矩形箭头竖Node3= this.Lib_矩形箭头竖Node3;
  834. var Lib_矩形箭头竖Node4= this.Lib_矩形箭头竖Node4;
  835. var Lib_矩形箭头竖Node5= this.Lib_矩形箭头竖Node5;
  836. var Lib_矩形箭头竖Node6= this.Lib_矩形箭头竖Node6;
  837. /*@refresh5s@*/
  838. },
  839. /*@PageDynamic@*/
  840. onEvent: function (e, data, type, origin, offset, objMouseOn, ctm) {
  841. var localVarObj = this.localVarObj;
  842. var localDynamicVarObj = this.localDynamicVar();
  843. var Lib_矩形箭头竖Node0= this.Lib_矩形箭头竖Node0;
  844. var Lib_矩形箭头竖Node1= this.Lib_矩形箭头竖Node1;
  845. var Lib_矩形箭头竖Node2= this.Lib_矩形箭头竖Node2;
  846. var Lib_矩形箭头竖Node3= this.Lib_矩形箭头竖Node3;
  847. var Lib_矩形箭头竖Node4= this.Lib_矩形箭头竖Node4;
  848. var Lib_矩形箭头竖Node5= this.Lib_矩形箭头竖Node5;
  849. var Lib_矩形箭头竖Node6= this.Lib_矩形箭头竖Node6;
  850. if (type === 'click') {
  851. /*@EvnentClicked@*/
  852. } else if (type === 'mousedown') {
  853. mouseX=e.clientX;
  854. mouseY=e.clientY;
  855. /*@EvnentMouseDown@*/
  856. } else if (type === 'mouseup') {
  857. /*@EvnentMouseUp@*/
  858. } else if (type === 'mousemove') {
  859. var mouseX, mouseY, position, zoom;
  860. position=origin.getLogicalPoint(e);
  861. zoom = graphView.getZoom();
  862. if (origin === graphView) {
  863. mouseX= position.x + origin.tx();
  864. mouseY = position.y + origin.ty();
  865. } else {
  866. offset = offset || {x: 0, y: 0};
  867. mouseX = position.x / zoom + offset.x + origin.tx();
  868. mouseY = position.y / zoom + offset.y + origin.ty();
  869. }
  870. /*@EvnentMouseLeave@*/
  871. /*@EvnentMouseOver@*/
  872. } else if (type === 'keydown') {
  873. /*@EvnentKeyDown@*/
  874. } else if (type === 'contextmenu') {
  875. /*@Declare@*/
  876. /*@SetNodeContextMenu@*/
  877. /*@SetPageContextMenu@*/
  878. }
  879. /*@LibEvent@*/
  880. },
  881. getBaseClass: function () {
  882. return this._baseClass;
  883. },
  884. getWidth: function () {
  885. return this._width;
  886. },
  887. getHeight: function () {
  888. return this._height;
  889. },
  890. getSize: function () {
  891. return {
  892. width: this._width,
  893. height: this._height
  894. }
  895. },
  896. setWidth: function (width) {
  897. if (width === undefined || width === null || width != width) {
  898. return ;
  899. }
  900. var originWidth = this._width;
  901. var ratio = width / originWidth;
  902. var childNodes = this.childNodes, childNode, p, op = this.getPosition(), w, cw, ox, rotation = this.getRotation();
  903. for (var i = 0, len = childNodes.length; i < len; i++) {
  904. childNode = childNodes[i];
  905. p = childNode.getPosition();
  906. cw = childNode.getWidth();
  907. w = cw >=2 ? cw * ratio : cw;
  908. childNode.setWidth(w);
  909. ox = op.x + (p.x - op.x) * ratio;
  910. childNode.setPosition(ox, p.y);
  911. rotation = GD.calcRotation(rotation);
  912. if (rotation === 0 || rotation === Math.PI) {
  913. // 图元未旋转
  914. ox = op.x + (p.x - op.x)*ratio;
  915. childNode.setPosition(ox, p.y);
  916. } else if (rotation === 90 * Math.PI / 180) {
  917. // 图元旋转以后
  918. ox = op.y + (p.y - op.y)*ratio;
  919. childNode.setPosition(p.x, ox);
  920. }
  921. }
  922. this._width = width;
  923. this._originWidth = width;
  924. this._ratioX = ratio;
  925. return this;
  926. },
  927. setHeight: function (height) {
  928. if (height === undefined || height === null || height != height) {
  929. return ;
  930. }
  931. var originHeight = this._height;
  932. var ratio = height / originHeight;
  933. var childNodes = this.childNodes, childNode, p, op = this.getPosition(), h, ch, oy, rotation = this.getRotation();
  934. for (var i = 0, len = childNodes.length; i < len; i++) {
  935. childNode = childNodes[i];
  936. p = childNode.getPosition();
  937. ch = childNode.getHeight();
  938. h = ch >=2 ? ch * ratio : ch;
  939. childNode.setHeight(h);
  940. rotation = GD.calcRotation(rotation);
  941. if (rotation === 0 || rotation === Math.PI) {
  942. // 图元未旋转
  943. oy = op.y + (p.y - op.y)*ratio;
  944. childNode.setPosition(p.x, oy);
  945. } else if (rotation === 90 * Math.PI / 180) {
  946. // 图元旋转以后
  947. oy = op.x + (p.x - op.x)*ratio;
  948. childNode.setPosition(oy, p.y);
  949. }
  950. }
  951. this._height = height;
  952. this._originHeight = height;
  953. this._ratioY = ratio;
  954. return this;
  955. },
  956. setSize: function (size) {
  957. // var args = Array.prototype.slice.call(arguments, 0);
  958. // var height, width;
  959. // if (args.length === 0) {
  960. // return ;
  961. // }else if (args.length === 1) {
  962. // height = args[0].height;
  963. // width = args[0].width;
  964. // } else {
  965. // width = args[0];
  966. // height = args[1];
  967. // }
  968. // var wh = GD.getRatioWithRotation(angle, wid)
  969. // this.setHeight(height);
  970. // this.setWidth(width);
  971. // return this;
  972. var args = Array.prototype.slice.call(arguments, 0);
  973. var height, width;
  974. if (args.length === 0) {
  975. return ;
  976. }else if (args.length === 1) {
  977. height = args[0].height;
  978. width = args[0].width;
  979. angle = 0;
  980. } else if (args.length === 2) {
  981. if (typeof args[0] === 'object') {
  982. width = args[0].width;
  983. height = args[0].height;
  984. angle = args[1] || 0;
  985. } else {
  986. width = args[0];
  987. height = args[1];
  988. angle = 0;
  989. }
  990. } else if (args.length === 3) {
  991. width = args[0];
  992. height = args[1];
  993. angle = args[2] || 0;
  994. }
  995. var wh = GD.getRatioWithRotation(0, width, height);
  996. this.setHeight(wh.ratioY);
  997. this.setWidth(wh.ratioX);
  998. return this;
  999. },
  1000. getPosition: function () {
  1001. return {
  1002. x: this._x,
  1003. y: this._y
  1004. }
  1005. },
  1006. setPosition: function () {
  1007. var args = Array.prototype.slice.call(arguments, 0), x, y;
  1008. if (args.length === 0) {
  1009. return this;
  1010. } else if (args.length === 1) {
  1011. if (typeof args[0] != 'object') {
  1012. return this;
  1013. }
  1014. x = args[0].x;
  1015. y = args[0].y;
  1016. } else {
  1017. x = args[0];
  1018. y = args[1];
  1019. }
  1020. if ((x !== 0 && !x) || (y !== 0 && !y)) {
  1021. return this;
  1022. }
  1023. // var childNodes = this.childNodes, offset, childNode, p;
  1024. // for (var i = 0, len = childNodes.length; i < len; i++) {
  1025. // childNode = childNodes[i];
  1026. // p = childNode.getPosition();
  1027. // childNode.setPosition(x - (this._x-p.x)*this._ratioX, y - (this._y-p.y)*this._ratioY);
  1028. // }
  1029. // this._x = x;
  1030. // this._y = y;
  1031. // return this;
  1032. var childNodes, childNode, background, offset = {}, op, cp;
  1033. childNodes = this.childNodes;
  1034. background = this._background;
  1035. op = background.getPosition();
  1036. offset.x = x - op.x;
  1037. offset.y = y - op.y;
  1038. for (var i = 0, len = childNodes.length; i < len; i++) {
  1039. childNode = childNodes[i];
  1040. cp = childNode.getPosition();
  1041. childNode.setPosition(cp.x + offset.x, cp.y + offset.y);
  1042. }
  1043. this._x = x;
  1044. this._y = y;
  1045. this._position = {x: x, y: y};
  1046. return this;
  1047. },
  1048. getStyle: function (key) {
  1049. if (!key) {
  1050. return undefined;
  1051. }
  1052. return this._styleObject[key];
  1053. },
  1054. setStyle: function (key, value, force) {
  1055. var childNodes = this.childNodes, childNode;
  1056. for (var i = 0, len = childNodes.length; i < len; i++) {
  1057. childNode = childNodes[i];
  1058. if (key === '2d.visible') {
  1059. if (value === graphView.isVisible(childNode)) {
  1060. continue;
  1061. }
  1062. if (!value) {
  1063. childNode._savedIsVisible = graphView.isVisible(childNode);
  1064. childNode.s({
  1065. '2d.visible': false
  1066. })
  1067. } else {
  1068. childNode.s({
  1069. '2d.visible': childNode._savedIsVisible
  1070. })
  1071. }
  1072. continue;
  1073. }
  1074. childNode.s({
  1075. key: value
  1076. });
  1077. }
  1078. this._styleObject[key] = value;
  1079. return this;
  1080. },
  1081. calcSize: function () {
  1082. var background = this._background;
  1083. var position = background.getPosition(),
  1084. width = background.getWidth(),
  1085. height = background.getHeight();
  1086. this._width = width;
  1087. this._height = height;
  1088. this._x = position.x;
  1089. this._y = position.y;
  1090. this._position = {
  1091. x: this._x,
  1092. y: this._y
  1093. }
  1094. return this;
  1095. return this;
  1096. },
  1097. s: function (styleObj, force) {
  1098. var args = Array.prototype.slice.call(arguments, 0);
  1099. var styleObj;
  1100. if (args.length === 0) {
  1101. return this;
  1102. } else if (args.length === 1) {
  1103. styleObj = args[0];
  1104. } else {
  1105. this.setStyle(args[0], args[1]);
  1106. return this;
  1107. }
  1108. for (var key in styleObj) {
  1109. if (!styleObj.hasOwnProperty(key)) {
  1110. continue;
  1111. }
  1112. this.setStyle(key, styleObj[key], force);
  1113. }
  1114. return this;
  1115. },
  1116. init: function (x, y, width, height, angle) {
  1117. var that = this;
  1118. this.calcSize();
  1119. (function (width, height, angle) {
  1120. // that.setSize(width, height, angle);
  1121. // var wh = GD.getRatioWithRotation(angle, width, height);
  1122. // width = wh.ratioX;
  1123. // height = wh.ratioY;
  1124. var originHeight = that._height;
  1125. var originWidth = that._width;
  1126. var ratioY = height / originHeight;
  1127. var ratioX = width / originWidth;
  1128. var childNodes = that.childNodes,
  1129. childNode,p, op = that.getPosition(), h, ch, oy, w, cw, ox, name, borderRatio, borderWidth;
  1130. for (var i = 0, len = childNodes.length; i < len; i++) {
  1131. childNode = childNodes[i];
  1132. p = childNode.getPosition();
  1133. childNode.originHeight = childNode.originHeight || childNode.getHeight();
  1134. ch = childNode.getHeight();
  1135. cw = childNode.getWidth();
  1136. if (ch > 2) {
  1137. h = ch * ratioY;
  1138. childNode.setHeight(h);
  1139. }
  1140. if (cw > 2) {
  1141. w = cw * ratioX;
  1142. childNode.setWidth(w);
  1143. }
  1144. borderRatio = (ratioX + ratioY)*0.5;
  1145. if (childNode._nodeType === 'line') { // 如果是线,
  1146. if (childNode.getWidth() > childNode.getHeight()) {
  1147. borderRatio = ratioX;
  1148. } else {
  1149. borderRatio = ratioY;
  1150. }
  1151. }
  1152. name = childNode._nodename;
  1153. // if (childNode.borderWidth && name && ch > 2 && cw > 2) {
  1154. // borderWidth = childNode.borderWidth / borderRatio;
  1155. // if (borderWidth > ch*0.5 || borderWidth > cw *0.5) {
  1156. // // borderWidth = childNode.borderWidth;
  1157. // }
  1158. // childNode.borderWidth = borderWidth;
  1159. // childNode.a(name + '.borderwidth', borderWidth);
  1160. // }
  1161. }
  1162. that._height = height;
  1163. that._originHeight = height;
  1164. that._ratioY = ratioY;
  1165. that._width = width;
  1166. that._originWidth = width;
  1167. that._ratioX = ratioX;
  1168. })(width, height, angle);
  1169. that._x = width / 2;
  1170. that._y = height / 2;
  1171. that._rotation = 0;
  1172. // that.setPosition(x, y);
  1173. (function (x, y) {
  1174. var childNodes = that.childNodes, offset, childNode;
  1175. var w2 = that.getWidth() / 2, h2 = that.getHeight()/2;
  1176. for (var i = 0, len = childNodes.length; i < len; i++) {
  1177. childNode = childNodes[i];
  1178. offset = childNode.getPosition();
  1179. childNode.setPosition(x + offset.x * that._ratioX - w2, y + offset.y * that._ratioY - h2);
  1180. }
  1181. that._x = x;
  1182. that._y = y;
  1183. })(x, y);
  1184. // setTimeout(that.addEVent, 1000);
  1185. },
  1186. setRotation: function (angle) {
  1187. var that = this, _angle = that.getRotation();
  1188. if (angle!==0 && !angle || angle === _angle) {
  1189. return this;
  1190. }
  1191. var childNodes = this.childNodes, childNode, p = this.getPosition(), px = p.x, py = p.y;
  1192. for (var i = 0, len = childNodes.length; i < len; i++) {
  1193. childNode = childNodes[i];
  1194. var x = childNode.getPosition().x - px;
  1195. var y = childNode.getPosition().y - py;
  1196. childNode.setPosition(Math.cos(angle-_angle) * x - Math.sin(angle-_angle) * y + px, Math.cos(angle-_angle) * y + Math.sin(angle-_angle) * x + py);
  1197. childNode.setRotation(angle);
  1198. }
  1199. this._rotation = angle;
  1200. return this;
  1201. },
  1202. getRotation: function () {
  1203. return this._rotation;
  1204. },
  1205. setScale: function (sx, sy) {
  1206. var that = this,
  1207. childNodes = this.childNodes,
  1208. childNode;
  1209. if (sx === undefined || sx === null) return ;
  1210. if (sy === undefined || sy === null) {
  1211. sy = sx;
  1212. }
  1213. for (var i = 0, len = childNodes.length; i < len; i++) {
  1214. childNode = childNodes[i];
  1215. if (typeof childNode.setScale === 'function') {
  1216. childNode.setScale(sx, sy);
  1217. }
  1218. }
  1219. },
  1220. getScale: function () {
  1221. return this._background.getScale();
  1222. },
  1223. setScaleX: function (sx) {
  1224. if (sx === undefined || sx === null) return;
  1225. var that = this,
  1226. childNodes = this.childNodes,
  1227. childNode;
  1228. for (var i = 0, len = childNodes.length; i < len; i++) {
  1229. childNode = childNodes[i];
  1230. if (typeof childNode.setScaleX === 'function') {
  1231. childNode.setScaleX(sx);
  1232. }
  1233. }
  1234. },
  1235. setScaleY: function (sy) {
  1236. if (sy === undefined || sy === null) return;
  1237. var that = this,
  1238. childNodes = this.childNodes,
  1239. childNode;
  1240. for (var i = 0, len = childNodes.length; i < len; i++) {
  1241. childNode = childNodes[i];
  1242. if (typeof childNode.setScaleY === 'function') {
  1243. childNode.setScaleY(sy);
  1244. }
  1245. }
  1246. },
  1247. getScaleX: function () {
  1248. return this._background.getScaleX();
  1249. },
  1250. getScaleY: function () {
  1251. return this._background.getScaleY();
  1252. },
  1253. evert: function () {
  1254. var that = this,
  1255. childNodes = this.childNodes,
  1256. background = this._background,
  1257. bp = background.getPosition(),
  1258. bx = bp.x,
  1259. by = bp.y,
  1260. childNode, distanceX, distanceY, x, y, p, nx, ny;
  1261. for (var i = 0, len = childNodes.length; i < len; i++) {
  1262. childNode = childNodes[i];
  1263. p = childNode.getPosition();
  1264. x = p.x;
  1265. y = p.y;
  1266. distanceX = bx - x;
  1267. distanceY = by - y;
  1268. nx = bx + distanceX;
  1269. ny = by + distanceY;
  1270. childNode.setPosition(nx, ny);
  1271. if (typeof childNode.setScale === 'function') {
  1272. if (!(childNode._disallowEvert === true))
  1273. childNode.setScale(-1, -1);
  1274. }
  1275. }
  1276. },
  1277. evertX: function () {
  1278. var that = this,
  1279. childNodes = this.childNodes,
  1280. background = this._background,
  1281. bx = background.getPosition().x,
  1282. childNode, distance, x, p, nx;
  1283. for (var i = 0, len = childNodes.length; i < len; i++) {
  1284. childNode = childNodes[i];
  1285. p = childNode.getPosition();
  1286. x = p.x;
  1287. distance = bx - x;
  1288. nx = bx + distance;
  1289. childNode.setPosition(nx, p.y);
  1290. if (typeof childNode.setScaleX === 'function') {
  1291. if (!(childNode._disallowEvert === true))
  1292. childNode.setScaleX(-1);
  1293. }
  1294. }
  1295. },
  1296. evertY: function () {
  1297. var that = this,
  1298. childNodes = this.childNodes,
  1299. background = this._background,
  1300. by = background.getPosition().y,
  1301. childNode, distance, y, p, ny;
  1302. for (var i = 0, len = childNodes.length; i < len; i++) {
  1303. childNode = childNodes[i];
  1304. p = childNode.getPosition();
  1305. y = p.y;
  1306. distance = by - y;
  1307. ny = by + distance;
  1308. childNode.setPosition(p.x, ny);
  1309. if (typeof childNode.setScaleY === 'function') {
  1310. if (!(childNode._disallowEvert === true))
  1311. childNode.setScaleY(-1);
  1312. }
  1313. }
  1314. },
  1315. attr: function (key, value) {
  1316. var _attrObj = this._attrObj || {};
  1317. if (arguments.length === 1) {
  1318. return _attrObj[key];
  1319. }
  1320. var childNodes = this.childNodes, childNode;
  1321. _attrObj[key] = value;
  1322. for (var i = 0; childNode = childNodes[i++];) {
  1323. if (typeof childNode.a === 'function') {
  1324. childNode.a(key, value);
  1325. }
  1326. }
  1327. },
  1328. a: function () {
  1329. return this.attr.apply(this, arguments);
  1330. }
  1331. });
  1332. }