圆弧.js 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053
  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 = 23*_ratio.ratioX;
  11. this._originHeight = 54*_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(3.153045, ratio);
  36. var Lib_圆弧Node0type = 'arc';
  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(21.84319*_ratio.ratioX, 20.52591*_ratio.ratioY, Lib_圆弧Node0type, '1.533314', '6.198891', 'false'));
  43. Lib_圆弧Node0.setPosition(11*ratio.ratioX, 29*ratio.ratioY);
  44. Lib_圆弧Node0.setSize(21.84319*_ratio.ratioX, 20.52591*_ratio.ratioY);
  45. Lib_圆弧Node0.s({
  46. 'pixelPerfect':true
  47. /*@AddPara@*/
  48. });
  49. Lib_圆弧Node0.a('node.width', 21.84319*_ratio.ratioX);
  50. Lib_圆弧Node0.a('node.height', 20.52591*_ratio.ratioY);
  51. Lib_圆弧Node0.a('node.type', Lib_圆弧Node0type);
  52. Lib_圆弧Node0.a('node.rect', [0, 0, 21.84319*_ratio.ratioX, 20.52591*_ratio.ratioY]);
  53. Lib_圆弧Node0.a('node.background', 'rgba(255,255,255,0)');
  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('1.533314'));
  64. Lib_圆弧Node0.a('node.arcTo', parseFloat('6.198891'));
  65. Lib_圆弧Node0.a('node.arcClose', 'false' === 'true' ? true : false);
  66. }
  67. if (Lib_圆弧Node0type === 'arc') {
  68. Lib_圆弧Node0.a('node.arcOval', true);
  69. }
  70. Lib_圆弧Node0.setRotation(3.153045);
  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=[0, 31,13, 31],
  98. Lib_圆弧Node1rect=ht.Default.unionPoint([{x:0,y:31},{x:13,y:31}]),
  99. Lib_圆弧Node1compspts=[];
  100. _ratio = GD.getRatioWithRotation(0, ratio);
  101. var _startratio = GD.getRatioWithRotation(3.14159265358979, ratio),
  102. _endratio = GD.getRatioWithRotation(0, 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=[13, 31,13, 54],
  206. Lib_圆弧Node2rect=ht.Default.unionPoint([{x:13,y:31},{x:13,y:54}]),
  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_圆弧Node3points=[13, 0,13, 20],
  314. Lib_圆弧Node3rect=ht.Default.unionPoint([{x:13,y:0},{x:13,y:20}]),
  315. Lib_圆弧Node3compspts=[];
  316. _ratio = GD.getRatioWithRotation(0, ratio);
  317. var _startratio = GD.getRatioWithRotation(4.71238898038469, ratio),
  318. _endratio = GD.getRatioWithRotation(7.85398163397448, ratio);
  319. for(var i=0;i<Lib_圆弧Node3points.length;i++){
  320. if(i%2==0){
  321. Lib_圆弧Node3compspts.push(Lib_圆弧Node3points[i]-Lib_圆弧Node3rect.x);
  322. }else{
  323. Lib_圆弧Node3compspts.push(Lib_圆弧Node3points[i]-Lib_圆弧Node3rect.y);
  324. }
  325. }
  326. var Lib_圆弧Node3ptslength=Lib_圆弧Node3compspts.length;
  327. if (Lib_圆弧Node3rect.height === 0) {
  328. Lib_圆弧Node3compspts[0] -= 0;
  329. Lib_圆弧Node3compspts[Lib_圆弧Node3ptslength-2] += 0;
  330. } else if (Lib_圆弧Node3rect.width === 0){
  331. Lib_圆弧Node3compspts[1] -= 0;
  332. Lib_圆弧Node3compspts[Lib_圆弧Node3ptslength-1] += 0;
  333. } else {
  334. Lib_圆弧Node3compspts[0] -= 0;
  335. Lib_圆弧Node3compspts[1] -= 0;
  336. Lib_圆弧Node3compspts[Lib_圆弧Node3ptslength-2] += 0;
  337. Lib_圆弧Node3compspts[Lib_圆弧Node3ptslength-1] += 0;
  338. }
  339. Lib_圆弧Node3 = new ht.Node();
  340. Lib_圆弧Node3.borderWidth = 2;
  341. Lib_圆弧Node3rect.width = Lib_圆弧Node3rect.width === 0 ? 0.0001 : Lib_圆弧Node3rect.width;
  342. Lib_圆弧Node3rect.height = Lib_圆弧Node3rect.height === 0 ? 0.0001 : Lib_圆弧Node3rect.height;
  343. var Lib_圆弧Node3endCompspts = [Lib_圆弧Node3compspts[Lib_圆弧Node3ptslength-2],Lib_圆弧Node3compspts[Lib_圆弧Node3ptslength-1],0,0];
  344. var Lib_圆弧Node3startCompspts = [Lib_圆弧Node3compspts[0],Lib_圆弧Node3compspts[1],0,0];
  345. Lib_圆弧Node3.setImage(GD.getPolyLineJSON());
  346. Lib_圆弧Node3.setPosition(Lib_圆弧Node3rect.x+Lib_圆弧Node3rect.width/2,Lib_圆弧Node3rect.y+Lib_圆弧Node3rect.height/2);
  347. Lib_圆弧Node3.setSize(Lib_圆弧Node3rect.width,Lib_圆弧Node3rect.height);
  348. Lib_圆弧Node3.setStyle("opacity",1);
  349. Lib_圆弧Node3.s({'pixelPerfect':true});
  350. Lib_圆弧Node3borderwidth=2;
  351. Lib_圆弧Node3.setRotation(0);
  352. dataModel.add(Lib_圆弧Node3);
  353. Lib_圆弧Node3.a('node.points',Lib_圆弧Node3compspts);
  354. Lib_圆弧Node3.a('node.segments',[1,2]);
  355. Lib_圆弧Node3.a('node.color','rgba(255,128,0,1)');
  356. Lib_圆弧Node3.a('node.borderPattern',getDashStyle("@borderPattern@"));
  357. Lib_圆弧Node3.a('node.borderColor','rgba(255,128,0,1)');
  358. Lib_圆弧Node3.a('node.background','rgba(255,128,0,1)');
  359. Lib_圆弧Node3.a('node.gradient','');
  360. Lib_圆弧Node3.a('node.gradientcolor','rgba(255,128,0,1)');
  361. Lib_圆弧Node3.a('node.endCompspts',Lib_圆弧Node3endCompspts);
  362. Lib_圆弧Node3.a('node.startCompspts',Lib_圆弧Node3startCompspts);
  363. (function (node, img, compspts, endCompspts, startCompspts) {
  364. var position = node.getPosition(),
  365. w = node.getWidth()*_ratio.ratioX,
  366. h = node.getHeight()*_ratio.ratioY;
  367. function resetPoints(rx, ry) {
  368. for (var i = 0, len = compspts.length; i < len; i++) {
  369. if (i%2 === 0) {
  370. compspts[i]*=rx;
  371. } else {
  372. compspts[i]*=ry;
  373. }
  374. }
  375. endCompspts[0] = compspts[compspts.length-2];
  376. endCompspts[1] = compspts[compspts.length-1];
  377. endCompspts[2] *= rx;
  378. endCompspts[3] *= ry;
  379. node.a('node.offsetEndY', -(endCompspts[3]*0.5));
  380. node.a('node.offsetEndX', -(endCompspts[2]*0.5));
  381. startCompspts[0] = compspts[0];
  382. startCompspts[1] = compspts[1];
  383. startCompspts[2] *= rx;
  384. startCompspts[3] *= ry;
  385. node.a('node.offsetStartY', -(startCompspts[3]*0.5));
  386. node.a('node.offsetStartX', -(startCompspts[2]*0.5));
  387. node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
  388. node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
  389. }
  390. node.setSize(w, h);
  391. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  392. node.a('node.width', w);
  393. node.a('node.height', h);
  394. resetPoints(_ratio.ratioX, _ratio.ratioY);
  395. node.borderWidth = 2;
  396. node.a('node.borderwidth',node.borderWidth);
  397. node._nodename = 'Lib_圆弧Node3';
  398. node._nodeType = 'line';
  399. zoomNodeList.push({
  400. node: node,
  401. attr: 'node.borderwidth'
  402. });
  403. var setWidth = node.setWidth,
  404. setHeight = node.setHeight,
  405. timer, rx = 1, ry = 1;
  406. node.setWidth = function (width) {
  407. var _width = this.getWidth();
  408. rx = width / _width;
  409. node.a('node.width', width);
  410. setWidth.apply(this, arguments);
  411. resetPoints(rx, 1);
  412. }
  413. node.setHeight = function (height) {
  414. var _height = this.getHeight();
  415. ry = height / _height;
  416. node.a('node.height', height);
  417. setHeight.apply(this, arguments);
  418. resetPoints(1, ry);
  419. }
  420. })(Lib_圆弧Node3, Lib_圆弧Node3.getImage(), Lib_圆弧Node3compspts, Lib_圆弧Node3endCompspts, Lib_圆弧Node3startCompspts);
  421. /*@GraphList@*/
  422. /*@PageInit@*/
  423. var localVarObj = this.localVarObj;
  424. var localDynamicVarObj = this.localDynamicVar();
  425. this['Lib_圆弧Node0'] = Lib_圆弧Node0;
  426. Lib_圆弧Node0.__parentLib = nodename;
  427. Lib_圆弧Node0.__parent = this;
  428. this.childNodes.push(Lib_圆弧Node0);
  429. this['Lib_圆弧Node1'] = Lib_圆弧Node1;
  430. Lib_圆弧Node1.__parentLib = nodename;
  431. Lib_圆弧Node1.__parent = this;
  432. this.childNodes.push(Lib_圆弧Node1);
  433. this['Lib_圆弧Node2'] = Lib_圆弧Node2;
  434. Lib_圆弧Node2.__parentLib = nodename;
  435. Lib_圆弧Node2.__parent = this;
  436. this.childNodes.push(Lib_圆弧Node2);
  437. this['Lib_圆弧Node3'] = Lib_圆弧Node3;
  438. Lib_圆弧Node3.__parentLib = nodename;
  439. Lib_圆弧Node3.__parent = this;
  440. this.childNodes.push(Lib_圆弧Node3);
  441. /*@ControlContextMenu@*/
  442. /*@Declare@*/
  443. this.init(x, y, width, height, angle);
  444. };
  445. ht.Default.def('ht.lib.圆弧', Object, {
  446. refresh10ms: function () {
  447. var localVarObj = this.localVarObj;
  448. var localDynamicVarObj = this.localDynamicVar();
  449. var Lib_圆弧Node0= this.Lib_圆弧Node0;
  450. var Lib_圆弧Node1= this.Lib_圆弧Node1;
  451. var Lib_圆弧Node2= this.Lib_圆弧Node2;
  452. var Lib_圆弧Node3= this.Lib_圆弧Node3;
  453. /*@refresh10ms@*/
  454. },
  455. refresh100ms: function () {
  456. var localVarObj = this.localVarObj;
  457. var localDynamicVarObj = this.localDynamicVar();
  458. var Lib_圆弧Node0= this.Lib_圆弧Node0;
  459. var Lib_圆弧Node1= this.Lib_圆弧Node1;
  460. var Lib_圆弧Node2= this.Lib_圆弧Node2;
  461. var Lib_圆弧Node3= this.Lib_圆弧Node3;
  462. /*@refresh100ms@*/
  463. },
  464. refresh500ms: function () {
  465. var localVarObj = this.localVarObj;
  466. var localDynamicVarObj = this.localDynamicVar();
  467. var Lib_圆弧Node0= this.Lib_圆弧Node0;
  468. var Lib_圆弧Node1= this.Lib_圆弧Node1;
  469. var Lib_圆弧Node2= this.Lib_圆弧Node2;
  470. var Lib_圆弧Node3= this.Lib_圆弧Node3;
  471. /*@refresh500ms@*/
  472. },
  473. refresh1s: function () {
  474. var Counter1s = arguments[0] || 0;
  475. var localVarObj = this.localVarObj;
  476. var localDynamicVarObj = this.localDynamicVar();
  477. var Lib_圆弧Node0= this.Lib_圆弧Node0;
  478. var Lib_圆弧Node1= this.Lib_圆弧Node1;
  479. var Lib_圆弧Node2= this.Lib_圆弧Node2;
  480. var Lib_圆弧Node3= this.Lib_圆弧Node3;
  481. /*@refresh1s@*/
  482. },
  483. refresh5s: function () {
  484. var localVarObj = this.localVarObj;
  485. var localDynamicVarObj = this.localDynamicVar();
  486. var Lib_圆弧Node0= this.Lib_圆弧Node0;
  487. var Lib_圆弧Node1= this.Lib_圆弧Node1;
  488. var Lib_圆弧Node2= this.Lib_圆弧Node2;
  489. var Lib_圆弧Node3= this.Lib_圆弧Node3;
  490. /*@refresh5s@*/
  491. },
  492. /*@PageDynamic@*/
  493. onEvent: function (e, data, type, origin, offset, objMouseOn, ctm) {
  494. var localVarObj = this.localVarObj;
  495. var localDynamicVarObj = this.localDynamicVar();
  496. var Lib_圆弧Node0= this.Lib_圆弧Node0;
  497. var Lib_圆弧Node1= this.Lib_圆弧Node1;
  498. var Lib_圆弧Node2= this.Lib_圆弧Node2;
  499. var Lib_圆弧Node3= this.Lib_圆弧Node3;
  500. if (type === 'click') {
  501. /*@EvnentClicked@*/
  502. } else if (type === 'mousedown') {
  503. mouseX=e.clientX;
  504. mouseY=e.clientY;
  505. /*@EvnentMouseDown@*/
  506. } else if (type === 'mouseup') {
  507. /*@EvnentMouseUp@*/
  508. } else if (type === 'mousemove') {
  509. var mouseX, mouseY, position, zoom;
  510. position=origin.getLogicalPoint(e);
  511. zoom = graphView.getZoom();
  512. if (origin === graphView) {
  513. mouseX= position.x + origin.tx();
  514. mouseY = position.y + origin.ty();
  515. } else {
  516. offset = offset || {x: 0, y: 0};
  517. mouseX = position.x / zoom + offset.x + origin.tx();
  518. mouseY = position.y / zoom + offset.y + origin.ty();
  519. }
  520. /*@EvnentMouseLeave@*/
  521. /*@EvnentMouseOver@*/
  522. } else if (type === 'keydown') {
  523. /*@EvnentKeyDown@*/
  524. } else if (type === 'contextmenu') {
  525. /*@Declare@*/
  526. /*@SetNodeContextMenu@*/
  527. /*@SetPageContextMenu@*/
  528. }
  529. /*@LibEvent@*/
  530. },
  531. getBaseClass: function () {
  532. return this._baseClass;
  533. },
  534. getWidth: function () {
  535. return this._width;
  536. },
  537. getHeight: function () {
  538. return this._height;
  539. },
  540. getSize: function () {
  541. return {
  542. width: this._width,
  543. height: this._height
  544. }
  545. },
  546. setWidth: function (width) {
  547. if (width === undefined || width === null || width != width) {
  548. return ;
  549. }
  550. var originWidth = this._width;
  551. var ratio = width / originWidth;
  552. var childNodes = this.childNodes, childNode, p, op = this.getPosition(), w, cw, ox, rotation = this.getRotation();
  553. for (var i = 0, len = childNodes.length; i < len; i++) {
  554. childNode = childNodes[i];
  555. p = childNode.getPosition();
  556. cw = childNode.getWidth();
  557. w = cw >=2 ? cw * ratio : cw;
  558. childNode.setWidth(w);
  559. ox = op.x + (p.x - op.x) * ratio;
  560. childNode.setPosition(ox, p.y);
  561. rotation = GD.calcRotation(rotation);
  562. if (rotation === 0 || rotation === Math.PI) {
  563. // 图元未旋转
  564. ox = op.x + (p.x - op.x)*ratio;
  565. childNode.setPosition(ox, p.y);
  566. } else if (rotation === 90 * Math.PI / 180) {
  567. // 图元旋转以后
  568. ox = op.y + (p.y - op.y)*ratio;
  569. childNode.setPosition(p.x, ox);
  570. }
  571. }
  572. this._width = width;
  573. this._originWidth = width;
  574. this._ratioX = ratio;
  575. return this;
  576. },
  577. setHeight: function (height) {
  578. if (height === undefined || height === null || height != height) {
  579. return ;
  580. }
  581. var originHeight = this._height;
  582. var ratio = height / originHeight;
  583. var childNodes = this.childNodes, childNode, p, op = this.getPosition(), h, ch, oy, rotation = this.getRotation();
  584. for (var i = 0, len = childNodes.length; i < len; i++) {
  585. childNode = childNodes[i];
  586. p = childNode.getPosition();
  587. ch = childNode.getHeight();
  588. h = ch >=2 ? ch * ratio : ch;
  589. childNode.setHeight(h);
  590. rotation = GD.calcRotation(rotation);
  591. if (rotation === 0 || rotation === Math.PI) {
  592. // 图元未旋转
  593. oy = op.y + (p.y - op.y)*ratio;
  594. childNode.setPosition(p.x, oy);
  595. } else if (rotation === 90 * Math.PI / 180) {
  596. // 图元旋转以后
  597. oy = op.x + (p.x - op.x)*ratio;
  598. childNode.setPosition(oy, p.y);
  599. }
  600. }
  601. this._height = height;
  602. this._originHeight = height;
  603. this._ratioY = ratio;
  604. return this;
  605. },
  606. setSize: function (size) {
  607. // var args = Array.prototype.slice.call(arguments, 0);
  608. // var height, width;
  609. // if (args.length === 0) {
  610. // return ;
  611. // }else if (args.length === 1) {
  612. // height = args[0].height;
  613. // width = args[0].width;
  614. // } else {
  615. // width = args[0];
  616. // height = args[1];
  617. // }
  618. // var wh = GD.getRatioWithRotation(angle, wid)
  619. // this.setHeight(height);
  620. // this.setWidth(width);
  621. // return this;
  622. var args = Array.prototype.slice.call(arguments, 0);
  623. var height, width;
  624. if (args.length === 0) {
  625. return ;
  626. }else if (args.length === 1) {
  627. height = args[0].height;
  628. width = args[0].width;
  629. angle = 0;
  630. } else if (args.length === 2) {
  631. if (typeof args[0] === 'object') {
  632. width = args[0].width;
  633. height = args[0].height;
  634. angle = args[1] || 0;
  635. } else {
  636. width = args[0];
  637. height = args[1];
  638. angle = 0;
  639. }
  640. } else if (args.length === 3) {
  641. width = args[0];
  642. height = args[1];
  643. angle = args[2] || 0;
  644. }
  645. var wh = GD.getRatioWithRotation(0, width, height);
  646. this.setHeight(wh.ratioY);
  647. this.setWidth(wh.ratioX);
  648. return this;
  649. },
  650. getPosition: function () {
  651. return {
  652. x: this._x,
  653. y: this._y
  654. }
  655. },
  656. setPosition: function () {
  657. var args = Array.prototype.slice.call(arguments, 0), x, y;
  658. if (args.length === 0) {
  659. return this;
  660. } else if (args.length === 1) {
  661. if (typeof args[0] != 'object') {
  662. return this;
  663. }
  664. x = args[0].x;
  665. y = args[0].y;
  666. } else {
  667. x = args[0];
  668. y = args[1];
  669. }
  670. if ((x !== 0 && !x) || (y !== 0 && !y)) {
  671. return this;
  672. }
  673. // var childNodes = this.childNodes, offset, childNode, p;
  674. // for (var i = 0, len = childNodes.length; i < len; i++) {
  675. // childNode = childNodes[i];
  676. // p = childNode.getPosition();
  677. // childNode.setPosition(x - (this._x-p.x)*this._ratioX, y - (this._y-p.y)*this._ratioY);
  678. // }
  679. // this._x = x;
  680. // this._y = y;
  681. // return this;
  682. var childNodes, childNode, background, offset = {}, op, cp;
  683. childNodes = this.childNodes;
  684. background = this._background;
  685. op = background.getPosition();
  686. offset.x = x - op.x;
  687. offset.y = y - op.y;
  688. for (var i = 0, len = childNodes.length; i < len; i++) {
  689. childNode = childNodes[i];
  690. cp = childNode.getPosition();
  691. childNode.setPosition(cp.x + offset.x, cp.y + offset.y);
  692. }
  693. this._x = x;
  694. this._y = y;
  695. this._position = {x: x, y: y};
  696. return this;
  697. },
  698. getStyle: function (key) {
  699. if (!key) {
  700. return undefined;
  701. }
  702. return this._styleObject[key];
  703. },
  704. setStyle: function (key, value, force) {
  705. var childNodes = this.childNodes, childNode;
  706. for (var i = 0, len = childNodes.length; i < len; i++) {
  707. childNode = childNodes[i];
  708. if (key === '2d.visible') {
  709. if (value === graphView.isVisible(childNode)) {
  710. continue;
  711. }
  712. if (!value) {
  713. childNode._savedIsVisible = graphView.isVisible(childNode);
  714. childNode.s({
  715. '2d.visible': false
  716. })
  717. } else {
  718. childNode.s({
  719. '2d.visible': childNode._savedIsVisible
  720. })
  721. }
  722. continue;
  723. }
  724. childNode.s({
  725. key: value
  726. });
  727. }
  728. this._styleObject[key] = value;
  729. return this;
  730. },
  731. calcSize: function () {
  732. var background = this._background;
  733. var position = background.getPosition(),
  734. width = background.getWidth(),
  735. height = background.getHeight();
  736. this._width = width;
  737. this._height = height;
  738. this._x = position.x;
  739. this._y = position.y;
  740. this._position = {
  741. x: this._x,
  742. y: this._y
  743. }
  744. return this;
  745. return this;
  746. },
  747. s: function (styleObj, force) {
  748. var args = Array.prototype.slice.call(arguments, 0);
  749. var styleObj;
  750. if (args.length === 0) {
  751. return this;
  752. } else if (args.length === 1) {
  753. styleObj = args[0];
  754. } else {
  755. this.setStyle(args[0], args[1]);
  756. return this;
  757. }
  758. for (var key in styleObj) {
  759. if (!styleObj.hasOwnProperty(key)) {
  760. continue;
  761. }
  762. this.setStyle(key, styleObj[key], force);
  763. }
  764. return this;
  765. },
  766. init: function (x, y, width, height, angle) {
  767. var that = this;
  768. this.calcSize();
  769. (function (width, height, angle) {
  770. // that.setSize(width, height, angle);
  771. // var wh = GD.getRatioWithRotation(angle, width, height);
  772. // width = wh.ratioX;
  773. // height = wh.ratioY;
  774. var originHeight = that._height;
  775. var originWidth = that._width;
  776. var ratioY = height / originHeight;
  777. var ratioX = width / originWidth;
  778. var childNodes = that.childNodes,
  779. childNode,p, op = that.getPosition(), h, ch, oy, w, cw, ox, name, borderRatio, borderWidth;
  780. for (var i = 0, len = childNodes.length; i < len; i++) {
  781. childNode = childNodes[i];
  782. p = childNode.getPosition();
  783. childNode.originHeight = childNode.originHeight || childNode.getHeight();
  784. ch = childNode.getHeight();
  785. cw = childNode.getWidth();
  786. if (ch > 2) {
  787. h = ch * ratioY;
  788. childNode.setHeight(h);
  789. }
  790. if (cw > 2) {
  791. w = cw * ratioX;
  792. childNode.setWidth(w);
  793. }
  794. borderRatio = (ratioX + ratioY)*0.5;
  795. if (childNode._nodeType === 'line') { // 如果是线,
  796. if (childNode.getWidth() > childNode.getHeight()) {
  797. borderRatio = ratioX;
  798. } else {
  799. borderRatio = ratioY;
  800. }
  801. }
  802. name = childNode._nodename;
  803. // if (childNode.borderWidth && name && ch > 2 && cw > 2) {
  804. // borderWidth = childNode.borderWidth / borderRatio;
  805. // if (borderWidth > ch*0.5 || borderWidth > cw *0.5) {
  806. // // borderWidth = childNode.borderWidth;
  807. // }
  808. // childNode.borderWidth = borderWidth;
  809. // childNode.a(name + '.borderwidth', borderWidth);
  810. // }
  811. }
  812. that._height = height;
  813. that._originHeight = height;
  814. that._ratioY = ratioY;
  815. that._width = width;
  816. that._originWidth = width;
  817. that._ratioX = ratioX;
  818. })(width, height, angle);
  819. that._x = width / 2;
  820. that._y = height / 2;
  821. that._rotation = 0;
  822. // that.setPosition(x, y);
  823. (function (x, y) {
  824. var childNodes = that.childNodes, offset, childNode;
  825. var w2 = that.getWidth() / 2, h2 = that.getHeight()/2;
  826. for (var i = 0, len = childNodes.length; i < len; i++) {
  827. childNode = childNodes[i];
  828. offset = childNode.getPosition();
  829. childNode.setPosition(x + offset.x * that._ratioX - w2, y + offset.y * that._ratioY - h2);
  830. }
  831. that._x = x;
  832. that._y = y;
  833. })(x, y);
  834. // setTimeout(that.addEVent, 1000);
  835. },
  836. setRotation: function (angle) {
  837. var that = this, _angle = that.getRotation();
  838. if (angle!==0 && !angle || angle === _angle) {
  839. return this;
  840. }
  841. var childNodes = this.childNodes, childNode, p = this.getPosition(), px = p.x, py = p.y;
  842. for (var i = 0, len = childNodes.length; i < len; i++) {
  843. childNode = childNodes[i];
  844. var x = childNode.getPosition().x - px;
  845. var y = childNode.getPosition().y - py;
  846. childNode.setPosition(Math.cos(angle-_angle) * x - Math.sin(angle-_angle) * y + px, Math.cos(angle-_angle) * y + Math.sin(angle-_angle) * x + py);
  847. childNode.setRotation(angle);
  848. }
  849. this._rotation = angle;
  850. return this;
  851. },
  852. getRotation: function () {
  853. return this._rotation;
  854. },
  855. setScale: function (sx, sy) {
  856. var that = this,
  857. childNodes = this.childNodes,
  858. childNode;
  859. if (sx === undefined || sx === null) return ;
  860. if (sy === undefined || sy === null) {
  861. sy = sx;
  862. }
  863. for (var i = 0, len = childNodes.length; i < len; i++) {
  864. childNode = childNodes[i];
  865. if (typeof childNode.setScale === 'function') {
  866. childNode.setScale(sx, sy);
  867. }
  868. }
  869. },
  870. getScale: function () {
  871. return this._background.getScale();
  872. },
  873. setScaleX: function (sx) {
  874. if (sx === undefined || sx === null) return;
  875. var that = this,
  876. childNodes = this.childNodes,
  877. childNode;
  878. for (var i = 0, len = childNodes.length; i < len; i++) {
  879. childNode = childNodes[i];
  880. if (typeof childNode.setScaleX === 'function') {
  881. childNode.setScaleX(sx);
  882. }
  883. }
  884. },
  885. setScaleY: function (sy) {
  886. if (sy === undefined || sy === null) return;
  887. var that = this,
  888. childNodes = this.childNodes,
  889. childNode;
  890. for (var i = 0, len = childNodes.length; i < len; i++) {
  891. childNode = childNodes[i];
  892. if (typeof childNode.setScaleY === 'function') {
  893. childNode.setScaleY(sy);
  894. }
  895. }
  896. },
  897. getScaleX: function () {
  898. return this._background.getScaleX();
  899. },
  900. getScaleY: function () {
  901. return this._background.getScaleY();
  902. },
  903. evert: function () {
  904. var that = this,
  905. childNodes = this.childNodes,
  906. background = this._background,
  907. bp = background.getPosition(),
  908. bx = bp.x,
  909. by = bp.y,
  910. childNode, distanceX, distanceY, x, y, p, nx, ny;
  911. for (var i = 0, len = childNodes.length; i < len; i++) {
  912. childNode = childNodes[i];
  913. p = childNode.getPosition();
  914. x = p.x;
  915. y = p.y;
  916. distanceX = bx - x;
  917. distanceY = by - y;
  918. nx = bx + distanceX;
  919. ny = by + distanceY;
  920. childNode.setPosition(nx, ny);
  921. if (typeof childNode.setScale === 'function') {
  922. if (!(childNode._disallowEvert === true))
  923. childNode.setScale(-1, -1);
  924. }
  925. }
  926. },
  927. evertX: function () {
  928. var that = this,
  929. childNodes = this.childNodes,
  930. background = this._background,
  931. bx = background.getPosition().x,
  932. childNode, distance, x, p, nx;
  933. for (var i = 0, len = childNodes.length; i < len; i++) {
  934. childNode = childNodes[i];
  935. p = childNode.getPosition();
  936. x = p.x;
  937. distance = bx - x;
  938. nx = bx + distance;
  939. childNode.setPosition(nx, p.y);
  940. if (typeof childNode.setScaleX === 'function') {
  941. if (!(childNode._disallowEvert === true))
  942. childNode.setScaleX(-1);
  943. }
  944. }
  945. },
  946. evertY: function () {
  947. var that = this,
  948. childNodes = this.childNodes,
  949. background = this._background,
  950. by = background.getPosition().y,
  951. childNode, distance, y, p, ny;
  952. for (var i = 0, len = childNodes.length; i < len; i++) {
  953. childNode = childNodes[i];
  954. p = childNode.getPosition();
  955. y = p.y;
  956. distance = by - y;
  957. ny = by + distance;
  958. childNode.setPosition(p.x, ny);
  959. if (typeof childNode.setScaleY === 'function') {
  960. if (!(childNode._disallowEvert === true))
  961. childNode.setScaleY(-1);
  962. }
  963. }
  964. },
  965. attr: function (key, value) {
  966. var _attrObj = this._attrObj || {};
  967. if (arguments.length === 1) {
  968. return _attrObj[key];
  969. }
  970. var childNodes = this.childNodes, childNode;
  971. _attrObj[key] = value;
  972. for (var i = 0; childNode = childNodes[i++];) {
  973. if (typeof childNode.a === 'function') {
  974. childNode.a(key, value);
  975. }
  976. }
  977. },
  978. a: function () {
  979. return this.attr.apply(this, arguments);
  980. }
  981. });
  982. }