矩形箭头上.js 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421
  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,128,0,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,128,0,1)');
  140. Lib_矩形箭头上Node1.a('node.borderPattern',getDashStyle("@borderPattern@"));
  141. Lib_矩形箭头上Node1.a('node.borderColor','rgba(255,128,0,1)');
  142. Lib_矩形箭头上Node1.a('node.background','rgba(255,128,0,1)');
  143. Lib_矩形箭头上Node1.a('node.gradient','');
  144. Lib_矩形箭头上Node1.a('node.gradientcolor','rgba(255,128,0,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,128,0,1)');
  248. Lib_矩形箭头上Node2.a('node.borderPattern',getDashStyle("@borderPattern@"));
  249. Lib_矩形箭头上Node2.a('node.borderColor','rgba(255,128,0,1)');
  250. Lib_矩形箭头上Node2.a('node.background','rgba(255,128,0,1)');
  251. Lib_矩形箭头上Node2.a('node.gradient','');
  252. Lib_矩形箭头上Node2.a('node.gradientcolor','rgba(255,128,0,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=0;
  332. Lib_矩形箭头上Node3.borderFillwidth=0*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', 0);
  355. Lib_矩形箭头上Node3.a('node.color', 'rgba(255,128,0,0)');
  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 = 1;
  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=1;
  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,128,0,1)');
  460. Lib_矩形箭头上Node4.a('node.borderPattern',getDashStyle("@borderPattern@"));
  461. Lib_矩形箭头上Node4.a('node.borderColor','rgba(255,128,0,1)');
  462. Lib_矩形箭头上Node4.a('node.background','rgba(255,128,0,1)');
  463. Lib_矩形箭头上Node4.a('node.gradient','');
  464. Lib_矩形箭头上Node4.a('node.gradientcolor','rgba(255,128,0,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 = 1;
  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 = 1;
  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=1;
  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,128,0,1)');
  568. Lib_矩形箭头上Node5.a('node.borderPattern',getDashStyle("@borderPattern@"));
  569. Lib_矩形箭头上Node5.a('node.borderColor','rgba(255,128,0,1)');
  570. Lib_矩形箭头上Node5.a('node.background','rgba(255,128,0,1)');
  571. Lib_矩形箭头上Node5.a('node.gradient','');
  572. Lib_矩形箭头上Node5.a('node.gradientcolor','rgba(255,128,0,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 = 1;
  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 = 1;
  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=1;
  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,128,0,1)');
  676. Lib_矩形箭头上Node6.a('node.borderPattern',getDashStyle("@borderPattern@"));
  677. Lib_矩形箭头上Node6.a('node.borderColor','rgba(255,128,0,1)');
  678. Lib_矩形箭头上Node6.a('node.background','rgba(255,128,0,1)');
  679. Lib_矩形箭头上Node6.a('node.gradient','');
  680. Lib_矩形箭头上Node6.a('node.gradientcolor','rgba(255,128,0,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 = 1;
  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. if(typeof(Lib_矩形箭头上Node3.borderWidth)!="undefined"){setDashStyle(Lib_矩形箭头上Node3,"Lib_矩形箭头上Node3",'NoDash',Lib_矩形箭头上Node3.borderWidth);}
  743. /*@PageInit@*/
  744. var localVarObj = this.localVarObj;
  745. var localDynamicVarObj = this.localDynamicVar();
  746. this['Lib_矩形箭头上Node0'] = Lib_矩形箭头上Node0;
  747. Lib_矩形箭头上Node0.__parentLib = nodename;
  748. Lib_矩形箭头上Node0.__parent = this;
  749. this.childNodes.push(Lib_矩形箭头上Node0);
  750. this['Lib_矩形箭头上Node1'] = Lib_矩形箭头上Node1;
  751. Lib_矩形箭头上Node1.__parentLib = nodename;
  752. Lib_矩形箭头上Node1.__parent = this;
  753. this.childNodes.push(Lib_矩形箭头上Node1);
  754. this['Lib_矩形箭头上Node2'] = Lib_矩形箭头上Node2;
  755. Lib_矩形箭头上Node2.__parentLib = nodename;
  756. Lib_矩形箭头上Node2.__parent = this;
  757. this.childNodes.push(Lib_矩形箭头上Node2);
  758. this['Lib_矩形箭头上Node3'] = Lib_矩形箭头上Node3;
  759. Lib_矩形箭头上Node3.__parentLib = nodename;
  760. Lib_矩形箭头上Node3.__parent = this;
  761. this.childNodes.push(Lib_矩形箭头上Node3);
  762. this['Lib_矩形箭头上Node4'] = Lib_矩形箭头上Node4;
  763. Lib_矩形箭头上Node4.__parentLib = nodename;
  764. Lib_矩形箭头上Node4.__parent = this;
  765. this.childNodes.push(Lib_矩形箭头上Node4);
  766. this['Lib_矩形箭头上Node5'] = Lib_矩形箭头上Node5;
  767. Lib_矩形箭头上Node5.__parentLib = nodename;
  768. Lib_矩形箭头上Node5.__parent = this;
  769. this.childNodes.push(Lib_矩形箭头上Node5);
  770. this['Lib_矩形箭头上Node6'] = Lib_矩形箭头上Node6;
  771. Lib_矩形箭头上Node6.__parentLib = nodename;
  772. Lib_矩形箭头上Node6.__parent = this;
  773. this.childNodes.push(Lib_矩形箭头上Node6);
  774. /*@ControlContextMenu@*/
  775. /*@Declare@*/
  776. this.init(x, y, width, height, angle);
  777. };
  778. ht.Default.def('ht.lib.矩形箭头上', Object, {
  779. refresh10ms: function () {
  780. var localVarObj = this.localVarObj;
  781. var localDynamicVarObj = this.localDynamicVar();
  782. var Lib_矩形箭头上Node0= this.Lib_矩形箭头上Node0;
  783. var Lib_矩形箭头上Node1= this.Lib_矩形箭头上Node1;
  784. var Lib_矩形箭头上Node2= this.Lib_矩形箭头上Node2;
  785. var Lib_矩形箭头上Node3= this.Lib_矩形箭头上Node3;
  786. var Lib_矩形箭头上Node4= this.Lib_矩形箭头上Node4;
  787. var Lib_矩形箭头上Node5= this.Lib_矩形箭头上Node5;
  788. var Lib_矩形箭头上Node6= this.Lib_矩形箭头上Node6;
  789. /*@refresh10ms@*/
  790. },
  791. refresh100ms: function () {
  792. var localVarObj = this.localVarObj;
  793. var localDynamicVarObj = this.localDynamicVar();
  794. var Lib_矩形箭头上Node0= this.Lib_矩形箭头上Node0;
  795. var Lib_矩形箭头上Node1= this.Lib_矩形箭头上Node1;
  796. var Lib_矩形箭头上Node2= this.Lib_矩形箭头上Node2;
  797. var Lib_矩形箭头上Node3= this.Lib_矩形箭头上Node3;
  798. var Lib_矩形箭头上Node4= this.Lib_矩形箭头上Node4;
  799. var Lib_矩形箭头上Node5= this.Lib_矩形箭头上Node5;
  800. var Lib_矩形箭头上Node6= this.Lib_矩形箭头上Node6;
  801. /*@refresh100ms@*/
  802. },
  803. refresh500ms: function () {
  804. var localVarObj = this.localVarObj;
  805. var localDynamicVarObj = this.localDynamicVar();
  806. var Lib_矩形箭头上Node0= this.Lib_矩形箭头上Node0;
  807. var Lib_矩形箭头上Node1= this.Lib_矩形箭头上Node1;
  808. var Lib_矩形箭头上Node2= this.Lib_矩形箭头上Node2;
  809. var Lib_矩形箭头上Node3= this.Lib_矩形箭头上Node3;
  810. var Lib_矩形箭头上Node4= this.Lib_矩形箭头上Node4;
  811. var Lib_矩形箭头上Node5= this.Lib_矩形箭头上Node5;
  812. var Lib_矩形箭头上Node6= this.Lib_矩形箭头上Node6;
  813. /*@refresh500ms@*/
  814. },
  815. refresh1s: function () {
  816. var Counter1s = arguments[0] || 0;
  817. var localVarObj = this.localVarObj;
  818. var localDynamicVarObj = this.localDynamicVar();
  819. var Lib_矩形箭头上Node0= this.Lib_矩形箭头上Node0;
  820. var Lib_矩形箭头上Node1= this.Lib_矩形箭头上Node1;
  821. var Lib_矩形箭头上Node2= this.Lib_矩形箭头上Node2;
  822. var Lib_矩形箭头上Node3= this.Lib_矩形箭头上Node3;
  823. var Lib_矩形箭头上Node4= this.Lib_矩形箭头上Node4;
  824. var Lib_矩形箭头上Node5= this.Lib_矩形箭头上Node5;
  825. var Lib_矩形箭头上Node6= this.Lib_矩形箭头上Node6;
  826. /*@refresh1s@*/
  827. },
  828. refresh5s: function () {
  829. var localVarObj = this.localVarObj;
  830. var localDynamicVarObj = this.localDynamicVar();
  831. var Lib_矩形箭头上Node0= this.Lib_矩形箭头上Node0;
  832. var Lib_矩形箭头上Node1= this.Lib_矩形箭头上Node1;
  833. var Lib_矩形箭头上Node2= this.Lib_矩形箭头上Node2;
  834. var Lib_矩形箭头上Node3= this.Lib_矩形箭头上Node3;
  835. var Lib_矩形箭头上Node4= this.Lib_矩形箭头上Node4;
  836. var Lib_矩形箭头上Node5= this.Lib_矩形箭头上Node5;
  837. var Lib_矩形箭头上Node6= this.Lib_矩形箭头上Node6;
  838. /*@refresh5s@*/
  839. },
  840. /*@PageDynamic@*/
  841. onEvent: function (e, data, type, origin, offset, objMouseOn, ctm) {
  842. var localVarObj = this.localVarObj;
  843. var localDynamicVarObj = this.localDynamicVar();
  844. var Lib_矩形箭头上Node0= this.Lib_矩形箭头上Node0;
  845. var Lib_矩形箭头上Node1= this.Lib_矩形箭头上Node1;
  846. var Lib_矩形箭头上Node2= this.Lib_矩形箭头上Node2;
  847. var Lib_矩形箭头上Node3= this.Lib_矩形箭头上Node3;
  848. var Lib_矩形箭头上Node4= this.Lib_矩形箭头上Node4;
  849. var Lib_矩形箭头上Node5= this.Lib_矩形箭头上Node5;
  850. var Lib_矩形箭头上Node6= this.Lib_矩形箭头上Node6;
  851. if (type === 'click') {
  852. /*@EvnentClicked@*/
  853. } else if (type === 'mousedown') {
  854. mouseX=e.clientX;
  855. mouseY=e.clientY;
  856. /*@EvnentMouseDown@*/
  857. } else if (type === 'mouseup') {
  858. /*@EvnentMouseUp@*/
  859. } else if (type === 'mousemove') {
  860. var mouseX, mouseY, position, zoom;
  861. position=origin.getLogicalPoint(e);
  862. zoom = graphView.getZoom();
  863. if (origin === graphView) {
  864. mouseX= position.x + origin.tx();
  865. mouseY = position.y + origin.ty();
  866. } else {
  867. offset = offset || {x: 0, y: 0};
  868. mouseX = position.x / zoom + offset.x + origin.tx();
  869. mouseY = position.y / zoom + offset.y + origin.ty();
  870. }
  871. /*@EvnentMouseLeave@*/
  872. /*@EvnentMouseOver@*/
  873. } else if (type === 'keydown') {
  874. /*@EvnentKeyDown@*/
  875. } else if (type === 'contextmenu') {
  876. /*@Declare@*/
  877. /*@SetNodeContextMenu@*/
  878. /*@SetPageContextMenu@*/
  879. }
  880. /*@LibEvent@*/
  881. },
  882. getBaseClass: function () {
  883. return this._baseClass;
  884. },
  885. getWidth: function () {
  886. return this._width;
  887. },
  888. getHeight: function () {
  889. return this._height;
  890. },
  891. getSize: function () {
  892. return {
  893. width: this._width,
  894. height: this._height
  895. }
  896. },
  897. setWidth: function (width) {
  898. if (width === undefined || width === null || width != width) {
  899. return ;
  900. }
  901. var originWidth = this._width;
  902. var ratio = width / originWidth;
  903. var childNodes = this.childNodes, childNode, p, op = this.getPosition(), w, cw, ox, rotation = this.getRotation();
  904. for (var i = 0, len = childNodes.length; i < len; i++) {
  905. childNode = childNodes[i];
  906. p = childNode.getPosition();
  907. cw = childNode.getWidth();
  908. w = cw >=2 ? cw * ratio : cw;
  909. childNode.setWidth(w);
  910. ox = op.x + (p.x - op.x) * ratio;
  911. childNode.setPosition(ox, p.y);
  912. rotation = GD.calcRotation(rotation);
  913. if (rotation === 0 || rotation === Math.PI) {
  914. // 图元未旋转
  915. ox = op.x + (p.x - op.x)*ratio;
  916. childNode.setPosition(ox, p.y);
  917. } else if (rotation === 90 * Math.PI / 180) {
  918. // 图元旋转以后
  919. ox = op.y + (p.y - op.y)*ratio;
  920. childNode.setPosition(p.x, ox);
  921. }
  922. }
  923. this._width = width;
  924. this._originWidth = width;
  925. this._ratioX = ratio;
  926. return this;
  927. },
  928. setHeight: function (height) {
  929. if (height === undefined || height === null || height != height) {
  930. return ;
  931. }
  932. var originHeight = this._height;
  933. var ratio = height / originHeight;
  934. var childNodes = this.childNodes, childNode, p, op = this.getPosition(), h, ch, oy, rotation = this.getRotation();
  935. for (var i = 0, len = childNodes.length; i < len; i++) {
  936. childNode = childNodes[i];
  937. p = childNode.getPosition();
  938. ch = childNode.getHeight();
  939. h = ch >=2 ? ch * ratio : ch;
  940. childNode.setHeight(h);
  941. rotation = GD.calcRotation(rotation);
  942. if (rotation === 0 || rotation === Math.PI) {
  943. // 图元未旋转
  944. oy = op.y + (p.y - op.y)*ratio;
  945. childNode.setPosition(p.x, oy);
  946. } else if (rotation === 90 * Math.PI / 180) {
  947. // 图元旋转以后
  948. oy = op.x + (p.x - op.x)*ratio;
  949. childNode.setPosition(oy, p.y);
  950. }
  951. }
  952. this._height = height;
  953. this._originHeight = height;
  954. this._ratioY = ratio;
  955. return this;
  956. },
  957. setSize: function (size) {
  958. // var args = Array.prototype.slice.call(arguments, 0);
  959. // var height, width;
  960. // if (args.length === 0) {
  961. // return ;
  962. // }else if (args.length === 1) {
  963. // height = args[0].height;
  964. // width = args[0].width;
  965. // } else {
  966. // width = args[0];
  967. // height = args[1];
  968. // }
  969. // var wh = GD.getRatioWithRotation(angle, wid)
  970. // this.setHeight(height);
  971. // this.setWidth(width);
  972. // return this;
  973. var args = Array.prototype.slice.call(arguments, 0);
  974. var height, width;
  975. if (args.length === 0) {
  976. return ;
  977. }else if (args.length === 1) {
  978. height = args[0].height;
  979. width = args[0].width;
  980. angle = 0;
  981. } else if (args.length === 2) {
  982. if (typeof args[0] === 'object') {
  983. width = args[0].width;
  984. height = args[0].height;
  985. angle = args[1] || 0;
  986. } else {
  987. width = args[0];
  988. height = args[1];
  989. angle = 0;
  990. }
  991. } else if (args.length === 3) {
  992. width = args[0];
  993. height = args[1];
  994. angle = args[2] || 0;
  995. }
  996. var wh = GD.getRatioWithRotation(0, width, height);
  997. this.setHeight(wh.ratioY);
  998. this.setWidth(wh.ratioX);
  999. return this;
  1000. },
  1001. getPosition: function () {
  1002. return {
  1003. x: this._x,
  1004. y: this._y
  1005. }
  1006. },
  1007. setPosition: function () {
  1008. var args = Array.prototype.slice.call(arguments, 0), x, y;
  1009. if (args.length === 0) {
  1010. return this;
  1011. } else if (args.length === 1) {
  1012. if (typeof args[0] != 'object') {
  1013. return this;
  1014. }
  1015. x = args[0].x;
  1016. y = args[0].y;
  1017. } else {
  1018. x = args[0];
  1019. y = args[1];
  1020. }
  1021. if ((x !== 0 && !x) || (y !== 0 && !y)) {
  1022. return this;
  1023. }
  1024. // var childNodes = this.childNodes, offset, childNode, p;
  1025. // for (var i = 0, len = childNodes.length; i < len; i++) {
  1026. // childNode = childNodes[i];
  1027. // p = childNode.getPosition();
  1028. // childNode.setPosition(x - (this._x-p.x)*this._ratioX, y - (this._y-p.y)*this._ratioY);
  1029. // }
  1030. // this._x = x;
  1031. // this._y = y;
  1032. // return this;
  1033. var childNodes, childNode, background, offset = {}, op, cp;
  1034. childNodes = this.childNodes;
  1035. background = this._background;
  1036. op = background.getPosition();
  1037. offset.x = x - op.x;
  1038. offset.y = y - op.y;
  1039. for (var i = 0, len = childNodes.length; i < len; i++) {
  1040. childNode = childNodes[i];
  1041. cp = childNode.getPosition();
  1042. childNode.setPosition(cp.x + offset.x, cp.y + offset.y);
  1043. }
  1044. this._x = x;
  1045. this._y = y;
  1046. this._position = {x: x, y: y};
  1047. return this;
  1048. },
  1049. getStyle: function (key) {
  1050. if (!key) {
  1051. return undefined;
  1052. }
  1053. return this._styleObject[key];
  1054. },
  1055. setStyle: function (key, value, force) {
  1056. var childNodes = this.childNodes, childNode;
  1057. for (var i = 0, len = childNodes.length; i < len; i++) {
  1058. childNode = childNodes[i];
  1059. if (key === '2d.visible') {
  1060. if (value === graphView.isVisible(childNode)) {
  1061. continue;
  1062. }
  1063. if (!value) {
  1064. childNode._savedIsVisible = graphView.isVisible(childNode);
  1065. childNode.s({
  1066. '2d.visible': false
  1067. })
  1068. } else {
  1069. childNode.s({
  1070. '2d.visible': childNode._savedIsVisible
  1071. })
  1072. }
  1073. continue;
  1074. }
  1075. childNode.s({
  1076. key: value
  1077. });
  1078. }
  1079. this._styleObject[key] = value;
  1080. return this;
  1081. },
  1082. calcSize: function () {
  1083. var background = this._background;
  1084. var position = background.getPosition(),
  1085. width = background.getWidth(),
  1086. height = background.getHeight();
  1087. this._width = width;
  1088. this._height = height;
  1089. this._x = position.x;
  1090. this._y = position.y;
  1091. this._position = {
  1092. x: this._x,
  1093. y: this._y
  1094. }
  1095. return this;
  1096. return this;
  1097. },
  1098. s: function (styleObj, force) {
  1099. var args = Array.prototype.slice.call(arguments, 0);
  1100. var styleObj;
  1101. if (args.length === 0) {
  1102. return this;
  1103. } else if (args.length === 1) {
  1104. styleObj = args[0];
  1105. } else {
  1106. this.setStyle(args[0], args[1]);
  1107. return this;
  1108. }
  1109. for (var key in styleObj) {
  1110. if (!styleObj.hasOwnProperty(key)) {
  1111. continue;
  1112. }
  1113. this.setStyle(key, styleObj[key], force);
  1114. }
  1115. return this;
  1116. },
  1117. init: function (x, y, width, height, angle) {
  1118. var that = this;
  1119. this.calcSize();
  1120. (function (width, height, angle) {
  1121. // that.setSize(width, height, angle);
  1122. // var wh = GD.getRatioWithRotation(angle, width, height);
  1123. // width = wh.ratioX;
  1124. // height = wh.ratioY;
  1125. var originHeight = that._height;
  1126. var originWidth = that._width;
  1127. var ratioY = height / originHeight;
  1128. var ratioX = width / originWidth;
  1129. var childNodes = that.childNodes,
  1130. childNode,p, op = that.getPosition(), h, ch, oy, w, cw, ox, name, borderRatio, borderWidth;
  1131. for (var i = 0, len = childNodes.length; i < len; i++) {
  1132. childNode = childNodes[i];
  1133. p = childNode.getPosition();
  1134. childNode.originHeight = childNode.originHeight || childNode.getHeight();
  1135. ch = childNode.getHeight();
  1136. cw = childNode.getWidth();
  1137. if (ch > 2) {
  1138. h = ch * ratioY;
  1139. childNode.setHeight(h);
  1140. }
  1141. if (cw > 2) {
  1142. w = cw * ratioX;
  1143. childNode.setWidth(w);
  1144. }
  1145. borderRatio = (ratioX + ratioY)*0.5;
  1146. if (childNode._nodeType === 'line') { // 如果是线,
  1147. if (childNode.getWidth() > childNode.getHeight()) {
  1148. borderRatio = ratioX;
  1149. } else {
  1150. borderRatio = ratioY;
  1151. }
  1152. }
  1153. name = childNode._nodename;
  1154. // if (childNode.borderWidth && name && ch > 2 && cw > 2) {
  1155. // borderWidth = childNode.borderWidth / borderRatio;
  1156. // if (borderWidth > ch*0.5 || borderWidth > cw *0.5) {
  1157. // // borderWidth = childNode.borderWidth;
  1158. // }
  1159. // childNode.borderWidth = borderWidth;
  1160. // childNode.a(name + '.borderwidth', borderWidth);
  1161. // }
  1162. }
  1163. that._height = height;
  1164. that._originHeight = height;
  1165. that._ratioY = ratioY;
  1166. that._width = width;
  1167. that._originWidth = width;
  1168. that._ratioX = ratioX;
  1169. })(width, height, angle);
  1170. that._x = width / 2;
  1171. that._y = height / 2;
  1172. that._rotation = 0;
  1173. // that.setPosition(x, y);
  1174. (function (x, y) {
  1175. var childNodes = that.childNodes, offset, childNode;
  1176. var w2 = that.getWidth() / 2, h2 = that.getHeight()/2;
  1177. for (var i = 0, len = childNodes.length; i < len; i++) {
  1178. childNode = childNodes[i];
  1179. offset = childNode.getPosition();
  1180. childNode.setPosition(x + offset.x * that._ratioX - w2, y + offset.y * that._ratioY - h2);
  1181. }
  1182. that._x = x;
  1183. that._y = y;
  1184. })(x, y);
  1185. // setTimeout(that.addEVent, 1000);
  1186. },
  1187. setRotation: function (angle) {
  1188. var that = this, _angle = that.getRotation();
  1189. if (angle!==0 && !angle || angle === _angle) {
  1190. return this;
  1191. }
  1192. var childNodes = this.childNodes, childNode, p = this.getPosition(), px = p.x, py = p.y;
  1193. for (var i = 0, len = childNodes.length; i < len; i++) {
  1194. childNode = childNodes[i];
  1195. var x = childNode.getPosition().x - px;
  1196. var y = childNode.getPosition().y - py;
  1197. childNode.setPosition(Math.cos(angle-_angle) * x - Math.sin(angle-_angle) * y + px, Math.cos(angle-_angle) * y + Math.sin(angle-_angle) * x + py);
  1198. childNode.setRotation(angle);
  1199. }
  1200. this._rotation = angle;
  1201. return this;
  1202. },
  1203. getRotation: function () {
  1204. return this._rotation;
  1205. },
  1206. setScale: function (sx, sy) {
  1207. var that = this,
  1208. childNodes = this.childNodes,
  1209. childNode;
  1210. if (sx === undefined || sx === null) return ;
  1211. if (sy === undefined || sy === null) {
  1212. sy = sx;
  1213. }
  1214. for (var i = 0, len = childNodes.length; i < len; i++) {
  1215. childNode = childNodes[i];
  1216. if (typeof childNode.setScale === 'function') {
  1217. childNode.setScale(sx, sy);
  1218. }
  1219. }
  1220. },
  1221. getScale: function () {
  1222. return this._background.getScale();
  1223. },
  1224. setScaleX: function (sx) {
  1225. if (sx === undefined || sx === null) return;
  1226. var that = this,
  1227. childNodes = this.childNodes,
  1228. childNode;
  1229. for (var i = 0, len = childNodes.length; i < len; i++) {
  1230. childNode = childNodes[i];
  1231. if (typeof childNode.setScaleX === 'function') {
  1232. childNode.setScaleX(sx);
  1233. }
  1234. }
  1235. },
  1236. setScaleY: function (sy) {
  1237. if (sy === undefined || sy === null) return;
  1238. var that = this,
  1239. childNodes = this.childNodes,
  1240. childNode;
  1241. for (var i = 0, len = childNodes.length; i < len; i++) {
  1242. childNode = childNodes[i];
  1243. if (typeof childNode.setScaleY === 'function') {
  1244. childNode.setScaleY(sy);
  1245. }
  1246. }
  1247. },
  1248. getScaleX: function () {
  1249. return this._background.getScaleX();
  1250. },
  1251. getScaleY: function () {
  1252. return this._background.getScaleY();
  1253. },
  1254. evert: function () {
  1255. var that = this,
  1256. childNodes = this.childNodes,
  1257. background = this._background,
  1258. bp = background.getPosition(),
  1259. bx = bp.x,
  1260. by = bp.y,
  1261. childNode, distanceX, distanceY, x, y, p, nx, ny;
  1262. for (var i = 0, len = childNodes.length; i < len; i++) {
  1263. childNode = childNodes[i];
  1264. p = childNode.getPosition();
  1265. x = p.x;
  1266. y = p.y;
  1267. distanceX = bx - x;
  1268. distanceY = by - y;
  1269. nx = bx + distanceX;
  1270. ny = by + distanceY;
  1271. childNode.setPosition(nx, ny);
  1272. if (typeof childNode.setScale === 'function') {
  1273. if (!(childNode._disallowEvert === true))
  1274. childNode.setScale(-1, -1);
  1275. }
  1276. }
  1277. },
  1278. evertX: function () {
  1279. var that = this,
  1280. childNodes = this.childNodes,
  1281. background = this._background,
  1282. bx = background.getPosition().x,
  1283. childNode, distance, x, p, nx;
  1284. for (var i = 0, len = childNodes.length; i < len; i++) {
  1285. childNode = childNodes[i];
  1286. p = childNode.getPosition();
  1287. x = p.x;
  1288. distance = bx - x;
  1289. nx = bx + distance;
  1290. childNode.setPosition(nx, p.y);
  1291. if (typeof childNode.setScaleX === 'function') {
  1292. if (!(childNode._disallowEvert === true))
  1293. childNode.setScaleX(-1);
  1294. }
  1295. }
  1296. },
  1297. evertY: function () {
  1298. var that = this,
  1299. childNodes = this.childNodes,
  1300. background = this._background,
  1301. by = background.getPosition().y,
  1302. childNode, distance, y, p, ny;
  1303. for (var i = 0, len = childNodes.length; i < len; i++) {
  1304. childNode = childNodes[i];
  1305. p = childNode.getPosition();
  1306. y = p.y;
  1307. distance = by - y;
  1308. ny = by + distance;
  1309. childNode.setPosition(p.x, ny);
  1310. if (typeof childNode.setScaleY === 'function') {
  1311. if (!(childNode._disallowEvert === true))
  1312. childNode.setScaleY(-1);
  1313. }
  1314. }
  1315. },
  1316. attr: function (key, value) {
  1317. var _attrObj = this._attrObj || {};
  1318. if (arguments.length === 1) {
  1319. return _attrObj[key];
  1320. }
  1321. var childNodes = this.childNodes, childNode;
  1322. _attrObj[key] = value;
  1323. for (var i = 0; childNode = childNodes[i++];) {
  1324. if (typeof childNode.a === 'function') {
  1325. childNode.a(key, value);
  1326. }
  1327. }
  1328. },
  1329. a: function () {
  1330. return this.attr.apply(this, arguments);
  1331. }
  1332. });
  1333. }