fff.js 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092
  1. ht.lib = ht.lib || {};
  2. if (!ht.lib['fff']) {
  3. ht.lib['fff'] = function (x, y, width, height, angle, localVarObj, localDynamicVar, nodename) {
  4. _ratio = GD.getRatioWithRotation(0, ratio);
  5. ht.lib['fff'].superClass.constructor.apply(this);
  6. this.localVarObj = localVarObj;
  7. this.localDynamicVar = localDynamicVar;
  8. this.childNodes = [];
  9. this._styleObject = {};
  10. this._originWidth = 15.05267*_ratio.ratioX;
  11. this._originHeight = 62.66693*_ratio.ratioY;
  12. this._baseClass = "ht.lib.fff";
  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_fffNode0 = new ht.lib['紫箭头'](6*ratio.ratioX, 23*ratio.ratioY, 9*_ratio.ratioX, 10*_ratio.ratioY, 0*Math.PI/180, {}, function (){return {}}, 'Lib_fffNode0');
  37. _libModel.add("Lib_fffNode0", Lib_fffNode0);
  38. Lib_fffNode0.setRotation(0*Math.PI/180);
  39. ;
  40. ;
  41. _ratio = GD.getRatioWithRotation(180*Math.PI/180, ratio);
  42. var Lib_fffNode1 = new ht.lib['紫箭头'](6*ratio.ratioX, 14*ratio.ratioY, 9*_ratio.ratioX, 9*_ratio.ratioY, 180*Math.PI/180, {}, function (){return {}}, 'Lib_fffNode1');
  43. _libModel.add("Lib_fffNode1", Lib_fffNode1);
  44. Lib_fffNode1.setRotation(180*Math.PI/180);
  45. ;
  46. ;
  47. _ratio = GD.getRatioWithRotation(0*Math.PI/180, ratio);
  48. var Lib_fffNode2 = new ht.lib['接地'](7*ratio.ratioX, 55*ratio.ratioY, 15*_ratio.ratioX, 13*_ratio.ratioY, 0*Math.PI/180, {}, function (){return {}}, 'Lib_fffNode2');
  49. _libModel.add("Lib_fffNode2", Lib_fffNode2);
  50. Lib_fffNode2.setRotation(0*Math.PI/180);
  51. ;
  52. ;
  53. var Lib_fffNode3points=[7, 0,7, 10],
  54. Lib_fffNode3rect=ht.Default.unionPoint([{x:7,y:0},{x:7,y:10}]),
  55. Lib_fffNode3compspts=[];
  56. _ratio = GD.getRatioWithRotation(0, ratio);
  57. var _startratio = GD.getRatioWithRotation(4.71238898038469, ratio),
  58. _endratio = GD.getRatioWithRotation(7.85398163397448, ratio);
  59. for(var i=0;i<Lib_fffNode3points.length;i++){
  60. if(i%2==0){
  61. Lib_fffNode3compspts.push(Lib_fffNode3points[i]-Lib_fffNode3rect.x);
  62. }else{
  63. Lib_fffNode3compspts.push(Lib_fffNode3points[i]-Lib_fffNode3rect.y);
  64. }
  65. }
  66. var Lib_fffNode3ptslength=Lib_fffNode3compspts.length;
  67. if (Lib_fffNode3rect.height === 0) {
  68. Lib_fffNode3compspts[0] -= 0;
  69. Lib_fffNode3compspts[Lib_fffNode3ptslength-2] += 0;
  70. } else if (Lib_fffNode3rect.width === 0){
  71. Lib_fffNode3compspts[1] -= 0;
  72. Lib_fffNode3compspts[Lib_fffNode3ptslength-1] += 0;
  73. } else {
  74. Lib_fffNode3compspts[0] -= 0;
  75. Lib_fffNode3compspts[1] -= 0;
  76. Lib_fffNode3compspts[Lib_fffNode3ptslength-2] += 0;
  77. Lib_fffNode3compspts[Lib_fffNode3ptslength-1] += 0;
  78. }
  79. Lib_fffNode3 = new ht.Node();
  80. Lib_fffNode3.borderWidth = 1;
  81. Lib_fffNode3rect.width = Lib_fffNode3rect.width === 0 ? 0.0001 : Lib_fffNode3rect.width;
  82. Lib_fffNode3rect.height = Lib_fffNode3rect.height === 0 ? 0.0001 : Lib_fffNode3rect.height;
  83. var Lib_fffNode3endCompspts = [Lib_fffNode3compspts[Lib_fffNode3ptslength-2],Lib_fffNode3compspts[Lib_fffNode3ptslength-1],0,0];
  84. var Lib_fffNode3startCompspts = [Lib_fffNode3compspts[0],Lib_fffNode3compspts[1],0,0];
  85. Lib_fffNode3.setImage(GD.getPolyLineJSON());
  86. Lib_fffNode3.setPosition(Lib_fffNode3rect.x+Lib_fffNode3rect.width/2,Lib_fffNode3rect.y+Lib_fffNode3rect.height/2);
  87. Lib_fffNode3.setSize(Lib_fffNode3rect.width,Lib_fffNode3rect.height);
  88. Lib_fffNode3.setStyle("opacity",1);
  89. Lib_fffNode3.s({'pixelPerfect':true});
  90. Lib_fffNode3borderwidth=1;
  91. Lib_fffNode3.setRotation(0);
  92. dataModel.add(Lib_fffNode3);
  93. Lib_fffNode3.a('node.points',Lib_fffNode3compspts);
  94. Lib_fffNode3.a('node.segments',[1,2]);
  95. Lib_fffNode3.a('node.color','rgba(255,0,255,1)');
  96. Lib_fffNode3.a('node.borderPattern',getDashStyle("@borderPattern@"));
  97. Lib_fffNode3.a('node.borderColor','rgba(255,0,255,1)');
  98. Lib_fffNode3.a('node.background','rgba(255,0,255,1)');
  99. Lib_fffNode3.a('node.gradient','');
  100. Lib_fffNode3.a('node.gradientcolor','rgba(255,0,255,1)');
  101. Lib_fffNode3.a('node.endCompspts',Lib_fffNode3endCompspts);
  102. Lib_fffNode3.a('node.startCompspts',Lib_fffNode3startCompspts);
  103. (function (node, img, compspts, endCompspts, startCompspts) {
  104. var position = node.getPosition(),
  105. w = node.getWidth()*_ratio.ratioX,
  106. h = node.getHeight()*_ratio.ratioY;
  107. function resetPoints(rx, ry) {
  108. for (var i = 0, len = compspts.length; i < len; i++) {
  109. if (i%2 === 0) {
  110. compspts[i]*=rx;
  111. } else {
  112. compspts[i]*=ry;
  113. }
  114. }
  115. endCompspts[0] = compspts[compspts.length-2];
  116. endCompspts[1] = compspts[compspts.length-1];
  117. endCompspts[2] *= rx;
  118. endCompspts[3] *= ry;
  119. node.a('node.offsetEndY', -(endCompspts[3]*0.5));
  120. node.a('node.offsetEndX', -(endCompspts[2]*0.5));
  121. startCompspts[0] = compspts[0];
  122. startCompspts[1] = compspts[1];
  123. startCompspts[2] *= rx;
  124. startCompspts[3] *= ry;
  125. node.a('node.offsetStartY', -(startCompspts[3]*0.5));
  126. node.a('node.offsetStartX', -(startCompspts[2]*0.5));
  127. node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
  128. node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
  129. }
  130. node.setSize(w, h);
  131. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  132. node.a('node.width', w);
  133. node.a('node.height', h);
  134. resetPoints(_ratio.ratioX, _ratio.ratioY);
  135. node.borderWidth = 1;
  136. node.a('node.borderwidth',node.borderWidth);
  137. node._nodename = 'Lib_fffNode3';
  138. node._nodeType = 'line';
  139. zoomNodeList.push({
  140. node: node,
  141. attr: 'node.borderwidth'
  142. });
  143. var setWidth = node.setWidth,
  144. setHeight = node.setHeight,
  145. timer, rx = 1, ry = 1;
  146. node.setWidth = function (width) {
  147. var _width = this.getWidth();
  148. rx = width / _width;
  149. node.a('node.width', width);
  150. setWidth.apply(this, arguments);
  151. resetPoints(rx, 1);
  152. }
  153. node.setHeight = function (height) {
  154. var _height = this.getHeight();
  155. ry = height / _height;
  156. node.a('node.height', height);
  157. setHeight.apply(this, arguments);
  158. resetPoints(1, ry);
  159. }
  160. })(Lib_fffNode3, Lib_fffNode3.getImage(), Lib_fffNode3compspts, Lib_fffNode3endCompspts, Lib_fffNode3startCompspts);
  161. var Lib_fffNode4points=[7, 28,7, 48],
  162. Lib_fffNode4rect=ht.Default.unionPoint([{x:7,y:28},{x:7,y:48}]),
  163. Lib_fffNode4compspts=[];
  164. _ratio = GD.getRatioWithRotation(0, ratio);
  165. var _startratio = GD.getRatioWithRotation(4.71238898038469, ratio),
  166. _endratio = GD.getRatioWithRotation(7.85398163397448, ratio);
  167. for(var i=0;i<Lib_fffNode4points.length;i++){
  168. if(i%2==0){
  169. Lib_fffNode4compspts.push(Lib_fffNode4points[i]-Lib_fffNode4rect.x);
  170. }else{
  171. Lib_fffNode4compspts.push(Lib_fffNode4points[i]-Lib_fffNode4rect.y);
  172. }
  173. }
  174. var Lib_fffNode4ptslength=Lib_fffNode4compspts.length;
  175. if (Lib_fffNode4rect.height === 0) {
  176. Lib_fffNode4compspts[0] -= 0;
  177. Lib_fffNode4compspts[Lib_fffNode4ptslength-2] += 0;
  178. } else if (Lib_fffNode4rect.width === 0){
  179. Lib_fffNode4compspts[1] -= 0;
  180. Lib_fffNode4compspts[Lib_fffNode4ptslength-1] += 0;
  181. } else {
  182. Lib_fffNode4compspts[0] -= 0;
  183. Lib_fffNode4compspts[1] -= 0;
  184. Lib_fffNode4compspts[Lib_fffNode4ptslength-2] += 0;
  185. Lib_fffNode4compspts[Lib_fffNode4ptslength-1] += 0;
  186. }
  187. Lib_fffNode4 = new ht.Node();
  188. Lib_fffNode4.borderWidth = 1;
  189. Lib_fffNode4rect.width = Lib_fffNode4rect.width === 0 ? 0.0001 : Lib_fffNode4rect.width;
  190. Lib_fffNode4rect.height = Lib_fffNode4rect.height === 0 ? 0.0001 : Lib_fffNode4rect.height;
  191. var Lib_fffNode4endCompspts = [Lib_fffNode4compspts[Lib_fffNode4ptslength-2],Lib_fffNode4compspts[Lib_fffNode4ptslength-1],0,0];
  192. var Lib_fffNode4startCompspts = [Lib_fffNode4compspts[0],Lib_fffNode4compspts[1],0,0];
  193. Lib_fffNode4.setImage(GD.getPolyLineJSON());
  194. Lib_fffNode4.setPosition(Lib_fffNode4rect.x+Lib_fffNode4rect.width/2,Lib_fffNode4rect.y+Lib_fffNode4rect.height/2);
  195. Lib_fffNode4.setSize(Lib_fffNode4rect.width,Lib_fffNode4rect.height);
  196. Lib_fffNode4.setStyle("opacity",1);
  197. Lib_fffNode4.s({'pixelPerfect':true});
  198. Lib_fffNode4borderwidth=1;
  199. Lib_fffNode4.setRotation(0);
  200. dataModel.add(Lib_fffNode4);
  201. Lib_fffNode4.a('node.points',Lib_fffNode4compspts);
  202. Lib_fffNode4.a('node.segments',[1,2]);
  203. Lib_fffNode4.a('node.color','rgba(255,0,255,1)');
  204. Lib_fffNode4.a('node.borderPattern',getDashStyle("@borderPattern@"));
  205. Lib_fffNode4.a('node.borderColor','rgba(255,0,255,1)');
  206. Lib_fffNode4.a('node.background','rgba(255,0,255,1)');
  207. Lib_fffNode4.a('node.gradient','');
  208. Lib_fffNode4.a('node.gradientcolor','rgba(255,0,255,1)');
  209. Lib_fffNode4.a('node.endCompspts',Lib_fffNode4endCompspts);
  210. Lib_fffNode4.a('node.startCompspts',Lib_fffNode4startCompspts);
  211. (function (node, img, compspts, endCompspts, startCompspts) {
  212. var position = node.getPosition(),
  213. w = node.getWidth()*_ratio.ratioX,
  214. h = node.getHeight()*_ratio.ratioY;
  215. function resetPoints(rx, ry) {
  216. for (var i = 0, len = compspts.length; i < len; i++) {
  217. if (i%2 === 0) {
  218. compspts[i]*=rx;
  219. } else {
  220. compspts[i]*=ry;
  221. }
  222. }
  223. endCompspts[0] = compspts[compspts.length-2];
  224. endCompspts[1] = compspts[compspts.length-1];
  225. endCompspts[2] *= rx;
  226. endCompspts[3] *= ry;
  227. node.a('node.offsetEndY', -(endCompspts[3]*0.5));
  228. node.a('node.offsetEndX', -(endCompspts[2]*0.5));
  229. startCompspts[0] = compspts[0];
  230. startCompspts[1] = compspts[1];
  231. startCompspts[2] *= rx;
  232. startCompspts[3] *= ry;
  233. node.a('node.offsetStartY', -(startCompspts[3]*0.5));
  234. node.a('node.offsetStartX', -(startCompspts[2]*0.5));
  235. node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
  236. node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
  237. }
  238. node.setSize(w, h);
  239. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  240. node.a('node.width', w);
  241. node.a('node.height', h);
  242. resetPoints(_ratio.ratioX, _ratio.ratioY);
  243. node.borderWidth = 1;
  244. node.a('node.borderwidth',node.borderWidth);
  245. node._nodename = 'Lib_fffNode4';
  246. node._nodeType = 'line';
  247. zoomNodeList.push({
  248. node: node,
  249. attr: 'node.borderwidth'
  250. });
  251. var setWidth = node.setWidth,
  252. setHeight = node.setHeight,
  253. timer, rx = 1, ry = 1;
  254. node.setWidth = function (width) {
  255. var _width = this.getWidth();
  256. rx = width / _width;
  257. node.a('node.width', width);
  258. setWidth.apply(this, arguments);
  259. resetPoints(rx, 1);
  260. }
  261. node.setHeight = function (height) {
  262. var _height = this.getHeight();
  263. ry = height / _height;
  264. node.a('node.height', height);
  265. setHeight.apply(this, arguments);
  266. resetPoints(1, ry);
  267. }
  268. })(Lib_fffNode4, Lib_fffNode4.getImage(), Lib_fffNode4compspts, Lib_fffNode4endCompspts, Lib_fffNode4startCompspts);
  269. _ratio = GD.getRatioWithRotation(0*Math.PI/180, ratio);
  270. var Lib_fffNode5type = 'oval';
  271. var Lib_fffNode5 = new ht.Node(),
  272. Lib_fffNode5BorderWidth = 1*2;
  273. if (Lib_fffNode5type === 'arc') {
  274. Lib_fffNode5BorderWidth *= 1;
  275. }
  276. Lib_fffNode5.setImage(GD.getRectJSON(10*_ratio.ratioX, 10*_ratio.ratioY, Lib_fffNode5type, '@arcFrom@', '@arcTo@', '@arcClose@'));
  277. Lib_fffNode5.setPosition(7*ratio.ratioX, 37*ratio.ratioY);
  278. Lib_fffNode5.setSize(10*_ratio.ratioX, 10*_ratio.ratioY);
  279. Lib_fffNode5.s({
  280. 'pixelPerfect':true
  281. /*@AddPara@*/
  282. });
  283. Lib_fffNode5.a('node.width', 10*_ratio.ratioX);
  284. Lib_fffNode5.a('node.height', 10*_ratio.ratioY);
  285. Lib_fffNode5.a('node.type', Lib_fffNode5type);
  286. Lib_fffNode5.a('node.rect', [0, 0, 10*_ratio.ratioX, 10*_ratio.ratioY]);
  287. Lib_fffNode5.a('node.background', 'rgba(255,255,255,0.003921569)');
  288. Lib_fffNode5.a('node.gradientcolor', '');
  289. Lib_fffNode5.a('node.gradient', '');
  290. Lib_fffNode5.a('node.borderwidth', Lib_fffNode5BorderWidth);
  291. Lib_fffNode5.a('node.color', 'rgba(255,0,255,1)');
  292. Lib_fffNode5.a('node.fillrect', [0,0,0,0]);
  293. Lib_fffNode5.a('node.fillbackcolor', 'rgba(0,0,0,0)');
  294. Lib_fffNode5.a('node.fillgradientcolor', 'rgba(0,0,0,0)');
  295. Lib_fffNode5.a('node.fillgradient', '');
  296. if (Lib_fffNode5type !== 'rect') {
  297. Lib_fffNode5.a('node.arcFrom', parseFloat('@arcFrom@'));
  298. Lib_fffNode5.a('node.arcTo', parseFloat('@arcTo@'));
  299. Lib_fffNode5.a('node.arcClose', '@arcClose@' === 'true' ? true : false);
  300. }
  301. if (Lib_fffNode5type === 'arc') {
  302. Lib_fffNode5.a('node.arcOval', true);
  303. }
  304. Lib_fffNode5.setRotation(0*Math.PI/180);
  305. Lib_fffNode5.borderWidth = Lib_fffNode5BorderWidth;
  306. Lib_fffNode5.borderFillwidth = Lib_fffNode5BorderWidth;
  307. dataModel.add(Lib_fffNode5);
  308. Lib_fffNode5._nodename = 'Lib_fffNode5'
  309. Lib_fffNode5._nodeType = 'rect';
  310. zoomNodeList.push({
  311. node: Lib_fffNode5,
  312. attr: 'node.borderwidth'
  313. });
  314. (function (node, _img) {
  315. var setWidth = node.setWidth,
  316. setHeight = node.setHeight;
  317. node.setWidth = function (width) {
  318. if (width === this.getWidth()) return ;
  319. var height = this.getHeight();
  320. this.a('node.width', width);
  321. this.a('node.rect', [0,0,width, height]);
  322. setWidth.apply(this, arguments);
  323. }
  324. node.setHeight = function (height) {
  325. if (height === this.getHeight()) return ;
  326. var width = this.getWidth();
  327. this.a('node.height', height);
  328. this.a('node.rect', [0,0,width, height]);
  329. setHeight.apply(this, arguments);
  330. }
  331. })(Lib_fffNode5, Lib_fffNode5.getImage());_ratio = GD.getRatioWithRotation(0*Math.PI/180, ratio);
  332. var Lib_fffNode6type = 'oval';
  333. var Lib_fffNode6 = new ht.Node(),
  334. Lib_fffNode6BorderWidth = 1*2;
  335. if (Lib_fffNode6type === 'arc') {
  336. Lib_fffNode6BorderWidth *= 1;
  337. }
  338. Lib_fffNode6.setImage(GD.getRectJSON(10*_ratio.ratioX, 10*_ratio.ratioY, Lib_fffNode6type, '@arcFrom@', '@arcTo@', '@arcClose@'));
  339. Lib_fffNode6.setPosition(7*ratio.ratioX, 47*ratio.ratioY);
  340. Lib_fffNode6.setSize(10*_ratio.ratioX, 10*_ratio.ratioY);
  341. Lib_fffNode6.s({
  342. 'pixelPerfect':true
  343. /*@AddPara@*/
  344. });
  345. Lib_fffNode6.a('node.width', 10*_ratio.ratioX);
  346. Lib_fffNode6.a('node.height', 10*_ratio.ratioY);
  347. Lib_fffNode6.a('node.type', Lib_fffNode6type);
  348. Lib_fffNode6.a('node.rect', [0, 0, 10*_ratio.ratioX, 10*_ratio.ratioY]);
  349. Lib_fffNode6.a('node.background', 'rgba(255,255,255,0.003921569)');
  350. Lib_fffNode6.a('node.gradientcolor', '');
  351. Lib_fffNode6.a('node.gradient', '');
  352. Lib_fffNode6.a('node.borderwidth', Lib_fffNode6BorderWidth);
  353. Lib_fffNode6.a('node.color', 'rgba(255,0,255,1)');
  354. Lib_fffNode6.a('node.fillrect', [0,0,0,0]);
  355. Lib_fffNode6.a('node.fillbackcolor', 'rgba(0,0,0,0)');
  356. Lib_fffNode6.a('node.fillgradientcolor', 'rgba(0,0,0,0)');
  357. Lib_fffNode6.a('node.fillgradient', '');
  358. if (Lib_fffNode6type !== 'rect') {
  359. Lib_fffNode6.a('node.arcFrom', parseFloat('@arcFrom@'));
  360. Lib_fffNode6.a('node.arcTo', parseFloat('@arcTo@'));
  361. Lib_fffNode6.a('node.arcClose', '@arcClose@' === 'true' ? true : false);
  362. }
  363. if (Lib_fffNode6type === 'arc') {
  364. Lib_fffNode6.a('node.arcOval', true);
  365. }
  366. Lib_fffNode6.setRotation(0*Math.PI/180);
  367. Lib_fffNode6.borderWidth = Lib_fffNode6BorderWidth;
  368. Lib_fffNode6.borderFillwidth = Lib_fffNode6BorderWidth;
  369. dataModel.add(Lib_fffNode6);
  370. Lib_fffNode6._nodename = 'Lib_fffNode6'
  371. Lib_fffNode6._nodeType = 'rect';
  372. zoomNodeList.push({
  373. node: Lib_fffNode6,
  374. attr: 'node.borderwidth'
  375. });
  376. (function (node, _img) {
  377. var setWidth = node.setWidth,
  378. setHeight = node.setHeight;
  379. node.setWidth = function (width) {
  380. if (width === this.getWidth()) return ;
  381. var height = this.getHeight();
  382. this.a('node.width', width);
  383. this.a('node.rect', [0,0,width, height]);
  384. setWidth.apply(this, arguments);
  385. }
  386. node.setHeight = function (height) {
  387. if (height === this.getHeight()) return ;
  388. var width = this.getWidth();
  389. this.a('node.height', height);
  390. this.a('node.rect', [0,0,width, height]);
  391. setHeight.apply(this, arguments);
  392. }
  393. })(Lib_fffNode6, Lib_fffNode6.getImage());
  394. /*@GraphList@*/
  395. /*@PageInit@*/
  396. var localVarObj = this.localVarObj;
  397. var localDynamicVarObj = this.localDynamicVar();
  398. this['Lib_fffNode0'] = Lib_fffNode0;
  399. Lib_fffNode0.__parentLib = nodename;
  400. Lib_fffNode0.__parent = this;
  401. this.childNodes.push(Lib_fffNode0);
  402. this['Lib_fffNode1'] = Lib_fffNode1;
  403. Lib_fffNode1.__parentLib = nodename;
  404. Lib_fffNode1.__parent = this;
  405. this.childNodes.push(Lib_fffNode1);
  406. this['Lib_fffNode2'] = Lib_fffNode2;
  407. Lib_fffNode2.__parentLib = nodename;
  408. Lib_fffNode2.__parent = this;
  409. this.childNodes.push(Lib_fffNode2);
  410. this['Lib_fffNode3'] = Lib_fffNode3;
  411. Lib_fffNode3.__parentLib = nodename;
  412. Lib_fffNode3.__parent = this;
  413. this.childNodes.push(Lib_fffNode3);
  414. this['Lib_fffNode4'] = Lib_fffNode4;
  415. Lib_fffNode4.__parentLib = nodename;
  416. Lib_fffNode4.__parent = this;
  417. this.childNodes.push(Lib_fffNode4);
  418. this['Lib_fffNode5'] = Lib_fffNode5;
  419. Lib_fffNode5.__parentLib = nodename;
  420. Lib_fffNode5.__parent = this;
  421. this.childNodes.push(Lib_fffNode5);
  422. this['Lib_fffNode6'] = Lib_fffNode6;
  423. Lib_fffNode6.__parentLib = nodename;
  424. Lib_fffNode6.__parent = this;
  425. this.childNodes.push(Lib_fffNode6);
  426. /*@ControlContextMenu@*/
  427. /*@Declare@*/
  428. this.init(x, y, width, height, angle);
  429. };
  430. ht.Default.def('ht.lib.fff', Object, {
  431. refresh10ms: function () {
  432. var localVarObj = this.localVarObj;
  433. var localDynamicVarObj = this.localDynamicVar();
  434. var Lib_fffNode0= this.Lib_fffNode0;
  435. var Lib_fffNode1= this.Lib_fffNode1;
  436. var Lib_fffNode2= this.Lib_fffNode2;
  437. var Lib_fffNode3= this.Lib_fffNode3;
  438. var Lib_fffNode4= this.Lib_fffNode4;
  439. var Lib_fffNode5= this.Lib_fffNode5;
  440. var Lib_fffNode6= this.Lib_fffNode6;
  441. Lib_fffNode0.refresh10ms();
  442. Lib_fffNode1.refresh10ms();
  443. Lib_fffNode2.refresh10ms();
  444. /*@refresh10ms@*/
  445. },
  446. refresh100ms: function () {
  447. var localVarObj = this.localVarObj;
  448. var localDynamicVarObj = this.localDynamicVar();
  449. var Lib_fffNode0= this.Lib_fffNode0;
  450. var Lib_fffNode1= this.Lib_fffNode1;
  451. var Lib_fffNode2= this.Lib_fffNode2;
  452. var Lib_fffNode3= this.Lib_fffNode3;
  453. var Lib_fffNode4= this.Lib_fffNode4;
  454. var Lib_fffNode5= this.Lib_fffNode5;
  455. var Lib_fffNode6= this.Lib_fffNode6;
  456. Lib_fffNode0.refresh100ms();
  457. Lib_fffNode1.refresh100ms();
  458. Lib_fffNode2.refresh100ms();
  459. /*@refresh100ms@*/
  460. },
  461. refresh500ms: function () {
  462. var localVarObj = this.localVarObj;
  463. var localDynamicVarObj = this.localDynamicVar();
  464. var Lib_fffNode0= this.Lib_fffNode0;
  465. var Lib_fffNode1= this.Lib_fffNode1;
  466. var Lib_fffNode2= this.Lib_fffNode2;
  467. var Lib_fffNode3= this.Lib_fffNode3;
  468. var Lib_fffNode4= this.Lib_fffNode4;
  469. var Lib_fffNode5= this.Lib_fffNode5;
  470. var Lib_fffNode6= this.Lib_fffNode6;
  471. Lib_fffNode0.refresh500ms();
  472. Lib_fffNode1.refresh500ms();
  473. Lib_fffNode2.refresh500ms();
  474. /*@refresh500ms@*/
  475. },
  476. refresh1s: function () {
  477. var Counter1s = arguments[0] || 0;
  478. var localVarObj = this.localVarObj;
  479. var localDynamicVarObj = this.localDynamicVar();
  480. var Lib_fffNode0= this.Lib_fffNode0;
  481. var Lib_fffNode1= this.Lib_fffNode1;
  482. var Lib_fffNode2= this.Lib_fffNode2;
  483. var Lib_fffNode3= this.Lib_fffNode3;
  484. var Lib_fffNode4= this.Lib_fffNode4;
  485. var Lib_fffNode5= this.Lib_fffNode5;
  486. var Lib_fffNode6= this.Lib_fffNode6;
  487. Lib_fffNode0.refresh1s(Counter1s);
  488. Lib_fffNode1.refresh1s(Counter1s);
  489. Lib_fffNode2.refresh1s(Counter1s);
  490. /*@refresh1s@*/
  491. },
  492. refresh5s: function () {
  493. var localVarObj = this.localVarObj;
  494. var localDynamicVarObj = this.localDynamicVar();
  495. var Lib_fffNode0= this.Lib_fffNode0;
  496. var Lib_fffNode1= this.Lib_fffNode1;
  497. var Lib_fffNode2= this.Lib_fffNode2;
  498. var Lib_fffNode3= this.Lib_fffNode3;
  499. var Lib_fffNode4= this.Lib_fffNode4;
  500. var Lib_fffNode5= this.Lib_fffNode5;
  501. var Lib_fffNode6= this.Lib_fffNode6;
  502. Lib_fffNode0.refresh5s();
  503. Lib_fffNode1.refresh5s();
  504. Lib_fffNode2.refresh5s();
  505. /*@refresh5s@*/
  506. },
  507. /*@PageDynamic@*/
  508. onEvent: function (e, data, type, origin, offset, objMouseOn, ctm) {
  509. var localVarObj = this.localVarObj;
  510. var localDynamicVarObj = this.localDynamicVar();
  511. var Lib_fffNode0= this.Lib_fffNode0;
  512. var Lib_fffNode1= this.Lib_fffNode1;
  513. var Lib_fffNode2= this.Lib_fffNode2;
  514. var Lib_fffNode3= this.Lib_fffNode3;
  515. var Lib_fffNode4= this.Lib_fffNode4;
  516. var Lib_fffNode5= this.Lib_fffNode5;
  517. var Lib_fffNode6= this.Lib_fffNode6;
  518. if (type === 'click') {
  519. /*@EvnentClicked@*/
  520. } else if (type === 'mousedown') {
  521. mouseX=e.clientX;
  522. mouseY=e.clientY;
  523. /*@EvnentMouseDown@*/
  524. } else if (type === 'mouseup') {
  525. /*@EvnentMouseUp@*/
  526. } else if (type === 'mousemove') {
  527. var mouseX, mouseY, position, zoom;
  528. position=origin.getLogicalPoint(e);
  529. zoom = graphView.getZoom();
  530. if (origin === graphView) {
  531. mouseX= position.x + origin.tx();
  532. mouseY = position.y + origin.ty();
  533. } else {
  534. offset = offset || {x: 0, y: 0};
  535. mouseX = position.x / zoom + offset.x + origin.tx();
  536. mouseY = position.y / zoom + offset.y + origin.ty();
  537. }
  538. /*@EvnentMouseLeave@*/
  539. /*@EvnentMouseOver@*/
  540. } else if (type === 'keydown') {
  541. /*@EvnentKeyDown@*/
  542. } else if (type === 'contextmenu') {
  543. /*@Declare@*/
  544. /*@SetNodeContextMenu@*/
  545. /*@SetPageContextMenu@*/
  546. }
  547. /*@LibEvent@*/
  548. },
  549. getBaseClass: function () {
  550. return this._baseClass;
  551. },
  552. getWidth: function () {
  553. return this._width;
  554. },
  555. getHeight: function () {
  556. return this._height;
  557. },
  558. getSize: function () {
  559. return {
  560. width: this._width,
  561. height: this._height
  562. }
  563. },
  564. setWidth: function (width) {
  565. if (width === undefined || width === null || width != width) {
  566. return ;
  567. }
  568. var originWidth = this._width;
  569. var ratio = width / originWidth;
  570. var childNodes = this.childNodes, childNode, p, op = this.getPosition(), w, cw, ox, rotation = this.getRotation();
  571. for (var i = 0, len = childNodes.length; i < len; i++) {
  572. childNode = childNodes[i];
  573. p = childNode.getPosition();
  574. cw = childNode.getWidth();
  575. w = cw >=2 ? cw * ratio : cw;
  576. childNode.setWidth(w);
  577. ox = op.x + (p.x - op.x) * ratio;
  578. childNode.setPosition(ox, p.y);
  579. rotation = GD.calcRotation(rotation);
  580. if (rotation === 0 || rotation === Math.PI) {
  581. // 图元未旋转
  582. ox = op.x + (p.x - op.x)*ratio;
  583. childNode.setPosition(ox, p.y);
  584. } else if (rotation === 90 * Math.PI / 180) {
  585. // 图元旋转以后
  586. ox = op.y + (p.y - op.y)*ratio;
  587. childNode.setPosition(p.x, ox);
  588. }
  589. }
  590. this._width = width;
  591. this._originWidth = width;
  592. this._ratioX = ratio;
  593. return this;
  594. },
  595. setHeight: function (height) {
  596. if (height === undefined || height === null || height != height) {
  597. return ;
  598. }
  599. var originHeight = this._height;
  600. var ratio = height / originHeight;
  601. var childNodes = this.childNodes, childNode, p, op = this.getPosition(), h, ch, oy, rotation = this.getRotation();
  602. for (var i = 0, len = childNodes.length; i < len; i++) {
  603. childNode = childNodes[i];
  604. p = childNode.getPosition();
  605. ch = childNode.getHeight();
  606. h = ch >=2 ? ch * ratio : ch;
  607. childNode.setHeight(h);
  608. rotation = GD.calcRotation(rotation);
  609. if (rotation === 0 || rotation === Math.PI) {
  610. // 图元未旋转
  611. oy = op.y + (p.y - op.y)*ratio;
  612. childNode.setPosition(p.x, oy);
  613. } else if (rotation === 90 * Math.PI / 180) {
  614. // 图元旋转以后
  615. oy = op.x + (p.x - op.x)*ratio;
  616. childNode.setPosition(oy, p.y);
  617. }
  618. }
  619. this._height = height;
  620. this._originHeight = height;
  621. this._ratioY = ratio;
  622. return this;
  623. },
  624. setSize: function (size) {
  625. // var args = Array.prototype.slice.call(arguments, 0);
  626. // var height, width;
  627. // if (args.length === 0) {
  628. // return ;
  629. // }else if (args.length === 1) {
  630. // height = args[0].height;
  631. // width = args[0].width;
  632. // } else {
  633. // width = args[0];
  634. // height = args[1];
  635. // }
  636. // var wh = GD.getRatioWithRotation(angle, wid)
  637. // this.setHeight(height);
  638. // this.setWidth(width);
  639. // return this;
  640. var args = Array.prototype.slice.call(arguments, 0);
  641. var height, width;
  642. if (args.length === 0) {
  643. return ;
  644. }else if (args.length === 1) {
  645. height = args[0].height;
  646. width = args[0].width;
  647. angle = 0;
  648. } else if (args.length === 2) {
  649. if (typeof args[0] === 'object') {
  650. width = args[0].width;
  651. height = args[0].height;
  652. angle = args[1] || 0;
  653. } else {
  654. width = args[0];
  655. height = args[1];
  656. angle = 0;
  657. }
  658. } else if (args.length === 3) {
  659. width = args[0];
  660. height = args[1];
  661. angle = args[2] || 0;
  662. }
  663. var wh = GD.getRatioWithRotation(0, width, height);
  664. this.setHeight(wh.ratioY);
  665. this.setWidth(wh.ratioX);
  666. return this;
  667. },
  668. getPosition: function () {
  669. return {
  670. x: this._x,
  671. y: this._y
  672. }
  673. },
  674. setPosition: function () {
  675. var args = Array.prototype.slice.call(arguments, 0), x, y;
  676. if (args.length === 0) {
  677. return this;
  678. } else if (args.length === 1) {
  679. if (typeof args[0] != 'object') {
  680. return this;
  681. }
  682. x = args[0].x;
  683. y = args[0].y;
  684. } else {
  685. x = args[0];
  686. y = args[1];
  687. }
  688. if ((x !== 0 && !x) || (y !== 0 && !y)) {
  689. return this;
  690. }
  691. // var childNodes = this.childNodes, offset, childNode, p;
  692. // for (var i = 0, len = childNodes.length; i < len; i++) {
  693. // childNode = childNodes[i];
  694. // p = childNode.getPosition();
  695. // childNode.setPosition(x - (this._x-p.x)*this._ratioX, y - (this._y-p.y)*this._ratioY);
  696. // }
  697. // this._x = x;
  698. // this._y = y;
  699. // return this;
  700. var childNodes, childNode, background, offset = {}, op, cp;
  701. childNodes = this.childNodes;
  702. background = this._background;
  703. op = background.getPosition();
  704. offset.x = x - op.x;
  705. offset.y = y - op.y;
  706. for (var i = 0, len = childNodes.length; i < len; i++) {
  707. childNode = childNodes[i];
  708. cp = childNode.getPosition();
  709. childNode.setPosition(cp.x + offset.x, cp.y + offset.y);
  710. }
  711. this._x = x;
  712. this._y = y;
  713. this._position = {x: x, y: y};
  714. return this;
  715. },
  716. getStyle: function (key) {
  717. if (!key) {
  718. return undefined;
  719. }
  720. return this._styleObject[key];
  721. },
  722. setStyle: function (key, value, force) {
  723. var childNodes = this.childNodes, childNode;
  724. for (var i = 0, len = childNodes.length; i < len; i++) {
  725. childNode = childNodes[i];
  726. if (key === '2d.visible') {
  727. if (value === graphView.isVisible(childNode)) {
  728. continue;
  729. }
  730. if (!value) {
  731. childNode._savedIsVisible = graphView.isVisible(childNode);
  732. childNode.s({
  733. '2d.visible': false
  734. })
  735. } else {
  736. childNode.s({
  737. '2d.visible': childNode._savedIsVisible
  738. })
  739. }
  740. continue;
  741. }
  742. childNode.s({
  743. key: value
  744. });
  745. }
  746. this._styleObject[key] = value;
  747. return this;
  748. },
  749. calcSize: function () {
  750. var background = this._background;
  751. var position = background.getPosition(),
  752. width = background.getWidth(),
  753. height = background.getHeight();
  754. this._width = width;
  755. this._height = height;
  756. this._x = position.x;
  757. this._y = position.y;
  758. this._position = {
  759. x: this._x,
  760. y: this._y
  761. }
  762. return this;
  763. return this;
  764. },
  765. s: function (styleObj, force) {
  766. var args = Array.prototype.slice.call(arguments, 0);
  767. var styleObj;
  768. if (args.length === 0) {
  769. return this;
  770. } else if (args.length === 1) {
  771. styleObj = args[0];
  772. } else {
  773. this.setStyle(args[0], args[1]);
  774. return this;
  775. }
  776. for (var key in styleObj) {
  777. if (!styleObj.hasOwnProperty(key)) {
  778. continue;
  779. }
  780. this.setStyle(key, styleObj[key], force);
  781. }
  782. return this;
  783. },
  784. init: function (x, y, width, height, angle) {
  785. var that = this;
  786. this.calcSize();
  787. (function (width, height, angle) {
  788. // that.setSize(width, height, angle);
  789. // var wh = GD.getRatioWithRotation(angle, width, height);
  790. // width = wh.ratioX;
  791. // height = wh.ratioY;
  792. var originHeight = that._height;
  793. var originWidth = that._width;
  794. var ratioY = height / originHeight;
  795. var ratioX = width / originWidth;
  796. var childNodes = that.childNodes,
  797. childNode,p, op = that.getPosition(), h, ch, oy, w, cw, ox, name, borderRatio, borderWidth;
  798. for (var i = 0, len = childNodes.length; i < len; i++) {
  799. childNode = childNodes[i];
  800. p = childNode.getPosition();
  801. childNode.originHeight = childNode.originHeight || childNode.getHeight();
  802. ch = childNode.getHeight();
  803. cw = childNode.getWidth();
  804. if (ch > 2) {
  805. h = ch * ratioY;
  806. childNode.setHeight(h);
  807. }
  808. if (cw > 2) {
  809. w = cw * ratioX;
  810. childNode.setWidth(w);
  811. }
  812. borderRatio = (ratioX + ratioY)*0.5;
  813. if (childNode._nodeType === 'line') { // 如果是线,
  814. if (childNode.getWidth() > childNode.getHeight()) {
  815. borderRatio = ratioX;
  816. } else {
  817. borderRatio = ratioY;
  818. }
  819. }
  820. name = childNode._nodename;
  821. // if (childNode.borderWidth && name && ch > 2 && cw > 2) {
  822. // borderWidth = childNode.borderWidth / borderRatio;
  823. // if (borderWidth > ch*0.5 || borderWidth > cw *0.5) {
  824. // // borderWidth = childNode.borderWidth;
  825. // }
  826. // childNode.borderWidth = borderWidth;
  827. // childNode.a(name + '.borderwidth', borderWidth);
  828. // }
  829. }
  830. that._height = height;
  831. that._originHeight = height;
  832. that._ratioY = ratioY;
  833. that._width = width;
  834. that._originWidth = width;
  835. that._ratioX = ratioX;
  836. })(width, height, angle);
  837. that._x = width / 2;
  838. that._y = height / 2;
  839. that._rotation = 0;
  840. // that.setPosition(x, y);
  841. (function (x, y) {
  842. var childNodes = that.childNodes, offset, childNode;
  843. var w2 = that.getWidth() / 2, h2 = that.getHeight()/2;
  844. for (var i = 0, len = childNodes.length; i < len; i++) {
  845. childNode = childNodes[i];
  846. offset = childNode.getPosition();
  847. childNode.setPosition(x + offset.x * that._ratioX - w2, y + offset.y * that._ratioY - h2);
  848. }
  849. that._x = x;
  850. that._y = y;
  851. })(x, y);
  852. // setTimeout(that.addEVent, 1000);
  853. },
  854. setRotation: function (angle) {
  855. var that = this, _angle = that.getRotation();
  856. if (angle!==0 && !angle || angle === _angle) {
  857. return this;
  858. }
  859. var childNodes = this.childNodes, childNode, p = this.getPosition(), px = p.x, py = p.y;
  860. for (var i = 0, len = childNodes.length; i < len; i++) {
  861. childNode = childNodes[i];
  862. var x = childNode.getPosition().x - px;
  863. var y = childNode.getPosition().y - py;
  864. childNode.setPosition(Math.cos(angle-_angle) * x - Math.sin(angle-_angle) * y + px, Math.cos(angle-_angle) * y + Math.sin(angle-_angle) * x + py);
  865. childNode.setRotation(angle);
  866. }
  867. this._rotation = angle;
  868. return this;
  869. },
  870. getRotation: function () {
  871. return this._rotation;
  872. },
  873. setScale: function (sx, sy) {
  874. var that = this,
  875. childNodes = this.childNodes,
  876. childNode;
  877. if (sx === undefined || sx === null) return ;
  878. if (sy === undefined || sy === null) {
  879. sy = sx;
  880. }
  881. for (var i = 0, len = childNodes.length; i < len; i++) {
  882. childNode = childNodes[i];
  883. if (typeof childNode.setScale === 'function') {
  884. childNode.setScale(sx, sy);
  885. }
  886. }
  887. },
  888. getScale: function () {
  889. return this._background.getScale();
  890. },
  891. setScaleX: function (sx) {
  892. if (sx === undefined || sx === null) return;
  893. var that = this,
  894. childNodes = this.childNodes,
  895. childNode;
  896. for (var i = 0, len = childNodes.length; i < len; i++) {
  897. childNode = childNodes[i];
  898. if (typeof childNode.setScaleX === 'function') {
  899. childNode.setScaleX(sx);
  900. }
  901. }
  902. },
  903. setScaleY: function (sy) {
  904. if (sy === undefined || sy === null) return;
  905. var that = this,
  906. childNodes = this.childNodes,
  907. childNode;
  908. for (var i = 0, len = childNodes.length; i < len; i++) {
  909. childNode = childNodes[i];
  910. if (typeof childNode.setScaleY === 'function') {
  911. childNode.setScaleY(sy);
  912. }
  913. }
  914. },
  915. getScaleX: function () {
  916. return this._background.getScaleX();
  917. },
  918. getScaleY: function () {
  919. return this._background.getScaleY();
  920. },
  921. evert: function () {
  922. var that = this,
  923. childNodes = this.childNodes,
  924. background = this._background,
  925. bp = background.getPosition(),
  926. bx = bp.x,
  927. by = bp.y,
  928. childNode, distanceX, distanceY, x, y, p, nx, ny;
  929. for (var i = 0, len = childNodes.length; i < len; i++) {
  930. childNode = childNodes[i];
  931. p = childNode.getPosition();
  932. x = p.x;
  933. y = p.y;
  934. distanceX = bx - x;
  935. distanceY = by - y;
  936. nx = bx + distanceX;
  937. ny = by + distanceY;
  938. childNode.setPosition(nx, ny);
  939. if (typeof childNode.setScale === 'function') {
  940. if (!(childNode._disallowEvert === true))
  941. childNode.setScale(-1, -1);
  942. }
  943. }
  944. },
  945. evertX: function () {
  946. var that = this,
  947. childNodes = this.childNodes,
  948. background = this._background,
  949. bx = background.getPosition().x,
  950. childNode, distance, x, p, nx;
  951. for (var i = 0, len = childNodes.length; i < len; i++) {
  952. childNode = childNodes[i];
  953. p = childNode.getPosition();
  954. x = p.x;
  955. distance = bx - x;
  956. nx = bx + distance;
  957. childNode.setPosition(nx, p.y);
  958. if (typeof childNode.setScaleX === 'function') {
  959. if (!(childNode._disallowEvert === true))
  960. childNode.setScaleX(-1);
  961. }
  962. }
  963. },
  964. evertY: function () {
  965. var that = this,
  966. childNodes = this.childNodes,
  967. background = this._background,
  968. by = background.getPosition().y,
  969. childNode, distance, y, p, ny;
  970. for (var i = 0, len = childNodes.length; i < len; i++) {
  971. childNode = childNodes[i];
  972. p = childNode.getPosition();
  973. y = p.y;
  974. distance = by - y;
  975. ny = by + distance;
  976. childNode.setPosition(p.x, ny);
  977. if (typeof childNode.setScaleY === 'function') {
  978. if (!(childNode._disallowEvert === true))
  979. childNode.setScaleY(-1);
  980. }
  981. }
  982. },
  983. attr: function (key, value) {
  984. var _attrObj = this._attrObj || {};
  985. if (arguments.length === 1) {
  986. return _attrObj[key];
  987. }
  988. var childNodes = this.childNodes, childNode;
  989. _attrObj[key] = value;
  990. for (var i = 0; childNode = childNodes[i++];) {
  991. if (typeof childNode.a === 'function') {
  992. childNode.a(key, value);
  993. }
  994. }
  995. },
  996. a: function () {
  997. return this.attr.apply(this, arguments);
  998. }
  999. });
  1000. }