主变.js 67 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691
  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 = 65*_ratio.ratioX;
  11. this._originHeight = 48*_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_主变Node0_0type = 'oval';
  37. var Lib_主变Node0_0 = new ht.Node(),
  38. Lib_主变Node0_0BorderWidth = 2*2;
  39. if (Lib_主变Node0_0type === 'arc') {
  40. Lib_主变Node0_0BorderWidth *= 2;
  41. }
  42. Lib_主变Node0_0.setImage(GD.getRectJSON(29.84126*_ratio.ratioX, 26.18182*_ratio.ratioY, Lib_主变Node0_0type, '@arcFrom@', '@arcTo@', '@arcClose@'));
  43. Lib_主变Node0_0.setPosition(37*ratio.ratioX, 13*ratio.ratioY);
  44. Lib_主变Node0_0.setSize(29.84126*_ratio.ratioX, 26.18182*_ratio.ratioY);
  45. Lib_主变Node0_0.s({
  46. 'pixelPerfect':true
  47. /*@AddPara@*/
  48. });
  49. Lib_主变Node0_0.a('node.width', 29.84126*_ratio.ratioX);
  50. Lib_主变Node0_0.a('node.height', 26.18182*_ratio.ratioY);
  51. Lib_主变Node0_0.a('node.type', Lib_主变Node0_0type);
  52. Lib_主变Node0_0.a('node.rect', [0, 0, 29.84126*_ratio.ratioX, 26.18182*_ratio.ratioY]);
  53. Lib_主变Node0_0.a('node.background', 'rgba(255,255,255,0.003921569)');
  54. Lib_主变Node0_0.a('node.gradientcolor', '');
  55. Lib_主变Node0_0.a('node.gradient', '');
  56. Lib_主变Node0_0.a('node.borderwidth', Lib_主变Node0_0BorderWidth);
  57. Lib_主变Node0_0.a('node.color', 'rgba(255,0,255,1)');
  58. Lib_主变Node0_0.a('node.fillrect', [0,0,0,0]);
  59. Lib_主变Node0_0.a('node.fillbackcolor', 'rgba(0,0,0,0)');
  60. Lib_主变Node0_0.a('node.fillgradientcolor', 'rgba(0,0,0,0)');
  61. Lib_主变Node0_0.a('node.fillgradient', '');
  62. if (Lib_主变Node0_0type !== 'rect') {
  63. Lib_主变Node0_0.a('node.arcFrom', parseFloat('@arcFrom@'));
  64. Lib_主变Node0_0.a('node.arcTo', parseFloat('@arcTo@'));
  65. Lib_主变Node0_0.a('node.arcClose', '@arcClose@' === 'true' ? true : false);
  66. }
  67. if (Lib_主变Node0_0type === 'arc') {
  68. Lib_主变Node0_0.a('node.arcOval', true);
  69. }
  70. Lib_主变Node0_0.setRotation(0*Math.PI/180);
  71. Lib_主变Node0_0.borderWidth = Lib_主变Node0_0BorderWidth;
  72. Lib_主变Node0_0.borderFillwidth = Lib_主变Node0_0BorderWidth;
  73. dataModel.add(Lib_主变Node0_0);
  74. Lib_主变Node0_0._nodename = 'Lib_主变Node0_0'
  75. Lib_主变Node0_0._nodeType = 'rect';
  76. zoomNodeList.push({
  77. node: Lib_主变Node0_0,
  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_0, Lib_主变Node0_0.getImage());_ratio = GD.getRatioWithRotation(0*Math.PI/180, ratio);
  98. var Lib_主变Node0_1type = 'oval';
  99. var Lib_主变Node0_1 = new ht.Node(),
  100. Lib_主变Node0_1BorderWidth = 2*2;
  101. if (Lib_主变Node0_1type === 'arc') {
  102. Lib_主变Node0_1BorderWidth *= 2;
  103. }
  104. Lib_主变Node0_1.setImage(GD.getRectJSON(29.84126*_ratio.ratioX, 26.18182*_ratio.ratioY, Lib_主变Node0_1type, '@arcFrom@', '@arcTo@', '@arcClose@'));
  105. Lib_主变Node0_1.setPosition(37*ratio.ratioX, 34*ratio.ratioY);
  106. Lib_主变Node0_1.setSize(29.84126*_ratio.ratioX, 26.18182*_ratio.ratioY);
  107. Lib_主变Node0_1.s({
  108. 'pixelPerfect':true
  109. /*@AddPara@*/
  110. });
  111. Lib_主变Node0_1.a('node.width', 29.84126*_ratio.ratioX);
  112. Lib_主变Node0_1.a('node.height', 26.18182*_ratio.ratioY);
  113. Lib_主变Node0_1.a('node.type', Lib_主变Node0_1type);
  114. Lib_主变Node0_1.a('node.rect', [0, 0, 29.84126*_ratio.ratioX, 26.18182*_ratio.ratioY]);
  115. Lib_主变Node0_1.a('node.background', 'rgba(255,255,255,0.003921569)');
  116. Lib_主变Node0_1.a('node.gradientcolor', '');
  117. Lib_主变Node0_1.a('node.gradient', '');
  118. Lib_主变Node0_1.a('node.borderwidth', Lib_主变Node0_1BorderWidth);
  119. Lib_主变Node0_1.a('node.color', 'rgba(255,128,0,1)');
  120. Lib_主变Node0_1.a('node.fillrect', [0,0,0,0]);
  121. Lib_主变Node0_1.a('node.fillbackcolor', 'rgba(0,0,0,0)');
  122. Lib_主变Node0_1.a('node.fillgradientcolor', 'rgba(0,0,0,0)');
  123. Lib_主变Node0_1.a('node.fillgradient', '');
  124. if (Lib_主变Node0_1type !== 'rect') {
  125. Lib_主变Node0_1.a('node.arcFrom', parseFloat('@arcFrom@'));
  126. Lib_主变Node0_1.a('node.arcTo', parseFloat('@arcTo@'));
  127. Lib_主变Node0_1.a('node.arcClose', '@arcClose@' === 'true' ? true : false);
  128. }
  129. if (Lib_主变Node0_1type === 'arc') {
  130. Lib_主变Node0_1.a('node.arcOval', true);
  131. }
  132. Lib_主变Node0_1.setRotation(0*Math.PI/180);
  133. Lib_主变Node0_1.borderWidth = Lib_主变Node0_1BorderWidth;
  134. Lib_主变Node0_1.borderFillwidth = Lib_主变Node0_1BorderWidth;
  135. dataModel.add(Lib_主变Node0_1);
  136. Lib_主变Node0_1._nodename = 'Lib_主变Node0_1'
  137. Lib_主变Node0_1._nodeType = 'rect';
  138. zoomNodeList.push({
  139. node: Lib_主变Node0_1,
  140. attr: 'node.borderwidth'
  141. });
  142. (function (node, _img) {
  143. var setWidth = node.setWidth,
  144. setHeight = node.setHeight;
  145. node.setWidth = function (width) {
  146. if (width === this.getWidth()) return ;
  147. var height = this.getHeight();
  148. this.a('node.width', width);
  149. this.a('node.rect', [0,0,width, height]);
  150. setWidth.apply(this, arguments);
  151. }
  152. node.setHeight = function (height) {
  153. if (height === this.getHeight()) return ;
  154. var width = this.getWidth();
  155. this.a('node.height', height);
  156. this.a('node.rect', [0,0,width, height]);
  157. setHeight.apply(this, arguments);
  158. }
  159. })(Lib_主变Node0_1, Lib_主变Node0_1.getImage());_ratio = GD.getRatioWithRotation(0*Math.PI/180, ratio);
  160. var Lib_主变Node0_2type = 'oval';
  161. var Lib_主变Node0_2 = new ht.Node(),
  162. Lib_主变Node0_2BorderWidth = 2*2;
  163. if (Lib_主变Node0_2type === 'arc') {
  164. Lib_主变Node0_2BorderWidth *= 2;
  165. }
  166. Lib_主变Node0_2.setImage(GD.getRectJSON(29.84126*_ratio.ratioX, 26.18182*_ratio.ratioY, Lib_主变Node0_2type, '@arcFrom@', '@arcTo@', '@arcClose@'));
  167. Lib_主变Node0_2.setPosition(14*ratio.ratioX, 24*ratio.ratioY);
  168. Lib_主变Node0_2.setSize(29.84126*_ratio.ratioX, 26.18182*_ratio.ratioY);
  169. Lib_主变Node0_2.s({
  170. 'pixelPerfect':true
  171. /*@AddPara@*/
  172. });
  173. Lib_主变Node0_2.a('node.width', 29.84126*_ratio.ratioX);
  174. Lib_主变Node0_2.a('node.height', 26.18182*_ratio.ratioY);
  175. Lib_主变Node0_2.a('node.type', Lib_主变Node0_2type);
  176. Lib_主变Node0_2.a('node.rect', [0, 0, 29.84126*_ratio.ratioX, 26.18182*_ratio.ratioY]);
  177. Lib_主变Node0_2.a('node.background', 'rgba(255,255,255,0.003921569)');
  178. Lib_主变Node0_2.a('node.gradientcolor', '');
  179. Lib_主变Node0_2.a('node.gradient', '');
  180. Lib_主变Node0_2.a('node.borderwidth', Lib_主变Node0_2BorderWidth);
  181. Lib_主变Node0_2.a('node.color', 'rgba(255,0,255,1)');
  182. Lib_主变Node0_2.a('node.fillrect', [0,0,0,0]);
  183. Lib_主变Node0_2.a('node.fillbackcolor', 'rgba(0,0,0,0)');
  184. Lib_主变Node0_2.a('node.fillgradientcolor', 'rgba(0,0,0,0)');
  185. Lib_主变Node0_2.a('node.fillgradient', '');
  186. if (Lib_主变Node0_2type !== 'rect') {
  187. Lib_主变Node0_2.a('node.arcFrom', parseFloat('@arcFrom@'));
  188. Lib_主变Node0_2.a('node.arcTo', parseFloat('@arcTo@'));
  189. Lib_主变Node0_2.a('node.arcClose', '@arcClose@' === 'true' ? true : false);
  190. }
  191. if (Lib_主变Node0_2type === 'arc') {
  192. Lib_主变Node0_2.a('node.arcOval', true);
  193. }
  194. Lib_主变Node0_2.setRotation(0*Math.PI/180);
  195. Lib_主变Node0_2.borderWidth = Lib_主变Node0_2BorderWidth;
  196. Lib_主变Node0_2.borderFillwidth = Lib_主变Node0_2BorderWidth;
  197. dataModel.add(Lib_主变Node0_2);
  198. Lib_主变Node0_2._nodename = 'Lib_主变Node0_2'
  199. Lib_主变Node0_2._nodeType = 'rect';
  200. zoomNodeList.push({
  201. node: Lib_主变Node0_2,
  202. attr: 'node.borderwidth'
  203. });
  204. (function (node, _img) {
  205. var setWidth = node.setWidth,
  206. setHeight = node.setHeight;
  207. node.setWidth = function (width) {
  208. if (width === this.getWidth()) return ;
  209. var height = this.getHeight();
  210. this.a('node.width', width);
  211. this.a('node.rect', [0,0,width, height]);
  212. setWidth.apply(this, arguments);
  213. }
  214. node.setHeight = function (height) {
  215. if (height === this.getHeight()) return ;
  216. var width = this.getWidth();
  217. this.a('node.height', height);
  218. this.a('node.rect', [0,0,width, height]);
  219. setHeight.apply(this, arguments);
  220. }
  221. })(Lib_主变Node0_2, Lib_主变Node0_2.getImage());var Lib_主变Node0_3rect=ht.Default.unionPoint([{x: 6, y: 17},{x: 6, y: 17},{x: 17, y: 17},{x: 12, y: 30}]),
  222. Lib_主变Node0_3points=[6,17,6,17,17,17,12,30],
  223. Lib_主变Node0_3compsPoints=[],
  224. Lib_主变Node0_3SetPoints = [{x: 6, y: 17},{x: 6, y: 17},{x: 17, y: 17},{x: 12, y: 30}],
  225. Lib_主变Node0_3setSegments = [1,2,2,2];
  226. _ratio = GD.getRatioWithRotation(1.570796, ratio);
  227. for(var i=0;i<Lib_主变Node0_3points.length;i++){
  228. if(i%2==0){
  229. Lib_主变Node0_3compsPoints.push(Lib_主变Node0_3points[i]-Lib_主变Node0_3rect.x);
  230. }else{
  231. Lib_主变Node0_3compsPoints.push(Lib_主变Node0_3points[i]-Lib_主变Node0_3rect.y);
  232. }
  233. }
  234. var Lib_主变Node0_3 = new ht.Node();
  235. Lib_主变Node0_3.setImage(GD.getPolyGonJSON());
  236. Lib_主变Node0_3.setPosition(Lib_主变Node0_3rect.x + Lib_主变Node0_3rect.width/2, Lib_主变Node0_3rect.y + Lib_主变Node0_3rect.height/2);
  237. Lib_主变Node0_3.setSize(Lib_主变Node0_3rect.width, Lib_主变Node0_3rect.height);
  238. Lib_主变Node0_3.setRotation(1.570796);
  239. Lib_主变Node0_3.borderWidth=2;
  240. Lib_主变Node0_3.borderFillwidth=2*2;
  241. Lib_主变Node0_3.s({'pixelPerfect':true});
  242. dataModel.add(Lib_主变Node0_3);
  243. // Lib_主变Node0_3.a('node.width', Lib_主变Node0_3rect.width*_ratio.ratioX);
  244. // Lib_主变Node0_3.a('node.height', Lib_主变Node0_3rect.height*_ratio.ratioY);
  245. Lib_主变Node0_3.a('node.clip', function(g,width,height,data) {
  246. var clippoints = Lib_主变Node0_3SetPoints;
  247. if(clippoints.length<=3) return;
  248. if(Lib_主变Node0_3.a('Lib_主变Node0_3.isFill')=="false") return;
  249. var clipcompsPoints=[];
  250. var rect = ht.Default.unionPoint(clippoints);
  251. for(var i=0;i<clippoints.length;i++){
  252. clipcompsPoints.push({x:clippoints[i].x-rect.x,y:clippoints[i].y-rect.y});
  253. }
  254. var clipsegments=Lib_主变Node0_3setSegments;
  255. g.beginPath();
  256. drawPoints(g,clipcompsPoints,clipsegments);
  257. g.clip();
  258. })
  259. Lib_主变Node0_3.a('node.type', 'shape');
  260. Lib_主变Node0_3.a('node.comsPoints', Lib_主变Node0_3compsPoints);
  261. Lib_主变Node0_3.a('node.closePath', true);
  262. Lib_主变Node0_3.a('node.borderwidth', 2);
  263. Lib_主变Node0_3.a('node.color', 'rgba(255,0,255,1)');
  264. Lib_主变Node0_3.a('node.background','rgba(255,255,255,0.003921569)');
  265. Lib_主变Node0_3.a('node.closePath', true);
  266. Lib_主变Node0_3.a('node.closePath', true);
  267. Lib_主变Node0_3.a('node.gradient','');
  268. Lib_主变Node0_3.a('node.gradientcolor','');
  269. Lib_主变Node0_3.a('node.isFill','false');
  270. Lib_主变Node0_3.a('node.original',[0,0,0,0]);
  271. Lib_主变Node0_3.a('node.fillrect',[0,0,0,0]);
  272. Lib_主变Node0_3.a('node.fillbackcolor','rgba(255,255,255,0.003921569)');
  273. Lib_主变Node0_3.a('node.fillgradient','');
  274. Lib_主变Node0_3.a('node.fillgradientcolor','');
  275. Lib_主变Node0_3.a('node.segments',Lib_主变Node0_3setSegments);
  276. Lib_主变Node0_3.a('node.borderPattern',"");
  277. (function (node, nodecompsPoints, setPoints) {
  278. var w = node.getWidth()*_ratio.ratioX,
  279. h = node.getHeight()*_ratio.ratioY,
  280. img = node.getImage();
  281. function resetPoints(rx, ry) {
  282. for (var i = 0, len = nodecompsPoints.length; i < len; i++) {
  283. if (i%2 === 0) {
  284. nodecompsPoints[i]*=rx;
  285. } else {
  286. nodecompsPoints[i]*=ry;
  287. }
  288. if (setPoints[i]) {
  289. setPoints[i].x *= rx;
  290. setPoints[i].y *= ry;
  291. }
  292. }
  293. }
  294. node.setSize(w, h);
  295. node.a('node.width', w);
  296. node.a('node.height', h);
  297. resetPoints(_ratio.ratioX, _ratio.ratioY);
  298. var position = node.getPosition();
  299. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  300. node._nodename = 'Lib_主变Node0_3';
  301. node._nodeType = 'polygon';
  302. zoomNodeList.push({
  303. node: node,
  304. attr: 'node.borderwidth'
  305. });
  306. // 重载setWidth, setHeight
  307. var setWidth = node.setWidth,
  308. setHeight = node.setHeight,
  309. timer, rx = 1, ry = 1;
  310. node.setWidth = function (width) {
  311. var _width = this.getWidth();
  312. rx = width / _width;
  313. node.a('node.width', width);
  314. setWidth.apply(this, arguments);
  315. resetPoints(rx, 1);
  316. }
  317. node.setHeight = function (height) {
  318. var _height = this.getHeight();
  319. ry = height / _height;
  320. node.a('node.height', height);
  321. setHeight.apply(this, arguments);
  322. resetPoints(1, ry);
  323. }
  324. })(Lib_主变Node0_3, Lib_主变Node0_3compsPoints, Lib_主变Node0_3SetPoints );
  325. var Lib_主变Node0_4rect=ht.Default.unionPoint([{x: 33, y: 28},{x: 33, y: 28},{x: 43, y: 28},{x: 38, y: 41}]),
  326. Lib_主变Node0_4points=[33,28,33,28,43,28,38,41],
  327. Lib_主变Node0_4compsPoints=[],
  328. Lib_主变Node0_4SetPoints = [{x: 33, y: 28},{x: 33, y: 28},{x: 43, y: 28},{x: 38, y: 41}],
  329. Lib_主变Node0_4setSegments = [1,2,2,2];
  330. _ratio = GD.getRatioWithRotation(4.712389, ratio);
  331. for(var i=0;i<Lib_主变Node0_4points.length;i++){
  332. if(i%2==0){
  333. Lib_主变Node0_4compsPoints.push(Lib_主变Node0_4points[i]-Lib_主变Node0_4rect.x);
  334. }else{
  335. Lib_主变Node0_4compsPoints.push(Lib_主变Node0_4points[i]-Lib_主变Node0_4rect.y);
  336. }
  337. }
  338. var Lib_主变Node0_4 = new ht.Node();
  339. Lib_主变Node0_4.setImage(GD.getPolyGonJSON());
  340. Lib_主变Node0_4.setPosition(Lib_主变Node0_4rect.x + Lib_主变Node0_4rect.width/2, Lib_主变Node0_4rect.y + Lib_主变Node0_4rect.height/2);
  341. Lib_主变Node0_4.setSize(Lib_主变Node0_4rect.width, Lib_主变Node0_4rect.height);
  342. Lib_主变Node0_4.setRotation(4.712389);
  343. Lib_主变Node0_4.borderWidth=2;
  344. Lib_主变Node0_4.borderFillwidth=2*2;
  345. Lib_主变Node0_4.s({'pixelPerfect':true});
  346. dataModel.add(Lib_主变Node0_4);
  347. // Lib_主变Node0_4.a('node.width', Lib_主变Node0_4rect.width*_ratio.ratioX);
  348. // Lib_主变Node0_4.a('node.height', Lib_主变Node0_4rect.height*_ratio.ratioY);
  349. Lib_主变Node0_4.a('node.clip', function(g,width,height,data) {
  350. var clippoints = Lib_主变Node0_4SetPoints;
  351. if(clippoints.length<=3) return;
  352. if(Lib_主变Node0_4.a('Lib_主变Node0_4.isFill')=="false") return;
  353. var clipcompsPoints=[];
  354. var rect = ht.Default.unionPoint(clippoints);
  355. for(var i=0;i<clippoints.length;i++){
  356. clipcompsPoints.push({x:clippoints[i].x-rect.x,y:clippoints[i].y-rect.y});
  357. }
  358. var clipsegments=Lib_主变Node0_4setSegments;
  359. g.beginPath();
  360. drawPoints(g,clipcompsPoints,clipsegments);
  361. g.clip();
  362. })
  363. Lib_主变Node0_4.a('node.type', 'shape');
  364. Lib_主变Node0_4.a('node.comsPoints', Lib_主变Node0_4compsPoints);
  365. Lib_主变Node0_4.a('node.closePath', true);
  366. Lib_主变Node0_4.a('node.borderwidth', 2);
  367. Lib_主变Node0_4.a('node.color', 'rgba(255,128,0,1)');
  368. Lib_主变Node0_4.a('node.background','rgba(255,255,255,0.003921569)');
  369. Lib_主变Node0_4.a('node.closePath', true);
  370. Lib_主变Node0_4.a('node.closePath', true);
  371. Lib_主变Node0_4.a('node.gradient','');
  372. Lib_主变Node0_4.a('node.gradientcolor','');
  373. Lib_主变Node0_4.a('node.isFill','false');
  374. Lib_主变Node0_4.a('node.original',[0,0,0,0]);
  375. Lib_主变Node0_4.a('node.fillrect',[0,0,0,0]);
  376. Lib_主变Node0_4.a('node.fillbackcolor','rgba(255,255,255,0.003921569)');
  377. Lib_主变Node0_4.a('node.fillgradient','');
  378. Lib_主变Node0_4.a('node.fillgradientcolor','');
  379. Lib_主变Node0_4.a('node.segments',Lib_主变Node0_4setSegments);
  380. Lib_主变Node0_4.a('node.borderPattern',"");
  381. (function (node, nodecompsPoints, setPoints) {
  382. var w = node.getWidth()*_ratio.ratioX,
  383. h = node.getHeight()*_ratio.ratioY,
  384. img = node.getImage();
  385. function resetPoints(rx, ry) {
  386. for (var i = 0, len = nodecompsPoints.length; i < len; i++) {
  387. if (i%2 === 0) {
  388. nodecompsPoints[i]*=rx;
  389. } else {
  390. nodecompsPoints[i]*=ry;
  391. }
  392. if (setPoints[i]) {
  393. setPoints[i].x *= rx;
  394. setPoints[i].y *= ry;
  395. }
  396. }
  397. }
  398. node.setSize(w, h);
  399. node.a('node.width', w);
  400. node.a('node.height', h);
  401. resetPoints(_ratio.ratioX, _ratio.ratioY);
  402. var position = node.getPosition();
  403. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  404. node._nodename = 'Lib_主变Node0_4';
  405. node._nodeType = 'polygon';
  406. zoomNodeList.push({
  407. node: node,
  408. attr: 'node.borderwidth'
  409. });
  410. // 重载setWidth, setHeight
  411. var setWidth = node.setWidth,
  412. setHeight = node.setHeight,
  413. timer, rx = 1, ry = 1;
  414. node.setWidth = function (width) {
  415. var _width = this.getWidth();
  416. rx = width / _width;
  417. node.a('node.width', width);
  418. setWidth.apply(this, arguments);
  419. resetPoints(rx, 1);
  420. }
  421. node.setHeight = function (height) {
  422. var _height = this.getHeight();
  423. ry = height / _height;
  424. node.a('node.height', height);
  425. setHeight.apply(this, arguments);
  426. resetPoints(1, ry);
  427. }
  428. })(Lib_主变Node0_4, Lib_主变Node0_4compsPoints, Lib_主变Node0_4SetPoints );
  429. var Lib_主变Node0_5points=[37, 5,37, 13],
  430. Lib_主变Node0_5rect=ht.Default.unionPoint([{x:37,y:5},{x:37,y:13}]),
  431. Lib_主变Node0_5compspts=[];
  432. _ratio = GD.getRatioWithRotation(0, ratio);
  433. var _startratio = GD.getRatioWithRotation(4.71238898038469, ratio),
  434. _endratio = GD.getRatioWithRotation(7.85398163397448, ratio);
  435. for(var i=0;i<Lib_主变Node0_5points.length;i++){
  436. if(i%2==0){
  437. Lib_主变Node0_5compspts.push(Lib_主变Node0_5points[i]-Lib_主变Node0_5rect.x);
  438. }else{
  439. Lib_主变Node0_5compspts.push(Lib_主变Node0_5points[i]-Lib_主变Node0_5rect.y);
  440. }
  441. }
  442. var Lib_主变Node0_5ptslength=Lib_主变Node0_5compspts.length;
  443. if (Lib_主变Node0_5rect.height === 0) {
  444. Lib_主变Node0_5compspts[0] -= 0;
  445. Lib_主变Node0_5compspts[Lib_主变Node0_5ptslength-2] += 0;
  446. } else if (Lib_主变Node0_5rect.width === 0){
  447. Lib_主变Node0_5compspts[1] -= 0;
  448. Lib_主变Node0_5compspts[Lib_主变Node0_5ptslength-1] += 0;
  449. } else {
  450. Lib_主变Node0_5compspts[0] -= 0;
  451. Lib_主变Node0_5compspts[1] -= 0;
  452. Lib_主变Node0_5compspts[Lib_主变Node0_5ptslength-2] += 0;
  453. Lib_主变Node0_5compspts[Lib_主变Node0_5ptslength-1] += 0;
  454. }
  455. Lib_主变Node0_5 = new ht.Node();
  456. Lib_主变Node0_5.borderWidth = 2;
  457. Lib_主变Node0_5rect.width = Lib_主变Node0_5rect.width === 0 ? 0.0001 : Lib_主变Node0_5rect.width;
  458. Lib_主变Node0_5rect.height = Lib_主变Node0_5rect.height === 0 ? 0.0001 : Lib_主变Node0_5rect.height;
  459. var Lib_主变Node0_5endCompspts = [Lib_主变Node0_5compspts[Lib_主变Node0_5ptslength-2],Lib_主变Node0_5compspts[Lib_主变Node0_5ptslength-1],0,0];
  460. var Lib_主变Node0_5startCompspts = [Lib_主变Node0_5compspts[0],Lib_主变Node0_5compspts[1],0,0];
  461. Lib_主变Node0_5.setImage(GD.getPolyLineJSON());
  462. Lib_主变Node0_5.setPosition(Lib_主变Node0_5rect.x+Lib_主变Node0_5rect.width/2,Lib_主变Node0_5rect.y+Lib_主变Node0_5rect.height/2);
  463. Lib_主变Node0_5.setSize(Lib_主变Node0_5rect.width,Lib_主变Node0_5rect.height);
  464. Lib_主变Node0_5.setStyle("opacity",1);
  465. Lib_主变Node0_5.s({'pixelPerfect':true});
  466. Lib_主变Node0_5borderwidth=2;
  467. Lib_主变Node0_5.setRotation(0);
  468. dataModel.add(Lib_主变Node0_5);
  469. Lib_主变Node0_5.a('node.points',Lib_主变Node0_5compspts);
  470. Lib_主变Node0_5.a('node.segments',[1,2]);
  471. Lib_主变Node0_5.a('node.color','rgba(255,0,255,1)');
  472. Lib_主变Node0_5.a('node.borderPattern',getDashStyle("@borderPattern@"));
  473. Lib_主变Node0_5.a('node.borderColor','rgba(255,0,255,1)');
  474. Lib_主变Node0_5.a('node.background','rgba(255,0,255,1)');
  475. Lib_主变Node0_5.a('node.gradient','');
  476. Lib_主变Node0_5.a('node.gradientcolor','rgba(255,0,255,1)');
  477. Lib_主变Node0_5.a('node.endCompspts',Lib_主变Node0_5endCompspts);
  478. Lib_主变Node0_5.a('node.startCompspts',Lib_主变Node0_5startCompspts);
  479. (function (node, img, compspts, endCompspts, startCompspts) {
  480. var position = node.getPosition(),
  481. w = node.getWidth()*_ratio.ratioX,
  482. h = node.getHeight()*_ratio.ratioY;
  483. function resetPoints(rx, ry) {
  484. for (var i = 0, len = compspts.length; i < len; i++) {
  485. if (i%2 === 0) {
  486. compspts[i]*=rx;
  487. } else {
  488. compspts[i]*=ry;
  489. }
  490. }
  491. endCompspts[0] = compspts[compspts.length-2];
  492. endCompspts[1] = compspts[compspts.length-1];
  493. endCompspts[2] *= rx;
  494. endCompspts[3] *= ry;
  495. node.a('node.offsetEndY', -(endCompspts[3]*0.5));
  496. node.a('node.offsetEndX', -(endCompspts[2]*0.5));
  497. startCompspts[0] = compspts[0];
  498. startCompspts[1] = compspts[1];
  499. startCompspts[2] *= rx;
  500. startCompspts[3] *= ry;
  501. node.a('node.offsetStartY', -(startCompspts[3]*0.5));
  502. node.a('node.offsetStartX', -(startCompspts[2]*0.5));
  503. node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
  504. node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
  505. }
  506. node.setSize(w, h);
  507. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  508. node.a('node.width', w);
  509. node.a('node.height', h);
  510. resetPoints(_ratio.ratioX, _ratio.ratioY);
  511. node.borderWidth = 2;
  512. node.a('node.borderwidth',node.borderWidth);
  513. node._nodename = 'Lib_主变Node0_5';
  514. node._nodeType = 'line';
  515. zoomNodeList.push({
  516. node: node,
  517. attr: 'node.borderwidth'
  518. });
  519. var setWidth = node.setWidth,
  520. setHeight = node.setHeight,
  521. timer, rx = 1, ry = 1;
  522. node.setWidth = function (width) {
  523. var _width = this.getWidth();
  524. rx = width / _width;
  525. node.a('node.width', width);
  526. setWidth.apply(this, arguments);
  527. resetPoints(rx, 1);
  528. }
  529. node.setHeight = function (height) {
  530. var _height = this.getHeight();
  531. ry = height / _height;
  532. node.a('node.height', height);
  533. setHeight.apply(this, arguments);
  534. resetPoints(1, ry);
  535. }
  536. })(Lib_主变Node0_5, Lib_主变Node0_5.getImage(), Lib_主变Node0_5compspts, Lib_主变Node0_5endCompspts, Lib_主变Node0_5startCompspts);
  537. var Lib_主变Node0_6points=[37, 13,44, 18],
  538. Lib_主变Node0_6rect=ht.Default.unionPoint([{x:37,y:13},{x:44,y:18}]),
  539. Lib_主变Node0_6compspts=[];
  540. _ratio = GD.getRatioWithRotation(0, ratio);
  541. var _startratio = GD.getRatioWithRotation(3.76184215084917, ratio),
  542. _endratio = GD.getRatioWithRotation(0.620249497259376, ratio);
  543. for(var i=0;i<Lib_主变Node0_6points.length;i++){
  544. if(i%2==0){
  545. Lib_主变Node0_6compspts.push(Lib_主变Node0_6points[i]-Lib_主变Node0_6rect.x);
  546. }else{
  547. Lib_主变Node0_6compspts.push(Lib_主变Node0_6points[i]-Lib_主变Node0_6rect.y);
  548. }
  549. }
  550. var Lib_主变Node0_6ptslength=Lib_主变Node0_6compspts.length;
  551. if (Lib_主变Node0_6rect.height === 0) {
  552. Lib_主变Node0_6compspts[0] -= 0;
  553. Lib_主变Node0_6compspts[Lib_主变Node0_6ptslength-2] += 0;
  554. } else if (Lib_主变Node0_6rect.width === 0){
  555. Lib_主变Node0_6compspts[1] -= 0;
  556. Lib_主变Node0_6compspts[Lib_主变Node0_6ptslength-1] += 0;
  557. } else {
  558. Lib_主变Node0_6compspts[0] -= 0;
  559. Lib_主变Node0_6compspts[1] -= 0;
  560. Lib_主变Node0_6compspts[Lib_主变Node0_6ptslength-2] += 0;
  561. Lib_主变Node0_6compspts[Lib_主变Node0_6ptslength-1] += 0;
  562. }
  563. Lib_主变Node0_6 = new ht.Node();
  564. Lib_主变Node0_6.borderWidth = 2;
  565. Lib_主变Node0_6rect.width = Lib_主变Node0_6rect.width === 0 ? 0.0001 : Lib_主变Node0_6rect.width;
  566. Lib_主变Node0_6rect.height = Lib_主变Node0_6rect.height === 0 ? 0.0001 : Lib_主变Node0_6rect.height;
  567. var Lib_主变Node0_6endCompspts = [Lib_主变Node0_6compspts[Lib_主变Node0_6ptslength-2],Lib_主变Node0_6compspts[Lib_主变Node0_6ptslength-1],0,0];
  568. var Lib_主变Node0_6startCompspts = [Lib_主变Node0_6compspts[0],Lib_主变Node0_6compspts[1],0,0];
  569. Lib_主变Node0_6.setImage(GD.getPolyLineJSON());
  570. Lib_主变Node0_6.setPosition(Lib_主变Node0_6rect.x+Lib_主变Node0_6rect.width/2,Lib_主变Node0_6rect.y+Lib_主变Node0_6rect.height/2);
  571. Lib_主变Node0_6.setSize(Lib_主变Node0_6rect.width,Lib_主变Node0_6rect.height);
  572. Lib_主变Node0_6.setStyle("opacity",1);
  573. Lib_主变Node0_6.s({'pixelPerfect':true});
  574. Lib_主变Node0_6borderwidth=2;
  575. Lib_主变Node0_6.setRotation(0);
  576. dataModel.add(Lib_主变Node0_6);
  577. Lib_主变Node0_6.a('node.points',Lib_主变Node0_6compspts);
  578. Lib_主变Node0_6.a('node.segments',[1,2]);
  579. Lib_主变Node0_6.a('node.color','rgba(255,0,255,1)');
  580. Lib_主变Node0_6.a('node.borderPattern',getDashStyle("@borderPattern@"));
  581. Lib_主变Node0_6.a('node.borderColor','rgba(255,0,255,1)');
  582. Lib_主变Node0_6.a('node.background','rgba(255,0,255,1)');
  583. Lib_主变Node0_6.a('node.gradient','');
  584. Lib_主变Node0_6.a('node.gradientcolor','rgba(255,0,255,1)');
  585. Lib_主变Node0_6.a('node.endCompspts',Lib_主变Node0_6endCompspts);
  586. Lib_主变Node0_6.a('node.startCompspts',Lib_主变Node0_6startCompspts);
  587. (function (node, img, compspts, endCompspts, startCompspts) {
  588. var position = node.getPosition(),
  589. w = node.getWidth()*_ratio.ratioX,
  590. h = node.getHeight()*_ratio.ratioY;
  591. function resetPoints(rx, ry) {
  592. for (var i = 0, len = compspts.length; i < len; i++) {
  593. if (i%2 === 0) {
  594. compspts[i]*=rx;
  595. } else {
  596. compspts[i]*=ry;
  597. }
  598. }
  599. endCompspts[0] = compspts[compspts.length-2];
  600. endCompspts[1] = compspts[compspts.length-1];
  601. endCompspts[2] *= rx;
  602. endCompspts[3] *= ry;
  603. node.a('node.offsetEndY', -(endCompspts[3]*0.5));
  604. node.a('node.offsetEndX', -(endCompspts[2]*0.5));
  605. startCompspts[0] = compspts[0];
  606. startCompspts[1] = compspts[1];
  607. startCompspts[2] *= rx;
  608. startCompspts[3] *= ry;
  609. node.a('node.offsetStartY', -(startCompspts[3]*0.5));
  610. node.a('node.offsetStartX', -(startCompspts[2]*0.5));
  611. node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
  612. node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
  613. }
  614. node.setSize(w, h);
  615. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  616. node.a('node.width', w);
  617. node.a('node.height', h);
  618. resetPoints(_ratio.ratioX, _ratio.ratioY);
  619. node.borderWidth = 2;
  620. node.a('node.borderwidth',node.borderWidth);
  621. node._nodename = 'Lib_主变Node0_6';
  622. node._nodeType = 'line';
  623. zoomNodeList.push({
  624. node: node,
  625. attr: 'node.borderwidth'
  626. });
  627. var setWidth = node.setWidth,
  628. setHeight = node.setHeight,
  629. timer, rx = 1, ry = 1;
  630. node.setWidth = function (width) {
  631. var _width = this.getWidth();
  632. rx = width / _width;
  633. node.a('node.width', width);
  634. setWidth.apply(this, arguments);
  635. resetPoints(rx, 1);
  636. }
  637. node.setHeight = function (height) {
  638. var _height = this.getHeight();
  639. ry = height / _height;
  640. node.a('node.height', height);
  641. setHeight.apply(this, arguments);
  642. resetPoints(1, ry);
  643. }
  644. })(Lib_主变Node0_6, Lib_主变Node0_6.getImage(), Lib_主变Node0_6compspts, Lib_主变Node0_6endCompspts, Lib_主变Node0_6startCompspts);
  645. var Lib_主变Node0_7points=[37, 13,29, 18],
  646. Lib_主变Node0_7rect=ht.Default.unionPoint([{x:37,y:13},{x:29,y:18}]),
  647. Lib_主变Node0_7compspts=[];
  648. _ratio = GD.getRatioWithRotation(0, ratio);
  649. var _startratio = GD.getRatioWithRotation(-0.558599315343562, ratio),
  650. _endratio = GD.getRatioWithRotation(2.58299333824623, ratio);
  651. for(var i=0;i<Lib_主变Node0_7points.length;i++){
  652. if(i%2==0){
  653. Lib_主变Node0_7compspts.push(Lib_主变Node0_7points[i]-Lib_主变Node0_7rect.x);
  654. }else{
  655. Lib_主变Node0_7compspts.push(Lib_主变Node0_7points[i]-Lib_主变Node0_7rect.y);
  656. }
  657. }
  658. var Lib_主变Node0_7ptslength=Lib_主变Node0_7compspts.length;
  659. if (Lib_主变Node0_7rect.height === 0) {
  660. Lib_主变Node0_7compspts[0] -= 0;
  661. Lib_主变Node0_7compspts[Lib_主变Node0_7ptslength-2] += 0;
  662. } else if (Lib_主变Node0_7rect.width === 0){
  663. Lib_主变Node0_7compspts[1] -= 0;
  664. Lib_主变Node0_7compspts[Lib_主变Node0_7ptslength-1] += 0;
  665. } else {
  666. Lib_主变Node0_7compspts[0] -= 0;
  667. Lib_主变Node0_7compspts[1] -= 0;
  668. Lib_主变Node0_7compspts[Lib_主变Node0_7ptslength-2] += 0;
  669. Lib_主变Node0_7compspts[Lib_主变Node0_7ptslength-1] += 0;
  670. }
  671. Lib_主变Node0_7 = new ht.Node();
  672. Lib_主变Node0_7.borderWidth = 2;
  673. Lib_主变Node0_7rect.width = Lib_主变Node0_7rect.width === 0 ? 0.0001 : Lib_主变Node0_7rect.width;
  674. Lib_主变Node0_7rect.height = Lib_主变Node0_7rect.height === 0 ? 0.0001 : Lib_主变Node0_7rect.height;
  675. var Lib_主变Node0_7endCompspts = [Lib_主变Node0_7compspts[Lib_主变Node0_7ptslength-2],Lib_主变Node0_7compspts[Lib_主变Node0_7ptslength-1],0,0];
  676. var Lib_主变Node0_7startCompspts = [Lib_主变Node0_7compspts[0],Lib_主变Node0_7compspts[1],0,0];
  677. Lib_主变Node0_7.setImage(GD.getPolyLineJSON());
  678. Lib_主变Node0_7.setPosition(Lib_主变Node0_7rect.x+Lib_主变Node0_7rect.width/2,Lib_主变Node0_7rect.y+Lib_主变Node0_7rect.height/2);
  679. Lib_主变Node0_7.setSize(Lib_主变Node0_7rect.width,Lib_主变Node0_7rect.height);
  680. Lib_主变Node0_7.setStyle("opacity",1);
  681. Lib_主变Node0_7.s({'pixelPerfect':true});
  682. Lib_主变Node0_7borderwidth=2;
  683. Lib_主变Node0_7.setRotation(0);
  684. dataModel.add(Lib_主变Node0_7);
  685. Lib_主变Node0_7.a('node.points',Lib_主变Node0_7compspts);
  686. Lib_主变Node0_7.a('node.segments',[1,2]);
  687. Lib_主变Node0_7.a('node.color','rgba(255,0,255,1)');
  688. Lib_主变Node0_7.a('node.borderPattern',getDashStyle("@borderPattern@"));
  689. Lib_主变Node0_7.a('node.borderColor','rgba(255,0,255,1)');
  690. Lib_主变Node0_7.a('node.background','rgba(255,0,255,1)');
  691. Lib_主变Node0_7.a('node.gradient','');
  692. Lib_主变Node0_7.a('node.gradientcolor','rgba(255,0,255,1)');
  693. Lib_主变Node0_7.a('node.endCompspts',Lib_主变Node0_7endCompspts);
  694. Lib_主变Node0_7.a('node.startCompspts',Lib_主变Node0_7startCompspts);
  695. (function (node, img, compspts, endCompspts, startCompspts) {
  696. var position = node.getPosition(),
  697. w = node.getWidth()*_ratio.ratioX,
  698. h = node.getHeight()*_ratio.ratioY;
  699. function resetPoints(rx, ry) {
  700. for (var i = 0, len = compspts.length; i < len; i++) {
  701. if (i%2 === 0) {
  702. compspts[i]*=rx;
  703. } else {
  704. compspts[i]*=ry;
  705. }
  706. }
  707. endCompspts[0] = compspts[compspts.length-2];
  708. endCompspts[1] = compspts[compspts.length-1];
  709. endCompspts[2] *= rx;
  710. endCompspts[3] *= ry;
  711. node.a('node.offsetEndY', -(endCompspts[3]*0.5));
  712. node.a('node.offsetEndX', -(endCompspts[2]*0.5));
  713. startCompspts[0] = compspts[0];
  714. startCompspts[1] = compspts[1];
  715. startCompspts[2] *= rx;
  716. startCompspts[3] *= ry;
  717. node.a('node.offsetStartY', -(startCompspts[3]*0.5));
  718. node.a('node.offsetStartX', -(startCompspts[2]*0.5));
  719. node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
  720. node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
  721. }
  722. node.setSize(w, h);
  723. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  724. node.a('node.width', w);
  725. node.a('node.height', h);
  726. resetPoints(_ratio.ratioX, _ratio.ratioY);
  727. node.borderWidth = 2;
  728. node.a('node.borderwidth',node.borderWidth);
  729. node._nodename = 'Lib_主变Node0_7';
  730. node._nodeType = 'line';
  731. zoomNodeList.push({
  732. node: node,
  733. attr: 'node.borderwidth'
  734. });
  735. var setWidth = node.setWidth,
  736. setHeight = node.setHeight,
  737. timer, rx = 1, ry = 1;
  738. node.setWidth = function (width) {
  739. var _width = this.getWidth();
  740. rx = width / _width;
  741. node.a('node.width', width);
  742. setWidth.apply(this, arguments);
  743. resetPoints(rx, 1);
  744. }
  745. node.setHeight = function (height) {
  746. var _height = this.getHeight();
  747. ry = height / _height;
  748. node.a('node.height', height);
  749. setHeight.apply(this, arguments);
  750. resetPoints(1, ry);
  751. }
  752. })(Lib_主变Node0_7, Lib_主变Node0_7.getImage(), Lib_主变Node0_7compspts, Lib_主变Node0_7endCompspts, Lib_主变Node0_7startCompspts);
  753. var Lib_主变Node0_8_0points=[9, 35,64, 3],
  754. Lib_主变Node0_8_0rect=ht.Default.unionPoint([{x:9,y:35},{x:64,y:3}]),
  755. Lib_主变Node0_8_0compspts=[];
  756. _ratio = GD.getRatioWithRotation(0, ratio);
  757. var _startratio = GD.getRatioWithRotation(2.61464944016434, ratio),
  758. _endratio = GD.getRatioWithRotation(-0.526943213425453, ratio);
  759. for(var i=0;i<Lib_主变Node0_8_0points.length;i++){
  760. if(i%2==0){
  761. Lib_主变Node0_8_0compspts.push(Lib_主变Node0_8_0points[i]-Lib_主变Node0_8_0rect.x);
  762. }else{
  763. Lib_主变Node0_8_0compspts.push(Lib_主变Node0_8_0points[i]-Lib_主变Node0_8_0rect.y);
  764. }
  765. }
  766. var Lib_主变Node0_8_0ptslength=Lib_主变Node0_8_0compspts.length;
  767. if (Lib_主变Node0_8_0rect.height === 0) {
  768. Lib_主变Node0_8_0compspts[0] -= 0;
  769. Lib_主变Node0_8_0compspts[Lib_主变Node0_8_0ptslength-2] += 0;
  770. } else if (Lib_主变Node0_8_0rect.width === 0){
  771. Lib_主变Node0_8_0compspts[1] -= 0;
  772. Lib_主变Node0_8_0compspts[Lib_主变Node0_8_0ptslength-1] += 0;
  773. } else {
  774. Lib_主变Node0_8_0compspts[0] -= 0;
  775. Lib_主变Node0_8_0compspts[1] -= 0;
  776. Lib_主变Node0_8_0compspts[Lib_主变Node0_8_0ptslength-2] += 0;
  777. Lib_主变Node0_8_0compspts[Lib_主变Node0_8_0ptslength-1] += 0;
  778. }
  779. Lib_主变Node0_8_0 = new ht.Node();
  780. Lib_主变Node0_8_0.borderWidth = 2;
  781. Lib_主变Node0_8_0rect.width = Lib_主变Node0_8_0rect.width === 0 ? 0.0001 : Lib_主变Node0_8_0rect.width;
  782. Lib_主变Node0_8_0rect.height = Lib_主变Node0_8_0rect.height === 0 ? 0.0001 : Lib_主变Node0_8_0rect.height;
  783. var Lib_主变Node0_8_0endCompspts = [Lib_主变Node0_8_0compspts[Lib_主变Node0_8_0ptslength-2],Lib_主变Node0_8_0compspts[Lib_主变Node0_8_0ptslength-1],0,0];
  784. var Lib_主变Node0_8_0startCompspts = [Lib_主变Node0_8_0compspts[0],Lib_主变Node0_8_0compspts[1],0,0];
  785. Lib_主变Node0_8_0.setImage(GD.getPolyLineJSON());
  786. Lib_主变Node0_8_0.setPosition(Lib_主变Node0_8_0rect.x+Lib_主变Node0_8_0rect.width/2,Lib_主变Node0_8_0rect.y+Lib_主变Node0_8_0rect.height/2);
  787. Lib_主变Node0_8_0.setSize(Lib_主变Node0_8_0rect.width,Lib_主变Node0_8_0rect.height);
  788. Lib_主变Node0_8_0.setStyle("opacity",1);
  789. Lib_主变Node0_8_0.s({'pixelPerfect':true});
  790. Lib_主变Node0_8_0borderwidth=2;
  791. Lib_主变Node0_8_0.setRotation(0);
  792. dataModel.add(Lib_主变Node0_8_0);
  793. Lib_主变Node0_8_0.a('node.points',Lib_主变Node0_8_0compspts);
  794. Lib_主变Node0_8_0.a('node.segments',[1,2]);
  795. Lib_主变Node0_8_0.a('node.color','rgba(255,0,255,1)');
  796. Lib_主变Node0_8_0.a('node.borderPattern',getDashStyle("@borderPattern@"));
  797. Lib_主变Node0_8_0.a('node.borderColor','rgba(255,0,255,1)');
  798. Lib_主变Node0_8_0.a('node.background','rgba(255,0,255,1)');
  799. Lib_主变Node0_8_0.a('node.gradient','');
  800. Lib_主变Node0_8_0.a('node.gradientcolor','rgba(255,0,255,1)');
  801. Lib_主变Node0_8_0.a('node.endCompspts',Lib_主变Node0_8_0endCompspts);
  802. Lib_主变Node0_8_0.a('node.startCompspts',Lib_主变Node0_8_0startCompspts);
  803. (function (node, img, compspts, endCompspts, startCompspts) {
  804. var position = node.getPosition(),
  805. w = node.getWidth()*_ratio.ratioX,
  806. h = node.getHeight()*_ratio.ratioY;
  807. function resetPoints(rx, ry) {
  808. for (var i = 0, len = compspts.length; i < len; i++) {
  809. if (i%2 === 0) {
  810. compspts[i]*=rx;
  811. } else {
  812. compspts[i]*=ry;
  813. }
  814. }
  815. endCompspts[0] = compspts[compspts.length-2];
  816. endCompspts[1] = compspts[compspts.length-1];
  817. endCompspts[2] *= rx;
  818. endCompspts[3] *= ry;
  819. node.a('node.offsetEndY', -(endCompspts[3]*0.5));
  820. node.a('node.offsetEndX', -(endCompspts[2]*0.5));
  821. startCompspts[0] = compspts[0];
  822. startCompspts[1] = compspts[1];
  823. startCompspts[2] *= rx;
  824. startCompspts[3] *= ry;
  825. node.a('node.offsetStartY', -(startCompspts[3]*0.5));
  826. node.a('node.offsetStartX', -(startCompspts[2]*0.5));
  827. node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
  828. node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
  829. }
  830. node.setSize(w, h);
  831. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  832. node.a('node.width', w);
  833. node.a('node.height', h);
  834. resetPoints(_ratio.ratioX, _ratio.ratioY);
  835. node.borderWidth = 2;
  836. node.a('node.borderwidth',node.borderWidth);
  837. node._nodename = 'Lib_主变Node0_8_0';
  838. node._nodeType = 'line';
  839. zoomNodeList.push({
  840. node: node,
  841. attr: 'node.borderwidth'
  842. });
  843. var setWidth = node.setWidth,
  844. setHeight = node.setHeight,
  845. timer, rx = 1, ry = 1;
  846. node.setWidth = function (width) {
  847. var _width = this.getWidth();
  848. rx = width / _width;
  849. node.a('node.width', width);
  850. setWidth.apply(this, arguments);
  851. resetPoints(rx, 1);
  852. }
  853. node.setHeight = function (height) {
  854. var _height = this.getHeight();
  855. ry = height / _height;
  856. node.a('node.height', height);
  857. setHeight.apply(this, arguments);
  858. resetPoints(1, ry);
  859. }
  860. })(Lib_主变Node0_8_0, Lib_主变Node0_8_0.getImage(), Lib_主变Node0_8_0compspts, Lib_主变Node0_8_0endCompspts, Lib_主变Node0_8_0startCompspts);
  861. var Lib_主变Node0_8_1rect=ht.Default.unionPoint([{x: 56, y: 1},{x: 56, y: 1},{x: 65, y: 0},{x: 60, y: 10}]),
  862. Lib_主变Node0_8_1points=[56,1,56,1,65,0,60,10],
  863. Lib_主变Node0_8_1compsPoints=[],
  864. Lib_主变Node0_8_1SetPoints = [{x: 56, y: 1},{x: 56, y: 1},{x: 65, y: 0},{x: 60, y: 10}],
  865. Lib_主变Node0_8_1setSegments = [1,2,2,2];
  866. _ratio = GD.getRatioWithRotation(4.101523, ratio);
  867. for(var i=0;i<Lib_主变Node0_8_1points.length;i++){
  868. if(i%2==0){
  869. Lib_主变Node0_8_1compsPoints.push(Lib_主变Node0_8_1points[i]-Lib_主变Node0_8_1rect.x);
  870. }else{
  871. Lib_主变Node0_8_1compsPoints.push(Lib_主变Node0_8_1points[i]-Lib_主变Node0_8_1rect.y);
  872. }
  873. }
  874. var Lib_主变Node0_8_1 = new ht.Node();
  875. Lib_主变Node0_8_1.setImage(GD.getPolyGonJSON());
  876. Lib_主变Node0_8_1.setPosition(Lib_主变Node0_8_1rect.x + Lib_主变Node0_8_1rect.width/2, Lib_主变Node0_8_1rect.y + Lib_主变Node0_8_1rect.height/2);
  877. Lib_主变Node0_8_1.setSize(Lib_主变Node0_8_1rect.width, Lib_主变Node0_8_1rect.height);
  878. Lib_主变Node0_8_1.setRotation(4.101523);
  879. Lib_主变Node0_8_1.borderWidth=2;
  880. Lib_主变Node0_8_1.borderFillwidth=2*2;
  881. Lib_主变Node0_8_1.s({'pixelPerfect':true});
  882. dataModel.add(Lib_主变Node0_8_1);
  883. // Lib_主变Node0_8_1.a('node.width', Lib_主变Node0_8_1rect.width*_ratio.ratioX);
  884. // Lib_主变Node0_8_1.a('node.height', Lib_主变Node0_8_1rect.height*_ratio.ratioY);
  885. Lib_主变Node0_8_1.a('node.clip', function(g,width,height,data) {
  886. var clippoints = Lib_主变Node0_8_1SetPoints;
  887. if(clippoints.length<=3) return;
  888. if(Lib_主变Node0_8_1.a('Lib_主变Node0_8_1.isFill')=="false") return;
  889. var clipcompsPoints=[];
  890. var rect = ht.Default.unionPoint(clippoints);
  891. for(var i=0;i<clippoints.length;i++){
  892. clipcompsPoints.push({x:clippoints[i].x-rect.x,y:clippoints[i].y-rect.y});
  893. }
  894. var clipsegments=Lib_主变Node0_8_1setSegments;
  895. g.beginPath();
  896. drawPoints(g,clipcompsPoints,clipsegments);
  897. g.clip();
  898. })
  899. Lib_主变Node0_8_1.a('node.type', 'shape');
  900. Lib_主变Node0_8_1.a('node.comsPoints', Lib_主变Node0_8_1compsPoints);
  901. Lib_主变Node0_8_1.a('node.closePath', true);
  902. Lib_主变Node0_8_1.a('node.borderwidth', 2);
  903. Lib_主变Node0_8_1.a('node.color', 'rgba(255,0,255,1)');
  904. Lib_主变Node0_8_1.a('node.background','rgba(255,0,255,1)');
  905. Lib_主变Node0_8_1.a('node.closePath', true);
  906. Lib_主变Node0_8_1.a('node.closePath', true);
  907. Lib_主变Node0_8_1.a('node.gradient','');
  908. Lib_主变Node0_8_1.a('node.gradientcolor','rgba(255,0,255,1)');
  909. Lib_主变Node0_8_1.a('node.isFill','false');
  910. Lib_主变Node0_8_1.a('node.original',[0,0,0,0]);
  911. Lib_主变Node0_8_1.a('node.fillrect',[0,0,0,0]);
  912. Lib_主变Node0_8_1.a('node.fillbackcolor','rgba(255,0,255,1)');
  913. Lib_主变Node0_8_1.a('node.fillgradient','');
  914. Lib_主变Node0_8_1.a('node.fillgradientcolor','rgba(255,0,255,1)');
  915. Lib_主变Node0_8_1.a('node.segments',Lib_主变Node0_8_1setSegments);
  916. Lib_主变Node0_8_1.a('node.borderPattern',"");
  917. (function (node, nodecompsPoints, setPoints) {
  918. var w = node.getWidth()*_ratio.ratioX,
  919. h = node.getHeight()*_ratio.ratioY,
  920. img = node.getImage();
  921. function resetPoints(rx, ry) {
  922. for (var i = 0, len = nodecompsPoints.length; i < len; i++) {
  923. if (i%2 === 0) {
  924. nodecompsPoints[i]*=rx;
  925. } else {
  926. nodecompsPoints[i]*=ry;
  927. }
  928. if (setPoints[i]) {
  929. setPoints[i].x *= rx;
  930. setPoints[i].y *= ry;
  931. }
  932. }
  933. }
  934. node.setSize(w, h);
  935. node.a('node.width', w);
  936. node.a('node.height', h);
  937. resetPoints(_ratio.ratioX, _ratio.ratioY);
  938. var position = node.getPosition();
  939. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  940. node._nodename = 'Lib_主变Node0_8_1';
  941. node._nodeType = 'polygon';
  942. zoomNodeList.push({
  943. node: node,
  944. attr: 'node.borderwidth'
  945. });
  946. // 重载setWidth, setHeight
  947. var setWidth = node.setWidth,
  948. setHeight = node.setHeight,
  949. timer, rx = 1, ry = 1;
  950. node.setWidth = function (width) {
  951. var _width = this.getWidth();
  952. rx = width / _width;
  953. node.a('node.width', width);
  954. setWidth.apply(this, arguments);
  955. resetPoints(rx, 1);
  956. }
  957. node.setHeight = function (height) {
  958. var _height = this.getHeight();
  959. ry = height / _height;
  960. node.a('node.height', height);
  961. setHeight.apply(this, arguments);
  962. resetPoints(1, ry);
  963. }
  964. })(Lib_主变Node0_8_1, Lib_主变Node0_8_1compsPoints, Lib_主变Node0_8_1SetPoints );
  965. /*@GraphList@*/
  966. /*@PageInit@*/
  967. var localVarObj = this.localVarObj;
  968. var localDynamicVarObj = this.localDynamicVar();
  969. this['Lib_主变Node0_0'] = Lib_主变Node0_0;
  970. Lib_主变Node0_0.__parentLib = nodename;
  971. Lib_主变Node0_0.__parent = this;
  972. this.childNodes.push(Lib_主变Node0_0);
  973. this['Lib_主变Node0_1'] = Lib_主变Node0_1;
  974. Lib_主变Node0_1.__parentLib = nodename;
  975. Lib_主变Node0_1.__parent = this;
  976. this.childNodes.push(Lib_主变Node0_1);
  977. this['Lib_主变Node0_2'] = Lib_主变Node0_2;
  978. Lib_主变Node0_2.__parentLib = nodename;
  979. Lib_主变Node0_2.__parent = this;
  980. this.childNodes.push(Lib_主变Node0_2);
  981. this['Lib_主变Node0_3'] = Lib_主变Node0_3;
  982. Lib_主变Node0_3.__parentLib = nodename;
  983. Lib_主变Node0_3.__parent = this;
  984. this.childNodes.push(Lib_主变Node0_3);
  985. this['Lib_主变Node0_4'] = Lib_主变Node0_4;
  986. Lib_主变Node0_4.__parentLib = nodename;
  987. Lib_主变Node0_4.__parent = this;
  988. this.childNodes.push(Lib_主变Node0_4);
  989. this['Lib_主变Node0_5'] = Lib_主变Node0_5;
  990. Lib_主变Node0_5.__parentLib = nodename;
  991. Lib_主变Node0_5.__parent = this;
  992. this.childNodes.push(Lib_主变Node0_5);
  993. this['Lib_主变Node0_6'] = Lib_主变Node0_6;
  994. Lib_主变Node0_6.__parentLib = nodename;
  995. Lib_主变Node0_6.__parent = this;
  996. this.childNodes.push(Lib_主变Node0_6);
  997. this['Lib_主变Node0_7'] = Lib_主变Node0_7;
  998. Lib_主变Node0_7.__parentLib = nodename;
  999. Lib_主变Node0_7.__parent = this;
  1000. this.childNodes.push(Lib_主变Node0_7);
  1001. this['Lib_主变Node0_8_0'] = Lib_主变Node0_8_0;
  1002. Lib_主变Node0_8_0.__parentLib = nodename;
  1003. Lib_主变Node0_8_0.__parent = this;
  1004. this.childNodes.push(Lib_主变Node0_8_0);
  1005. this['Lib_主变Node0_8_1'] = Lib_主变Node0_8_1;
  1006. Lib_主变Node0_8_1.__parentLib = nodename;
  1007. Lib_主变Node0_8_1.__parent = this;
  1008. this.childNodes.push(Lib_主变Node0_8_1);
  1009. /*@ControlContextMenu@*/
  1010. /*@Declare@*/
  1011. this.init(x, y, width, height, angle);
  1012. };
  1013. ht.Default.def('ht.lib.主变', Object, {
  1014. refresh10ms: function () {
  1015. var localVarObj = this.localVarObj;
  1016. var localDynamicVarObj = this.localDynamicVar();
  1017. var Lib_主变Node0_0= this.Lib_主变Node0_0;
  1018. var Lib_主变Node0_1= this.Lib_主变Node0_1;
  1019. var Lib_主变Node0_2= this.Lib_主变Node0_2;
  1020. var Lib_主变Node0_3= this.Lib_主变Node0_3;
  1021. var Lib_主变Node0_4= this.Lib_主变Node0_4;
  1022. var Lib_主变Node0_5= this.Lib_主变Node0_5;
  1023. var Lib_主变Node0_6= this.Lib_主变Node0_6;
  1024. var Lib_主变Node0_7= this.Lib_主变Node0_7;
  1025. var Lib_主变Node0_8_0= this.Lib_主变Node0_8_0;
  1026. var Lib_主变Node0_8_1= this.Lib_主变Node0_8_1;
  1027. /*@refresh10ms@*/
  1028. },
  1029. refresh100ms: function () {
  1030. var localVarObj = this.localVarObj;
  1031. var localDynamicVarObj = this.localDynamicVar();
  1032. var Lib_主变Node0_0= this.Lib_主变Node0_0;
  1033. var Lib_主变Node0_1= this.Lib_主变Node0_1;
  1034. var Lib_主变Node0_2= this.Lib_主变Node0_2;
  1035. var Lib_主变Node0_3= this.Lib_主变Node0_3;
  1036. var Lib_主变Node0_4= this.Lib_主变Node0_4;
  1037. var Lib_主变Node0_5= this.Lib_主变Node0_5;
  1038. var Lib_主变Node0_6= this.Lib_主变Node0_6;
  1039. var Lib_主变Node0_7= this.Lib_主变Node0_7;
  1040. var Lib_主变Node0_8_0= this.Lib_主变Node0_8_0;
  1041. var Lib_主变Node0_8_1= this.Lib_主变Node0_8_1;
  1042. /*@refresh100ms@*/
  1043. },
  1044. refresh500ms: function () {
  1045. var localVarObj = this.localVarObj;
  1046. var localDynamicVarObj = this.localDynamicVar();
  1047. var Lib_主变Node0_0= this.Lib_主变Node0_0;
  1048. var Lib_主变Node0_1= this.Lib_主变Node0_1;
  1049. var Lib_主变Node0_2= this.Lib_主变Node0_2;
  1050. var Lib_主变Node0_3= this.Lib_主变Node0_3;
  1051. var Lib_主变Node0_4= this.Lib_主变Node0_4;
  1052. var Lib_主变Node0_5= this.Lib_主变Node0_5;
  1053. var Lib_主变Node0_6= this.Lib_主变Node0_6;
  1054. var Lib_主变Node0_7= this.Lib_主变Node0_7;
  1055. var Lib_主变Node0_8_0= this.Lib_主变Node0_8_0;
  1056. var Lib_主变Node0_8_1= this.Lib_主变Node0_8_1;
  1057. /*@refresh500ms@*/
  1058. },
  1059. refresh1s: function () {
  1060. var Counter1s = arguments[0] || 0;
  1061. var localVarObj = this.localVarObj;
  1062. var localDynamicVarObj = this.localDynamicVar();
  1063. var Lib_主变Node0_0= this.Lib_主变Node0_0;
  1064. var Lib_主变Node0_1= this.Lib_主变Node0_1;
  1065. var Lib_主变Node0_2= this.Lib_主变Node0_2;
  1066. var Lib_主变Node0_3= this.Lib_主变Node0_3;
  1067. var Lib_主变Node0_4= this.Lib_主变Node0_4;
  1068. var Lib_主变Node0_5= this.Lib_主变Node0_5;
  1069. var Lib_主变Node0_6= this.Lib_主变Node0_6;
  1070. var Lib_主变Node0_7= this.Lib_主变Node0_7;
  1071. var Lib_主变Node0_8_0= this.Lib_主变Node0_8_0;
  1072. var Lib_主变Node0_8_1= this.Lib_主变Node0_8_1;
  1073. /*@refresh1s@*/
  1074. },
  1075. refresh5s: function () {
  1076. var localVarObj = this.localVarObj;
  1077. var localDynamicVarObj = this.localDynamicVar();
  1078. var Lib_主变Node0_0= this.Lib_主变Node0_0;
  1079. var Lib_主变Node0_1= this.Lib_主变Node0_1;
  1080. var Lib_主变Node0_2= this.Lib_主变Node0_2;
  1081. var Lib_主变Node0_3= this.Lib_主变Node0_3;
  1082. var Lib_主变Node0_4= this.Lib_主变Node0_4;
  1083. var Lib_主变Node0_5= this.Lib_主变Node0_5;
  1084. var Lib_主变Node0_6= this.Lib_主变Node0_6;
  1085. var Lib_主变Node0_7= this.Lib_主变Node0_7;
  1086. var Lib_主变Node0_8_0= this.Lib_主变Node0_8_0;
  1087. var Lib_主变Node0_8_1= this.Lib_主变Node0_8_1;
  1088. /*@refresh5s@*/
  1089. },
  1090. /*@PageDynamic@*/
  1091. onEvent: function (e, data, type, origin, offset, objMouseOn, ctm) {
  1092. var localVarObj = this.localVarObj;
  1093. var localDynamicVarObj = this.localDynamicVar();
  1094. var Lib_主变Node0_0= this.Lib_主变Node0_0;
  1095. var Lib_主变Node0_1= this.Lib_主变Node0_1;
  1096. var Lib_主变Node0_2= this.Lib_主变Node0_2;
  1097. var Lib_主变Node0_3= this.Lib_主变Node0_3;
  1098. var Lib_主变Node0_4= this.Lib_主变Node0_4;
  1099. var Lib_主变Node0_5= this.Lib_主变Node0_5;
  1100. var Lib_主变Node0_6= this.Lib_主变Node0_6;
  1101. var Lib_主变Node0_7= this.Lib_主变Node0_7;
  1102. var Lib_主变Node0_8_0= this.Lib_主变Node0_8_0;
  1103. var Lib_主变Node0_8_1= this.Lib_主变Node0_8_1;
  1104. if (type === 'click') {
  1105. /*@EvnentClicked@*/
  1106. } else if (type === 'mousedown') {
  1107. mouseX=e.clientX;
  1108. mouseY=e.clientY;
  1109. /*@EvnentMouseDown@*/
  1110. } else if (type === 'mouseup') {
  1111. /*@EvnentMouseUp@*/
  1112. } else if (type === 'mousemove') {
  1113. var mouseX, mouseY, position, zoom;
  1114. position=origin.getLogicalPoint(e);
  1115. zoom = graphView.getZoom();
  1116. if (origin === graphView) {
  1117. mouseX= position.x + origin.tx();
  1118. mouseY = position.y + origin.ty();
  1119. } else {
  1120. offset = offset || {x: 0, y: 0};
  1121. mouseX = position.x / zoom + offset.x + origin.tx();
  1122. mouseY = position.y / zoom + offset.y + origin.ty();
  1123. }
  1124. /*@EvnentMouseLeave@*/
  1125. /*@EvnentMouseOver@*/
  1126. } else if (type === 'keydown') {
  1127. /*@EvnentKeyDown@*/
  1128. } else if (type === 'contextmenu') {
  1129. /*@Declare@*/
  1130. /*@SetNodeContextMenu@*/
  1131. /*@SetPageContextMenu@*/
  1132. }
  1133. /*@LibEvent@*/
  1134. },
  1135. getBaseClass: function () {
  1136. return this._baseClass;
  1137. },
  1138. getWidth: function () {
  1139. return this._width;
  1140. },
  1141. getHeight: function () {
  1142. return this._height;
  1143. },
  1144. getSize: function () {
  1145. return {
  1146. width: this._width,
  1147. height: this._height
  1148. }
  1149. },
  1150. setWidth: function (width) {
  1151. if (width === undefined || width === null || width != width) {
  1152. return ;
  1153. }
  1154. var originWidth = this._width;
  1155. var ratio = width / originWidth;
  1156. var childNodes = this.childNodes, childNode, p, op = this.getPosition(), w, cw, ox, rotation = this.getRotation();
  1157. for (var i = 0, len = childNodes.length; i < len; i++) {
  1158. childNode = childNodes[i];
  1159. p = childNode.getPosition();
  1160. cw = childNode.getWidth();
  1161. w = cw >=2 ? cw * ratio : cw;
  1162. childNode.setWidth(w);
  1163. ox = op.x + (p.x - op.x) * ratio;
  1164. childNode.setPosition(ox, p.y);
  1165. rotation = GD.calcRotation(rotation);
  1166. if (rotation === 0 || rotation === Math.PI) {
  1167. // 图元未旋转
  1168. ox = op.x + (p.x - op.x)*ratio;
  1169. childNode.setPosition(ox, p.y);
  1170. } else if (rotation === 90 * Math.PI / 180) {
  1171. // 图元旋转以后
  1172. ox = op.y + (p.y - op.y)*ratio;
  1173. childNode.setPosition(p.x, ox);
  1174. }
  1175. }
  1176. this._width = width;
  1177. this._originWidth = width;
  1178. this._ratioX = ratio;
  1179. return this;
  1180. },
  1181. setHeight: function (height) {
  1182. if (height === undefined || height === null || height != height) {
  1183. return ;
  1184. }
  1185. var originHeight = this._height;
  1186. var ratio = height / originHeight;
  1187. var childNodes = this.childNodes, childNode, p, op = this.getPosition(), h, ch, oy, rotation = this.getRotation();
  1188. for (var i = 0, len = childNodes.length; i < len; i++) {
  1189. childNode = childNodes[i];
  1190. p = childNode.getPosition();
  1191. ch = childNode.getHeight();
  1192. h = ch >=2 ? ch * ratio : ch;
  1193. childNode.setHeight(h);
  1194. rotation = GD.calcRotation(rotation);
  1195. if (rotation === 0 || rotation === Math.PI) {
  1196. // 图元未旋转
  1197. oy = op.y + (p.y - op.y)*ratio;
  1198. childNode.setPosition(p.x, oy);
  1199. } else if (rotation === 90 * Math.PI / 180) {
  1200. // 图元旋转以后
  1201. oy = op.x + (p.x - op.x)*ratio;
  1202. childNode.setPosition(oy, p.y);
  1203. }
  1204. }
  1205. this._height = height;
  1206. this._originHeight = height;
  1207. this._ratioY = ratio;
  1208. return this;
  1209. },
  1210. setSize: function (size) {
  1211. // var args = Array.prototype.slice.call(arguments, 0);
  1212. // var height, width;
  1213. // if (args.length === 0) {
  1214. // return ;
  1215. // }else if (args.length === 1) {
  1216. // height = args[0].height;
  1217. // width = args[0].width;
  1218. // } else {
  1219. // width = args[0];
  1220. // height = args[1];
  1221. // }
  1222. // var wh = GD.getRatioWithRotation(angle, wid)
  1223. // this.setHeight(height);
  1224. // this.setWidth(width);
  1225. // return this;
  1226. var args = Array.prototype.slice.call(arguments, 0);
  1227. var height, width;
  1228. if (args.length === 0) {
  1229. return ;
  1230. }else if (args.length === 1) {
  1231. height = args[0].height;
  1232. width = args[0].width;
  1233. angle = 0;
  1234. } else if (args.length === 2) {
  1235. if (typeof args[0] === 'object') {
  1236. width = args[0].width;
  1237. height = args[0].height;
  1238. angle = args[1] || 0;
  1239. } else {
  1240. width = args[0];
  1241. height = args[1];
  1242. angle = 0;
  1243. }
  1244. } else if (args.length === 3) {
  1245. width = args[0];
  1246. height = args[1];
  1247. angle = args[2] || 0;
  1248. }
  1249. var wh = GD.getRatioWithRotation(0, width, height);
  1250. this.setHeight(wh.ratioY);
  1251. this.setWidth(wh.ratioX);
  1252. return this;
  1253. },
  1254. getPosition: function () {
  1255. return {
  1256. x: this._x,
  1257. y: this._y
  1258. }
  1259. },
  1260. setPosition: function () {
  1261. var args = Array.prototype.slice.call(arguments, 0), x, y;
  1262. if (args.length === 0) {
  1263. return this;
  1264. } else if (args.length === 1) {
  1265. if (typeof args[0] != 'object') {
  1266. return this;
  1267. }
  1268. x = args[0].x;
  1269. y = args[0].y;
  1270. } else {
  1271. x = args[0];
  1272. y = args[1];
  1273. }
  1274. if ((x !== 0 && !x) || (y !== 0 && !y)) {
  1275. return this;
  1276. }
  1277. // var childNodes = this.childNodes, offset, childNode, p;
  1278. // for (var i = 0, len = childNodes.length; i < len; i++) {
  1279. // childNode = childNodes[i];
  1280. // p = childNode.getPosition();
  1281. // childNode.setPosition(x - (this._x-p.x)*this._ratioX, y - (this._y-p.y)*this._ratioY);
  1282. // }
  1283. // this._x = x;
  1284. // this._y = y;
  1285. // return this;
  1286. var childNodes, childNode, background, offset = {}, op, cp;
  1287. childNodes = this.childNodes;
  1288. background = this._background;
  1289. op = background.getPosition();
  1290. offset.x = x - op.x;
  1291. offset.y = y - op.y;
  1292. for (var i = 0, len = childNodes.length; i < len; i++) {
  1293. childNode = childNodes[i];
  1294. cp = childNode.getPosition();
  1295. childNode.setPosition(cp.x + offset.x, cp.y + offset.y);
  1296. }
  1297. this._x = x;
  1298. this._y = y;
  1299. this._position = {x: x, y: y};
  1300. return this;
  1301. },
  1302. getStyle: function (key) {
  1303. if (!key) {
  1304. return undefined;
  1305. }
  1306. return this._styleObject[key];
  1307. },
  1308. setStyle: function (key, value, force) {
  1309. var childNodes = this.childNodes, childNode;
  1310. for (var i = 0, len = childNodes.length; i < len; i++) {
  1311. childNode = childNodes[i];
  1312. if (key === '2d.visible') {
  1313. if (value === graphView.isVisible(childNode)) {
  1314. continue;
  1315. }
  1316. if (!value) {
  1317. childNode._savedIsVisible = graphView.isVisible(childNode);
  1318. childNode.s({
  1319. '2d.visible': false
  1320. })
  1321. } else {
  1322. childNode.s({
  1323. '2d.visible': childNode._savedIsVisible
  1324. })
  1325. }
  1326. continue;
  1327. }
  1328. childNode.s({
  1329. key: value
  1330. });
  1331. }
  1332. this._styleObject[key] = value;
  1333. return this;
  1334. },
  1335. calcSize: function () {
  1336. var background = this._background;
  1337. var position = background.getPosition(),
  1338. width = background.getWidth(),
  1339. height = background.getHeight();
  1340. this._width = width;
  1341. this._height = height;
  1342. this._x = position.x;
  1343. this._y = position.y;
  1344. this._position = {
  1345. x: this._x,
  1346. y: this._y
  1347. }
  1348. return this;
  1349. return this;
  1350. },
  1351. s: function (styleObj, force) {
  1352. var args = Array.prototype.slice.call(arguments, 0);
  1353. var styleObj;
  1354. if (args.length === 0) {
  1355. return this;
  1356. } else if (args.length === 1) {
  1357. styleObj = args[0];
  1358. } else {
  1359. this.setStyle(args[0], args[1]);
  1360. return this;
  1361. }
  1362. for (var key in styleObj) {
  1363. if (!styleObj.hasOwnProperty(key)) {
  1364. continue;
  1365. }
  1366. this.setStyle(key, styleObj[key], force);
  1367. }
  1368. return this;
  1369. },
  1370. init: function (x, y, width, height, angle) {
  1371. var that = this;
  1372. this.calcSize();
  1373. (function (width, height, angle) {
  1374. // that.setSize(width, height, angle);
  1375. // var wh = GD.getRatioWithRotation(angle, width, height);
  1376. // width = wh.ratioX;
  1377. // height = wh.ratioY;
  1378. var originHeight = that._height;
  1379. var originWidth = that._width;
  1380. var ratioY = height / originHeight;
  1381. var ratioX = width / originWidth;
  1382. var childNodes = that.childNodes,
  1383. childNode,p, op = that.getPosition(), h, ch, oy, w, cw, ox, name, borderRatio, borderWidth;
  1384. for (var i = 0, len = childNodes.length; i < len; i++) {
  1385. childNode = childNodes[i];
  1386. p = childNode.getPosition();
  1387. childNode.originHeight = childNode.originHeight || childNode.getHeight();
  1388. ch = childNode.getHeight();
  1389. cw = childNode.getWidth();
  1390. if (ch > 2) {
  1391. h = ch * ratioY;
  1392. childNode.setHeight(h);
  1393. }
  1394. if (cw > 2) {
  1395. w = cw * ratioX;
  1396. childNode.setWidth(w);
  1397. }
  1398. borderRatio = (ratioX + ratioY)*0.5;
  1399. if (childNode._nodeType === 'line') { // 如果是线,
  1400. if (childNode.getWidth() > childNode.getHeight()) {
  1401. borderRatio = ratioX;
  1402. } else {
  1403. borderRatio = ratioY;
  1404. }
  1405. }
  1406. name = childNode._nodename;
  1407. // if (childNode.borderWidth && name && ch > 2 && cw > 2) {
  1408. // borderWidth = childNode.borderWidth / borderRatio;
  1409. // if (borderWidth > ch*0.5 || borderWidth > cw *0.5) {
  1410. // // borderWidth = childNode.borderWidth;
  1411. // }
  1412. // childNode.borderWidth = borderWidth;
  1413. // childNode.a(name + '.borderwidth', borderWidth);
  1414. // }
  1415. }
  1416. that._height = height;
  1417. that._originHeight = height;
  1418. that._ratioY = ratioY;
  1419. that._width = width;
  1420. that._originWidth = width;
  1421. that._ratioX = ratioX;
  1422. })(width, height, angle);
  1423. that._x = width / 2;
  1424. that._y = height / 2;
  1425. that._rotation = 0;
  1426. // that.setPosition(x, y);
  1427. (function (x, y) {
  1428. var childNodes = that.childNodes, offset, childNode;
  1429. var w2 = that.getWidth() / 2, h2 = that.getHeight()/2;
  1430. for (var i = 0, len = childNodes.length; i < len; i++) {
  1431. childNode = childNodes[i];
  1432. offset = childNode.getPosition();
  1433. childNode.setPosition(x + offset.x * that._ratioX - w2, y + offset.y * that._ratioY - h2);
  1434. }
  1435. that._x = x;
  1436. that._y = y;
  1437. })(x, y);
  1438. // setTimeout(that.addEVent, 1000);
  1439. },
  1440. setRotation: function (angle) {
  1441. var that = this, _angle = that.getRotation();
  1442. if (angle!==0 && !angle || angle === _angle) {
  1443. return this;
  1444. }
  1445. var childNodes = this.childNodes, childNode, p = this.getPosition(), px = p.x, py = p.y;
  1446. for (var i = 0, len = childNodes.length; i < len; i++) {
  1447. childNode = childNodes[i];
  1448. var x = childNode.getPosition().x - px;
  1449. var y = childNode.getPosition().y - py;
  1450. childNode.setPosition(Math.cos(angle-_angle) * x - Math.sin(angle-_angle) * y + px, Math.cos(angle-_angle) * y + Math.sin(angle-_angle) * x + py);
  1451. childNode.setRotation(angle);
  1452. }
  1453. this._rotation = angle;
  1454. return this;
  1455. },
  1456. getRotation: function () {
  1457. return this._rotation;
  1458. },
  1459. setScale: function (sx, sy) {
  1460. var that = this,
  1461. childNodes = this.childNodes,
  1462. childNode;
  1463. if (sx === undefined || sx === null) return ;
  1464. if (sy === undefined || sy === null) {
  1465. sy = sx;
  1466. }
  1467. for (var i = 0, len = childNodes.length; i < len; i++) {
  1468. childNode = childNodes[i];
  1469. if (typeof childNode.setScale === 'function') {
  1470. childNode.setScale(sx, sy);
  1471. }
  1472. }
  1473. },
  1474. getScale: function () {
  1475. return this._background.getScale();
  1476. },
  1477. setScaleX: function (sx) {
  1478. if (sx === undefined || sx === null) return;
  1479. var that = this,
  1480. childNodes = this.childNodes,
  1481. childNode;
  1482. for (var i = 0, len = childNodes.length; i < len; i++) {
  1483. childNode = childNodes[i];
  1484. if (typeof childNode.setScaleX === 'function') {
  1485. childNode.setScaleX(sx);
  1486. }
  1487. }
  1488. },
  1489. setScaleY: function (sy) {
  1490. if (sy === undefined || sy === null) return;
  1491. var that = this,
  1492. childNodes = this.childNodes,
  1493. childNode;
  1494. for (var i = 0, len = childNodes.length; i < len; i++) {
  1495. childNode = childNodes[i];
  1496. if (typeof childNode.setScaleY === 'function') {
  1497. childNode.setScaleY(sy);
  1498. }
  1499. }
  1500. },
  1501. getScaleX: function () {
  1502. return this._background.getScaleX();
  1503. },
  1504. getScaleY: function () {
  1505. return this._background.getScaleY();
  1506. },
  1507. evert: function () {
  1508. var that = this,
  1509. childNodes = this.childNodes,
  1510. background = this._background,
  1511. bp = background.getPosition(),
  1512. bx = bp.x,
  1513. by = bp.y,
  1514. childNode, distanceX, distanceY, x, y, p, nx, ny;
  1515. for (var i = 0, len = childNodes.length; i < len; i++) {
  1516. childNode = childNodes[i];
  1517. p = childNode.getPosition();
  1518. x = p.x;
  1519. y = p.y;
  1520. distanceX = bx - x;
  1521. distanceY = by - y;
  1522. nx = bx + distanceX;
  1523. ny = by + distanceY;
  1524. childNode.setPosition(nx, ny);
  1525. if (typeof childNode.setScale === 'function') {
  1526. if (!(childNode._disallowEvert === true))
  1527. childNode.setScale(-1, -1);
  1528. }
  1529. }
  1530. },
  1531. evertX: function () {
  1532. var that = this,
  1533. childNodes = this.childNodes,
  1534. background = this._background,
  1535. bx = background.getPosition().x,
  1536. childNode, distance, x, p, nx;
  1537. for (var i = 0, len = childNodes.length; i < len; i++) {
  1538. childNode = childNodes[i];
  1539. p = childNode.getPosition();
  1540. x = p.x;
  1541. distance = bx - x;
  1542. nx = bx + distance;
  1543. childNode.setPosition(nx, p.y);
  1544. if (typeof childNode.setScaleX === 'function') {
  1545. if (!(childNode._disallowEvert === true))
  1546. childNode.setScaleX(-1);
  1547. }
  1548. }
  1549. },
  1550. evertY: function () {
  1551. var that = this,
  1552. childNodes = this.childNodes,
  1553. background = this._background,
  1554. by = background.getPosition().y,
  1555. childNode, distance, y, p, ny;
  1556. for (var i = 0, len = childNodes.length; i < len; i++) {
  1557. childNode = childNodes[i];
  1558. p = childNode.getPosition();
  1559. y = p.y;
  1560. distance = by - y;
  1561. ny = by + distance;
  1562. childNode.setPosition(p.x, ny);
  1563. if (typeof childNode.setScaleY === 'function') {
  1564. if (!(childNode._disallowEvert === true))
  1565. childNode.setScaleY(-1);
  1566. }
  1567. }
  1568. },
  1569. attr: function (key, value) {
  1570. var _attrObj = this._attrObj || {};
  1571. if (arguments.length === 1) {
  1572. return _attrObj[key];
  1573. }
  1574. var childNodes = this.childNodes, childNode;
  1575. _attrObj[key] = value;
  1576. for (var i = 0; childNode = childNodes[i++];) {
  1577. if (typeof childNode.a === 'function') {
  1578. childNode.a(key, value);
  1579. }
  1580. }
  1581. },
  1582. a: function () {
  1583. return this.attr.apply(this, arguments);
  1584. }
  1585. });
  1586. }