safex-webgl 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (910) hide show
  1. package/.prettierrc +6 -0
  2. package/@types/index.d.ts +36 -0
  3. package/README.md +152 -0
  4. package/bun.lock +353 -0
  5. package/dist/actions/Action.d.ts +27 -0
  6. package/dist/actions/Action.d.ts.map +1 -0
  7. package/dist/actions/Action.js +62 -0
  8. package/dist/actions/Action.js.map +1 -0
  9. package/dist/actions/ActionBezier.d.ts +121 -0
  10. package/dist/actions/ActionBezier.d.ts.map +1 -0
  11. package/dist/actions/ActionBezier.js +221 -0
  12. package/dist/actions/ActionBezier.js.map +1 -0
  13. package/dist/actions/ActionBlink.d.ts +62 -0
  14. package/dist/actions/ActionBlink.d.ts.map +1 -0
  15. package/dist/actions/ActionBlink.js +96 -0
  16. package/dist/actions/ActionBlink.js.map +1 -0
  17. package/dist/actions/ActionCatmullRom.d.ts +242 -0
  18. package/dist/actions/ActionCatmullRom.d.ts.map +1 -0
  19. package/dist/actions/ActionCatmullRom.js +436 -0
  20. package/dist/actions/ActionCatmullRom.js.map +1 -0
  21. package/dist/actions/ActionFade.d.ts +126 -0
  22. package/dist/actions/ActionFade.d.ts.map +1 -0
  23. package/dist/actions/ActionFade.js +190 -0
  24. package/dist/actions/ActionFade.js.map +1 -0
  25. package/dist/actions/ActionInstant.d.ts +237 -0
  26. package/dist/actions/ActionInstant.d.ts.map +1 -0
  27. package/dist/actions/ActionInstant.js +386 -0
  28. package/dist/actions/ActionInstant.js.map +1 -0
  29. package/dist/actions/ActionInterval.d.ts +132 -0
  30. package/dist/actions/ActionInterval.d.ts.map +1 -0
  31. package/dist/actions/ActionInterval.js +254 -0
  32. package/dist/actions/ActionInterval.js.map +1 -0
  33. package/dist/actions/ActionJump.d.ts +146 -0
  34. package/dist/actions/ActionJump.d.ts.map +1 -0
  35. package/dist/actions/ActionJump.js +239 -0
  36. package/dist/actions/ActionJump.js.map +1 -0
  37. package/dist/actions/ActionMove.d.ts +73 -0
  38. package/dist/actions/ActionMove.d.ts.map +1 -0
  39. package/dist/actions/ActionMove.js +164 -0
  40. package/dist/actions/ActionMove.js.map +1 -0
  41. package/dist/actions/ActionRotate.d.ts +137 -0
  42. package/dist/actions/ActionRotate.d.ts.map +1 -0
  43. package/dist/actions/ActionRotate.js +214 -0
  44. package/dist/actions/ActionRotate.js.map +1 -0
  45. package/dist/actions/ActionScale.d.ts +110 -0
  46. package/dist/actions/ActionScale.d.ts.map +1 -0
  47. package/dist/actions/ActionScale.js +157 -0
  48. package/dist/actions/ActionScale.js.map +1 -0
  49. package/dist/actions/ActionSkew.d.ts +120 -0
  50. package/dist/actions/ActionSkew.d.ts.map +1 -0
  51. package/dist/actions/ActionSkew.js +185 -0
  52. package/dist/actions/ActionSkew.js.map +1 -0
  53. package/dist/actions/ActionTint.d.ts +132 -0
  54. package/dist/actions/ActionTint.d.ts.map +1 -0
  55. package/dist/actions/ActionTint.js +193 -0
  56. package/dist/actions/ActionTint.js.map +1 -0
  57. package/dist/actions/Animate.d.ts +77 -0
  58. package/dist/actions/Animate.d.ts.map +1 -0
  59. package/dist/actions/Animate.js +177 -0
  60. package/dist/actions/Animate.js.map +1 -0
  61. package/dist/actions/DelayTime.d.ts +95 -0
  62. package/dist/actions/DelayTime.d.ts.map +1 -0
  63. package/dist/actions/DelayTime.js +145 -0
  64. package/dist/actions/DelayTime.js.map +1 -0
  65. package/dist/actions/FiniteTimeAction.d.ts +11 -0
  66. package/dist/actions/FiniteTimeAction.d.ts.map +1 -0
  67. package/dist/actions/FiniteTimeAction.js +24 -0
  68. package/dist/actions/FiniteTimeAction.js.map +1 -0
  69. package/dist/actions/Follow.d.ts +23 -0
  70. package/dist/actions/Follow.d.ts.map +1 -0
  71. package/dist/actions/Follow.js +98 -0
  72. package/dist/actions/Follow.js.map +1 -0
  73. package/dist/actions/Repeat.d.ts +151 -0
  74. package/dist/actions/Repeat.d.ts.map +1 -0
  75. package/dist/actions/Repeat.js +276 -0
  76. package/dist/actions/Repeat.js.map +1 -0
  77. package/dist/actions/Sequence.d.ts +77 -0
  78. package/dist/actions/Sequence.d.ts.map +1 -0
  79. package/dist/actions/Sequence.js +190 -0
  80. package/dist/actions/Sequence.js.map +1 -0
  81. package/dist/actions/Spawn.d.ts +63 -0
  82. package/dist/actions/Spawn.d.ts.map +1 -0
  83. package/dist/actions/Spawn.js +146 -0
  84. package/dist/actions/Spawn.js.map +1 -0
  85. package/dist/actions/Speed.d.ts +19 -0
  86. package/dist/actions/Speed.d.ts.map +1 -0
  87. package/dist/actions/Speed.js +57 -0
  88. package/dist/actions/Speed.js.map +1 -0
  89. package/dist/actions/TargetedAction.d.ts +67 -0
  90. package/dist/actions/TargetedAction.d.ts.map +1 -0
  91. package/dist/actions/TargetedAction.js +99 -0
  92. package/dist/actions/TargetedAction.js.map +1 -0
  93. package/dist/actions/easing/ActionEase.d.ts +133 -0
  94. package/dist/actions/easing/ActionEase.d.ts.map +1 -0
  95. package/dist/actions/easing/ActionEase.js +184 -0
  96. package/dist/actions/easing/ActionEase.js.map +1 -0
  97. package/dist/actions/easing/Back.d.ts +174 -0
  98. package/dist/actions/easing/Back.d.ts.map +1 -0
  99. package/dist/actions/easing/Back.js +227 -0
  100. package/dist/actions/easing/Back.js.map +1 -0
  101. package/dist/actions/easing/Bezier.d.ts +94 -0
  102. package/dist/actions/easing/Bezier.d.ts.map +1 -0
  103. package/dist/actions/easing/Bezier.js +124 -0
  104. package/dist/actions/easing/Bezier.js.map +1 -0
  105. package/dist/actions/easing/Bounce.d.ts +203 -0
  106. package/dist/actions/easing/Bounce.d.ts.map +1 -0
  107. package/dist/actions/easing/Bounce.js +288 -0
  108. package/dist/actions/easing/Bounce.js.map +1 -0
  109. package/dist/actions/easing/Circle.d.ts +177 -0
  110. package/dist/actions/easing/Circle.d.ts.map +1 -0
  111. package/dist/actions/easing/Circle.js +220 -0
  112. package/dist/actions/easing/Circle.js.map +1 -0
  113. package/dist/actions/easing/Cubic.d.ts +165 -0
  114. package/dist/actions/easing/Cubic.d.ts.map +1 -0
  115. package/dist/actions/easing/Cubic.js +209 -0
  116. package/dist/actions/easing/Cubic.js.map +1 -0
  117. package/dist/actions/easing/Elastic.d.ts +269 -0
  118. package/dist/actions/easing/Elastic.d.ts.map +1 -0
  119. package/dist/actions/easing/Elastic.js +358 -0
  120. package/dist/actions/easing/Elastic.js.map +1 -0
  121. package/dist/actions/easing/Exponential.d.ts +181 -0
  122. package/dist/actions/easing/Exponential.d.ts.map +1 -0
  123. package/dist/actions/easing/Exponential.js +214 -0
  124. package/dist/actions/easing/Exponential.js.map +1 -0
  125. package/dist/actions/easing/InOut.d.ts +191 -0
  126. package/dist/actions/easing/InOut.d.ts.map +1 -0
  127. package/dist/actions/easing/InOut.js +254 -0
  128. package/dist/actions/easing/InOut.js.map +1 -0
  129. package/dist/actions/easing/Quartic.d.ts +232 -0
  130. package/dist/actions/easing/Quartic.d.ts.map +1 -0
  131. package/dist/actions/easing/Quartic.js +313 -0
  132. package/dist/actions/easing/Quartic.js.map +1 -0
  133. package/dist/actions/easing/Quintic.d.ts +168 -0
  134. package/dist/actions/easing/Quintic.d.ts.map +1 -0
  135. package/dist/actions/easing/Quintic.js +212 -0
  136. package/dist/actions/easing/Quintic.js.map +1 -0
  137. package/dist/actions/easing/Sine.d.ts +176 -0
  138. package/dist/actions/easing/Sine.d.ts.map +1 -0
  139. package/dist/actions/easing/Sine.js +206 -0
  140. package/dist/actions/easing/Sine.js.map +1 -0
  141. package/dist/actions/index.d.ts +16 -0
  142. package/dist/actions/index.d.ts.map +1 -0
  143. package/dist/actions/index.js +16 -0
  144. package/dist/actions/index.js.map +1 -0
  145. package/dist/audio/Audio.d.ts +47 -0
  146. package/dist/audio/Audio.d.ts.map +1 -0
  147. package/dist/audio/Audio.js +255 -0
  148. package/dist/audio/Audio.js.map +1 -0
  149. package/dist/audio/engine.d.ts +171 -0
  150. package/dist/audio/engine.d.ts.map +1 -0
  151. package/dist/audio/engine.js +556 -0
  152. package/dist/audio/engine.js.map +1 -0
  153. package/dist/audio/index.d.ts +3 -0
  154. package/dist/audio/index.d.ts.map +1 -0
  155. package/dist/audio/index.js +3 -0
  156. package/dist/audio/index.js.map +1 -0
  157. package/dist/boot.d.ts +80 -0
  158. package/dist/boot.d.ts.map +1 -0
  159. package/dist/boot.js +468 -0
  160. package/dist/boot.js.map +1 -0
  161. package/dist/clipping-nodes/ClippingNode.d.ts +114 -0
  162. package/dist/clipping-nodes/ClippingNode.d.ts.map +1 -0
  163. package/dist/clipping-nodes/ClippingNode.js +177 -0
  164. package/dist/clipping-nodes/ClippingNode.js.map +1 -0
  165. package/dist/clipping-nodes/ClippingNodeWebGLRenderCmd.d.ts +25 -0
  166. package/dist/clipping-nodes/ClippingNodeWebGLRenderCmd.d.ts.map +1 -0
  167. package/dist/clipping-nodes/ClippingNodeWebGLRenderCmd.js +157 -0
  168. package/dist/clipping-nodes/ClippingNodeWebGLRenderCmd.js.map +1 -0
  169. package/dist/core/ActionManager.d.ts +56 -0
  170. package/dist/core/ActionManager.d.ts.map +1 -0
  171. package/dist/core/ActionManager.js +253 -0
  172. package/dist/core/ActionManager.js.map +1 -0
  173. package/dist/core/Configuration.d.ts +108 -0
  174. package/dist/core/Configuration.d.ts.map +1 -0
  175. package/dist/core/Configuration.js +232 -0
  176. package/dist/core/Configuration.js.map +1 -0
  177. package/dist/core/Director.d.ts +130 -0
  178. package/dist/core/Director.d.ts.map +1 -0
  179. package/dist/core/Director.js +580 -0
  180. package/dist/core/Director.js.map +1 -0
  181. package/dist/core/DrawingPrimitivesWebGL.d.ts +32 -0
  182. package/dist/core/DrawingPrimitivesWebGL.d.ts.map +1 -0
  183. package/dist/core/DrawingPrimitivesWebGL.js +273 -0
  184. package/dist/core/DrawingPrimitivesWebGL.js.map +1 -0
  185. package/dist/core/Scheduler.d.ts +110 -0
  186. package/dist/core/Scheduler.d.ts.map +1 -0
  187. package/dist/core/Scheduler.js +687 -0
  188. package/dist/core/Scheduler.js.map +1 -0
  189. package/dist/core/base-nodes/BaseNodesPropertyDefine.d.ts +2 -0
  190. package/dist/core/base-nodes/BaseNodesPropertyDefine.d.ts.map +1 -0
  191. package/dist/core/base-nodes/BaseNodesPropertyDefine.js +37 -0
  192. package/dist/core/base-nodes/BaseNodesPropertyDefine.js.map +1 -0
  193. package/dist/core/base-nodes/CustomRenderCmd.d.ts +9 -0
  194. package/dist/core/base-nodes/CustomRenderCmd.d.ts.map +1 -0
  195. package/dist/core/base-nodes/CustomRenderCmd.js +16 -0
  196. package/dist/core/base-nodes/CustomRenderCmd.js.map +1 -0
  197. package/dist/core/base-nodes/Node.d.ts +285 -0
  198. package/dist/core/base-nodes/Node.d.ts.map +1 -0
  199. package/dist/core/base-nodes/Node.js +1112 -0
  200. package/dist/core/base-nodes/Node.js.map +1 -0
  201. package/dist/core/base-nodes/NodeRenderCmd.d.ts +65 -0
  202. package/dist/core/base-nodes/NodeRenderCmd.d.ts.map +1 -0
  203. package/dist/core/base-nodes/NodeRenderCmd.js +460 -0
  204. package/dist/core/base-nodes/NodeRenderCmd.js.map +1 -0
  205. package/dist/core/base-nodes/NodeWebGLRenderCmd.d.ts +17 -0
  206. package/dist/core/base-nodes/NodeWebGLRenderCmd.d.ts.map +1 -0
  207. package/dist/core/base-nodes/NodeWebGLRenderCmd.js +29 -0
  208. package/dist/core/base-nodes/NodeWebGLRenderCmd.js.map +1 -0
  209. package/dist/core/cocoa/AffineTransform.d.ts +201 -0
  210. package/dist/core/cocoa/AffineTransform.d.ts.map +1 -0
  211. package/dist/core/cocoa/AffineTransform.js +260 -0
  212. package/dist/core/cocoa/AffineTransform.js.map +1 -0
  213. package/dist/core/cocoa/Geometry.d.ts +176 -0
  214. package/dist/core/cocoa/Geometry.d.ts.map +1 -0
  215. package/dist/core/cocoa/Geometry.js +237 -0
  216. package/dist/core/cocoa/Geometry.js.map +1 -0
  217. package/dist/core/event-manager/Event.d.ts +57 -0
  218. package/dist/core/event-manager/Event.d.ts.map +1 -0
  219. package/dist/core/event-manager/Event.js +69 -0
  220. package/dist/core/event-manager/Event.js.map +1 -0
  221. package/dist/core/event-manager/EventCustom.d.ts +22 -0
  222. package/dist/core/event-manager/EventCustom.d.ts.map +1 -0
  223. package/dist/core/event-manager/EventCustom.js +31 -0
  224. package/dist/core/event-manager/EventCustom.js.map +1 -0
  225. package/dist/core/event-manager/EventExtension.d.ts +33 -0
  226. package/dist/core/event-manager/EventExtension.d.ts.map +1 -0
  227. package/dist/core/event-manager/EventExtension.js +80 -0
  228. package/dist/core/event-manager/EventExtension.js.map +1 -0
  229. package/dist/core/event-manager/EventFocus.d.ts +17 -0
  230. package/dist/core/event-manager/EventFocus.d.ts.map +1 -0
  231. package/dist/core/event-manager/EventFocus.js +21 -0
  232. package/dist/core/event-manager/EventFocus.js.map +1 -0
  233. package/dist/core/event-manager/EventHelper.d.ts +8 -0
  234. package/dist/core/event-manager/EventHelper.d.ts.map +1 -0
  235. package/dist/core/event-manager/EventHelper.js +92 -0
  236. package/dist/core/event-manager/EventHelper.js.map +1 -0
  237. package/dist/core/event-manager/EventListener.d.ts +53 -0
  238. package/dist/core/event-manager/EventListener.d.ts.map +1 -0
  239. package/dist/core/event-manager/EventListener.js +95 -0
  240. package/dist/core/event-manager/EventListener.js.map +1 -0
  241. package/dist/core/event-manager/EventListenerCustom.d.ts +11 -0
  242. package/dist/core/event-manager/EventListenerCustom.d.ts.map +1 -0
  243. package/dist/core/event-manager/EventListenerCustom.js +37 -0
  244. package/dist/core/event-manager/EventListenerCustom.js.map +1 -0
  245. package/dist/core/event-manager/EventListenerFocus.d.ts +10 -0
  246. package/dist/core/event-manager/EventListenerFocus.d.ts.map +1 -0
  247. package/dist/core/event-manager/EventListenerFocus.js +28 -0
  248. package/dist/core/event-manager/EventListenerFocus.js.map +1 -0
  249. package/dist/core/event-manager/EventListenerMouse.d.ts +13 -0
  250. package/dist/core/event-manager/EventListenerMouse.d.ts.map +1 -0
  251. package/dist/core/event-manager/EventListenerMouse.js +49 -0
  252. package/dist/core/event-manager/EventListenerMouse.js.map +1 -0
  253. package/dist/core/event-manager/EventListenerTouchAllAtOnce.d.ts +12 -0
  254. package/dist/core/event-manager/EventListenerTouchAllAtOnce.d.ts.map +1 -0
  255. package/dist/core/event-manager/EventListenerTouchAllAtOnce.js +28 -0
  256. package/dist/core/event-manager/EventListenerTouchAllAtOnce.js.map +1 -0
  257. package/dist/core/event-manager/EventListenerTouchOneByOne.d.ts +16 -0
  258. package/dist/core/event-manager/EventListenerTouchOneByOne.d.ts.map +1 -0
  259. package/dist/core/event-manager/EventListenerTouchOneByOne.js +38 -0
  260. package/dist/core/event-manager/EventListenerTouchOneByOne.js.map +1 -0
  261. package/dist/core/event-manager/EventListenerVector.d.ts +15 -0
  262. package/dist/core/event-manager/EventListenerVector.d.ts.map +1 -0
  263. package/dist/core/event-manager/EventListenerVector.js +38 -0
  264. package/dist/core/event-manager/EventListenerVector.js.map +1 -0
  265. package/dist/core/event-manager/EventManager.d.ts +140 -0
  266. package/dist/core/event-manager/EventManager.d.ts.map +1 -0
  267. package/dist/core/event-manager/EventManager.js +907 -0
  268. package/dist/core/event-manager/EventManager.js.map +1 -0
  269. package/dist/core/event-manager/EventMouse.d.ts +173 -0
  270. package/dist/core/event-manager/EventMouse.d.ts.map +1 -0
  271. package/dist/core/event-manager/EventMouse.js +200 -0
  272. package/dist/core/event-manager/EventMouse.js.map +1 -0
  273. package/dist/core/event-manager/EventTouch.d.ts +24 -0
  274. package/dist/core/event-manager/EventTouch.d.ts.map +1 -0
  275. package/dist/core/event-manager/EventTouch.js +33 -0
  276. package/dist/core/event-manager/EventTouch.js.map +1 -0
  277. package/dist/core/event-manager/Touch.d.ts +60 -0
  278. package/dist/core/event-manager/Touch.d.ts.map +1 -0
  279. package/dist/core/event-manager/Touch.js +94 -0
  280. package/dist/core/event-manager/Touch.js.map +1 -0
  281. package/dist/core/event-manager/index.d.ts +6 -0
  282. package/dist/core/event-manager/index.d.ts.map +1 -0
  283. package/dist/core/event-manager/index.js +6 -0
  284. package/dist/core/event-manager/index.js.map +1 -0
  285. package/dist/core/index.d.ts +16 -0
  286. package/dist/core/index.d.ts.map +1 -0
  287. package/dist/core/index.js +16 -0
  288. package/dist/core/index.js.map +1 -0
  289. package/dist/core/kazmath/gl/mat4stack.d.ts +5 -0
  290. package/dist/core/kazmath/gl/mat4stack.d.ts.map +1 -0
  291. package/dist/core/kazmath/gl/mat4stack.js +53 -0
  292. package/dist/core/kazmath/gl/mat4stack.js.map +1 -0
  293. package/dist/core/kazmath/gl/matrix.d.ts +21 -0
  294. package/dist/core/kazmath/gl/matrix.d.ts.map +1 -0
  295. package/dist/core/kazmath/gl/matrix.js +121 -0
  296. package/dist/core/kazmath/gl/matrix.js.map +1 -0
  297. package/dist/core/kazmath/index.d.ts +7 -0
  298. package/dist/core/kazmath/index.d.ts.map +1 -0
  299. package/dist/core/kazmath/index.js +7 -0
  300. package/dist/core/kazmath/index.js.map +1 -0
  301. package/dist/core/kazmath/mat3.d.ts +45 -0
  302. package/dist/core/kazmath/mat3.d.ts.map +1 -0
  303. package/dist/core/kazmath/mat3.js +297 -0
  304. package/dist/core/kazmath/mat3.js.map +1 -0
  305. package/dist/core/kazmath/mat4.d.ts +175 -0
  306. package/dist/core/kazmath/mat4.d.ts.map +1 -0
  307. package/dist/core/kazmath/mat4.func.d.ts +44 -0
  308. package/dist/core/kazmath/mat4.func.d.ts.map +1 -0
  309. package/dist/core/kazmath/mat4.func.js +210 -0
  310. package/dist/core/kazmath/mat4.func.js.map +1 -0
  311. package/dist/core/kazmath/mat4.js +671 -0
  312. package/dist/core/kazmath/mat4.js.map +1 -0
  313. package/dist/core/kazmath/plane.d.ts +24 -0
  314. package/dist/core/kazmath/plane.d.ts.map +1 -0
  315. package/dist/core/kazmath/plane.js +96 -0
  316. package/dist/core/kazmath/plane.js.map +1 -0
  317. package/dist/core/kazmath/quaternion.d.ts +135 -0
  318. package/dist/core/kazmath/quaternion.d.ts.map +1 -0
  319. package/dist/core/kazmath/quaternion.js +407 -0
  320. package/dist/core/kazmath/quaternion.js.map +1 -0
  321. package/dist/core/kazmath/utility.d.ts +8 -0
  322. package/dist/core/kazmath/utility.d.ts.map +1 -0
  323. package/dist/core/kazmath/utility.js +14 -0
  324. package/dist/core/kazmath/utility.js.map +1 -0
  325. package/dist/core/kazmath/vec3.d.ts +26 -0
  326. package/dist/core/kazmath/vec3.d.ts.map +1 -0
  327. package/dist/core/kazmath/vec3.js +170 -0
  328. package/dist/core/kazmath/vec3.js.map +1 -0
  329. package/dist/core/kazmath/vec4.d.ts +22 -0
  330. package/dist/core/kazmath/vec4.d.ts.map +1 -0
  331. package/dist/core/kazmath/vec4.js +136 -0
  332. package/dist/core/kazmath/vec4.js.map +1 -0
  333. package/dist/core/labelttf/LabelTTF.d.ts +310 -0
  334. package/dist/core/labelttf/LabelTTF.d.ts.map +1 -0
  335. package/dist/core/labelttf/LabelTTF.js +818 -0
  336. package/dist/core/labelttf/LabelTTF.js.map +1 -0
  337. package/dist/core/labelttf/LabelTTFPropertyDefine.d.ts +2 -0
  338. package/dist/core/labelttf/LabelTTFPropertyDefine.d.ts.map +1 -0
  339. package/dist/core/labelttf/LabelTTFPropertyDefine.js +27 -0
  340. package/dist/core/labelttf/LabelTTFPropertyDefine.js.map +1 -0
  341. package/dist/core/labelttf/LabelTTFWebGLRenderCmd.d.ts +37 -0
  342. package/dist/core/labelttf/LabelTTFWebGLRenderCmd.d.ts.map +1 -0
  343. package/dist/core/labelttf/LabelTTFWebGLRenderCmd.js +367 -0
  344. package/dist/core/labelttf/LabelTTFWebGLRenderCmd.js.map +1 -0
  345. package/dist/core/layers/Layer.d.ts +35 -0
  346. package/dist/core/layers/Layer.d.ts.map +1 -0
  347. package/dist/core/layers/Layer.js +93 -0
  348. package/dist/core/layers/Layer.js.map +1 -0
  349. package/dist/core/layers/LayerColor.d.ts +61 -0
  350. package/dist/core/layers/LayerColor.d.ts.map +1 -0
  351. package/dist/core/layers/LayerColor.js +144 -0
  352. package/dist/core/layers/LayerColor.js.map +1 -0
  353. package/dist/core/layers/LayerGradient.d.ts +196 -0
  354. package/dist/core/layers/LayerGradient.d.ts.map +1 -0
  355. package/dist/core/layers/LayerGradient.js +482 -0
  356. package/dist/core/layers/LayerGradient.js.map +1 -0
  357. package/dist/core/layers/LayerMultiplex.d.ts +47 -0
  358. package/dist/core/layers/LayerMultiplex.d.ts.map +1 -0
  359. package/dist/core/layers/LayerMultiplex.js +87 -0
  360. package/dist/core/layers/LayerMultiplex.js.map +1 -0
  361. package/dist/core/layers/LayerWebGLRenderCmd.d.ts +26 -0
  362. package/dist/core/layers/LayerWebGLRenderCmd.d.ts.map +1 -0
  363. package/dist/core/layers/LayerWebGLRenderCmd.js +100 -0
  364. package/dist/core/layers/LayerWebGLRenderCmd.js.map +1 -0
  365. package/dist/core/layers/index.d.ts +5 -0
  366. package/dist/core/layers/index.d.ts.map +1 -0
  367. package/dist/core/layers/index.js +5 -0
  368. package/dist/core/layers/index.js.map +1 -0
  369. package/dist/core/platform/BlendFunc.d.ts +30 -0
  370. package/dist/core/platform/BlendFunc.d.ts.map +1 -0
  371. package/dist/core/platform/BlendFunc.js +50 -0
  372. package/dist/core/platform/BlendFunc.js.map +1 -0
  373. package/dist/core/platform/Color.d.ts +31 -0
  374. package/dist/core/platform/Color.d.ts.map +1 -0
  375. package/dist/core/platform/Color.js +71 -0
  376. package/dist/core/platform/Color.js.map +1 -0
  377. package/dist/core/platform/Common.d.ts +157 -0
  378. package/dist/core/platform/Common.d.ts.map +1 -0
  379. package/dist/core/platform/Common.js +180 -0
  380. package/dist/core/platform/Common.js.map +1 -0
  381. package/dist/core/platform/Config.d.ts +230 -0
  382. package/dist/core/platform/Config.d.ts.map +1 -0
  383. package/dist/core/platform/Config.js +231 -0
  384. package/dist/core/platform/Config.js.map +1 -0
  385. package/dist/core/platform/Dictionary.d.ts +16 -0
  386. package/dist/core/platform/Dictionary.d.ts.map +1 -0
  387. package/dist/core/platform/Dictionary.js +65 -0
  388. package/dist/core/platform/Dictionary.js.map +1 -0
  389. package/dist/core/platform/EGLView/ContainerStrategy.d.ts +30 -0
  390. package/dist/core/platform/EGLView/ContainerStrategy.d.ts.map +1 -0
  391. package/dist/core/platform/EGLView/ContainerStrategy.js +121 -0
  392. package/dist/core/platform/EGLView/ContainerStrategy.js.map +1 -0
  393. package/dist/core/platform/EGLView/ContentStrategy.d.ts +56 -0
  394. package/dist/core/platform/EGLView/ContentStrategy.d.ts.map +1 -0
  395. package/dist/core/platform/EGLView/ContentStrategy.js +117 -0
  396. package/dist/core/platform/EGLView/ContentStrategy.js.map +1 -0
  397. package/dist/core/platform/EGLView/EGLInstance.d.ts +8 -0
  398. package/dist/core/platform/EGLView/EGLInstance.d.ts.map +1 -0
  399. package/dist/core/platform/EGLView/EGLInstance.js +16 -0
  400. package/dist/core/platform/EGLView/EGLInstance.js.map +1 -0
  401. package/dist/core/platform/EGLView/ResolutionPolicy.d.ts +99 -0
  402. package/dist/core/platform/EGLView/ResolutionPolicy.d.ts.map +1 -0
  403. package/dist/core/platform/EGLView/ResolutionPolicy.js +116 -0
  404. package/dist/core/platform/EGLView/ResolutionPolicy.js.map +1 -0
  405. package/dist/core/platform/EGLView.d.ts +204 -0
  406. package/dist/core/platform/EGLView.d.ts.map +1 -0
  407. package/dist/core/platform/EGLView.js +669 -0
  408. package/dist/core/platform/EGLView.js.map +1 -0
  409. package/dist/core/platform/FontDefinition.d.ts +47 -0
  410. package/dist/core/platform/FontDefinition.d.ts.map +1 -0
  411. package/dist/core/platform/FontDefinition.js +59 -0
  412. package/dist/core/platform/FontDefinition.js.map +1 -0
  413. package/dist/core/platform/InputManager.d.ts +149 -0
  414. package/dist/core/platform/InputManager.d.ts.map +1 -0
  415. package/dist/core/platform/InputManager.js +558 -0
  416. package/dist/core/platform/InputManager.js.map +1 -0
  417. package/dist/core/platform/Loaders.d.ts +4 -0
  418. package/dist/core/platform/Loaders.d.ts.map +1 -0
  419. package/dist/core/platform/Loaders.js +141 -0
  420. package/dist/core/platform/Loaders.js.map +1 -0
  421. package/dist/core/platform/Macro.d.ts +634 -0
  422. package/dist/core/platform/Macro.d.ts.map +1 -0
  423. package/dist/core/platform/Macro.js +763 -0
  424. package/dist/core/platform/Macro.js.map +1 -0
  425. package/dist/core/platform/SAXParser.d.ts +44 -0
  426. package/dist/core/platform/SAXParser.d.ts.map +1 -0
  427. package/dist/core/platform/SAXParser.js +122 -0
  428. package/dist/core/platform/SAXParser.js.map +1 -0
  429. package/dist/core/platform/Types.d.ts +188 -0
  430. package/dist/core/platform/Types.d.ts.map +1 -0
  431. package/dist/core/platform/Types.js +425 -0
  432. package/dist/core/platform/Types.js.map +1 -0
  433. package/dist/core/platform/VisibleRect.d.ts +38 -0
  434. package/dist/core/platform/VisibleRect.d.ts.map +1 -0
  435. package/dist/core/platform/VisibleRect.js +66 -0
  436. package/dist/core/platform/VisibleRect.js.map +1 -0
  437. package/dist/core/platform/index.d.ts +7 -0
  438. package/dist/core/platform/index.d.ts.map +1 -0
  439. package/dist/core/platform/index.js +7 -0
  440. package/dist/core/platform/index.js.map +1 -0
  441. package/dist/core/platform/miniFramework.d.ts +28 -0
  442. package/dist/core/platform/miniFramework.d.ts.map +1 -0
  443. package/dist/core/platform/miniFramework.js +245 -0
  444. package/dist/core/platform/miniFramework.js.map +1 -0
  445. package/dist/core/platform/types/Quad2.d.ts +30 -0
  446. package/dist/core/platform/types/Quad2.d.ts.map +1 -0
  447. package/dist/core/platform/types/Quad2.js +62 -0
  448. package/dist/core/platform/types/Quad2.js.map +1 -0
  449. package/dist/core/platform/types/Quad3.d.ts +18 -0
  450. package/dist/core/platform/types/Quad3.d.ts.map +1 -0
  451. package/dist/core/platform/types/Quad3.js +30 -0
  452. package/dist/core/platform/types/Quad3.js.map +1 -0
  453. package/dist/core/platform/types/Tex2F.d.ts +20 -0
  454. package/dist/core/platform/types/Tex2F.d.ts.map +1 -0
  455. package/dist/core/platform/types/Tex2F.js +33 -0
  456. package/dist/core/platform/types/Tex2F.js.map +1 -0
  457. package/dist/core/platform/types/Vertex2F.d.ts +12 -0
  458. package/dist/core/platform/types/Vertex2F.d.ts.map +1 -0
  459. package/dist/core/platform/types/Vertex2F.js +25 -0
  460. package/dist/core/platform/types/Vertex2F.js.map +1 -0
  461. package/dist/core/platform/types/Vertex3F.d.ts +14 -0
  462. package/dist/core/platform/types/Vertex3F.d.ts.map +1 -0
  463. package/dist/core/platform/types/Vertex3F.js +31 -0
  464. package/dist/core/platform/types/Vertex3F.js.map +1 -0
  465. package/dist/core/platform/types/WebGLColor.d.ts +17 -0
  466. package/dist/core/platform/types/WebGLColor.d.ts.map +1 -0
  467. package/dist/core/platform/types/WebGLColor.js +40 -0
  468. package/dist/core/platform/types/WebGLColor.js.map +1 -0
  469. package/dist/core/renderer/GlobalVertexBuffer.d.ts +19 -0
  470. package/dist/core/renderer/GlobalVertexBuffer.d.ts.map +1 -0
  471. package/dist/core/renderer/GlobalVertexBuffer.js +99 -0
  472. package/dist/core/renderer/GlobalVertexBuffer.js.map +1 -0
  473. package/dist/core/renderer/RendererWebGL.d.ts +47 -0
  474. package/dist/core/renderer/RendererWebGL.d.ts.map +1 -0
  475. package/dist/core/renderer/RendererWebGL.js +389 -0
  476. package/dist/core/renderer/RendererWebGL.js.map +1 -0
  477. package/dist/core/scenes/Scene.d.ts +6 -0
  478. package/dist/core/scenes/Scene.d.ts.map +1 -0
  479. package/dist/core/scenes/Scene.js +12 -0
  480. package/dist/core/scenes/Scene.js.map +1 -0
  481. package/dist/core/sprites/Animation.d.ts +147 -0
  482. package/dist/core/sprites/Animation.d.ts.map +1 -0
  483. package/dist/core/sprites/Animation.js +277 -0
  484. package/dist/core/sprites/Animation.js.map +1 -0
  485. package/dist/core/sprites/AnimationCache.d.ts +37 -0
  486. package/dist/core/sprites/AnimationCache.d.ts.map +1 -0
  487. package/dist/core/sprites/AnimationCache.js +159 -0
  488. package/dist/core/sprites/AnimationCache.js.map +1 -0
  489. package/dist/core/sprites/Sprite.d.ts +104 -0
  490. package/dist/core/sprites/Sprite.d.ts.map +1 -0
  491. package/dist/core/sprites/Sprite.js +388 -0
  492. package/dist/core/sprites/Sprite.js.map +1 -0
  493. package/dist/core/sprites/SpriteBatchNode.d.ts +194 -0
  494. package/dist/core/sprites/SpriteBatchNode.d.ts.map +1 -0
  495. package/dist/core/sprites/SpriteBatchNode.js +332 -0
  496. package/dist/core/sprites/SpriteBatchNode.js.map +1 -0
  497. package/dist/core/sprites/SpriteFrame.d.ts +47 -0
  498. package/dist/core/sprites/SpriteFrame.d.ts.map +1 -0
  499. package/dist/core/sprites/SpriteFrame.js +223 -0
  500. package/dist/core/sprites/SpriteFrame.js.map +1 -0
  501. package/dist/core/sprites/SpriteFrameCache.d.ts +102 -0
  502. package/dist/core/sprites/SpriteFrameCache.d.ts.map +1 -0
  503. package/dist/core/sprites/SpriteFrameCache.js +333 -0
  504. package/dist/core/sprites/SpriteFrameCache.js.map +1 -0
  505. package/dist/core/sprites/SpriteLoadManager.d.ts +8 -0
  506. package/dist/core/sprites/SpriteLoadManager.d.ts.map +1 -0
  507. package/dist/core/sprites/SpriteLoadManager.js +37 -0
  508. package/dist/core/sprites/SpriteLoadManager.js.map +1 -0
  509. package/dist/core/sprites/SpriteWebGLRenderCmd.d.ts +35 -0
  510. package/dist/core/sprites/SpriteWebGLRenderCmd.d.ts.map +1 -0
  511. package/dist/core/sprites/SpriteWebGLRenderCmd.js +286 -0
  512. package/dist/core/sprites/SpriteWebGLRenderCmd.js.map +1 -0
  513. package/dist/core/sprites/SpritesPropertyDefine.d.ts +2 -0
  514. package/dist/core/sprites/SpritesPropertyDefine.d.ts.map +1 -0
  515. package/dist/core/sprites/SpritesPropertyDefine.js +19 -0
  516. package/dist/core/sprites/SpritesPropertyDefine.js.map +1 -0
  517. package/dist/core/support/PointExtension.d.ts +296 -0
  518. package/dist/core/support/PointExtension.d.ts.map +1 -0
  519. package/dist/core/support/PointExtension.js +443 -0
  520. package/dist/core/support/PointExtension.js.map +1 -0
  521. package/dist/core/support/Vertex.d.ts +24 -0
  522. package/dist/core/support/Vertex.d.ts.map +1 -0
  523. package/dist/core/support/Vertex.js +120 -0
  524. package/dist/core/support/Vertex.js.map +1 -0
  525. package/dist/core/utils/BinaryLoader.d.ts +9 -0
  526. package/dist/core/utils/BinaryLoader.d.ts.map +1 -0
  527. package/dist/core/utils/BinaryLoader.js +116 -0
  528. package/dist/core/utils/BinaryLoader.js.map +1 -0
  529. package/dist/core/utils/Profiler.d.ts +13 -0
  530. package/dist/core/utils/Profiler.d.ts.map +1 -0
  531. package/dist/core/utils/Profiler.js +140 -0
  532. package/dist/core/utils/Profiler.js.map +1 -0
  533. package/dist/helper/AsyncPool.d.ts +22 -0
  534. package/dist/helper/AsyncPool.d.ts.map +1 -0
  535. package/dist/helper/AsyncPool.js +101 -0
  536. package/dist/helper/AsyncPool.js.map +1 -0
  537. package/dist/helper/Base64.d.ts +29 -0
  538. package/dist/helper/Base64.d.ts.map +1 -0
  539. package/dist/helper/Base64.js +71 -0
  540. package/dist/helper/Base64.js.map +1 -0
  541. package/dist/helper/Debugger.d.ts +179 -0
  542. package/dist/helper/Debugger.d.ts.map +1 -0
  543. package/dist/helper/Debugger.js +250 -0
  544. package/dist/helper/Debugger.js.map +1 -0
  545. package/dist/helper/ZipUtils.d.ts +2 -0
  546. package/dist/helper/ZipUtils.d.ts.map +1 -0
  547. package/dist/helper/ZipUtils.js +20 -0
  548. package/dist/helper/ZipUtils.js.map +1 -0
  549. package/dist/helper/async.d.ts +49 -0
  550. package/dist/helper/async.d.ts.map +1 -0
  551. package/dist/helper/async.js +95 -0
  552. package/dist/helper/async.js.map +1 -0
  553. package/dist/helper/checkType.d.ts +8 -0
  554. package/dist/helper/checkType.d.ts.map +1 -0
  555. package/dist/helper/checkType.js +31 -0
  556. package/dist/helper/checkType.js.map +1 -0
  557. package/dist/helper/engine.d.ts +6 -0
  558. package/dist/helper/engine.d.ts.map +1 -0
  559. package/dist/helper/engine.js +115 -0
  560. package/dist/helper/engine.js.map +1 -0
  561. package/dist/helper/getset.d.ts +2 -0
  562. package/dist/helper/getset.d.ts.map +1 -0
  563. package/dist/helper/getset.js +51 -0
  564. package/dist/helper/getset.js.map +1 -0
  565. package/dist/helper/global.d.ts +6 -0
  566. package/dist/helper/global.d.ts.map +1 -0
  567. package/dist/helper/global.js +6 -0
  568. package/dist/helper/global.js.map +1 -0
  569. package/dist/helper/index.d.ts +3 -0
  570. package/dist/helper/index.d.ts.map +1 -0
  571. package/dist/helper/index.js +3 -0
  572. package/dist/helper/index.js.map +1 -0
  573. package/dist/helper/loader.d.ts +102 -0
  574. package/dist/helper/loader.d.ts.map +1 -0
  575. package/dist/helper/loader.js +447 -0
  576. package/dist/helper/loader.js.map +1 -0
  577. package/dist/helper/path.d.ts +12 -0
  578. package/dist/helper/path.d.ts.map +1 -0
  579. package/dist/helper/path.js +75 -0
  580. package/dist/helper/path.js.map +1 -0
  581. package/dist/helper/string.d.ts +2 -0
  582. package/dist/helper/string.d.ts.map +1 -0
  583. package/dist/helper/string.js +32 -0
  584. package/dist/helper/string.js.map +1 -0
  585. package/dist/helper/sys.d.ts +446 -0
  586. package/dist/helper/sys.d.ts.map +1 -0
  587. package/dist/helper/sys.js +691 -0
  588. package/dist/helper/sys.js.map +1 -0
  589. package/dist/index.d.ts +11 -0
  590. package/dist/index.d.ts.map +1 -0
  591. package/dist/index.js +11 -0
  592. package/dist/index.js.map +1 -0
  593. package/dist/motion-streak/MotionStreak.d.ts +56 -0
  594. package/dist/motion-streak/MotionStreak.d.ts.map +1 -0
  595. package/dist/motion-streak/MotionStreak.js +301 -0
  596. package/dist/motion-streak/MotionStreak.js.map +1 -0
  597. package/dist/motion-streak/MotionStreakWebGLRenderCmd.d.ts +9 -0
  598. package/dist/motion-streak/MotionStreakWebGLRenderCmd.d.ts.map +1 -0
  599. package/dist/motion-streak/MotionStreakWebGLRenderCmd.js +52 -0
  600. package/dist/motion-streak/MotionStreakWebGLRenderCmd.js.map +1 -0
  601. package/dist/motion-streak/index.d.ts +2 -0
  602. package/dist/motion-streak/index.d.ts.map +1 -0
  603. package/dist/motion-streak/index.js +2 -0
  604. package/dist/motion-streak/index.js.map +1 -0
  605. package/dist/particle/PNGReader.d.ts +30 -0
  606. package/dist/particle/PNGReader.d.ts.map +1 -0
  607. package/dist/particle/PNGReader.js +304 -0
  608. package/dist/particle/PNGReader.js.map +1 -0
  609. package/dist/particle/Particle.d.ts +27 -0
  610. package/dist/particle/Particle.d.ts.map +1 -0
  611. package/dist/particle/Particle.js +50 -0
  612. package/dist/particle/Particle.js.map +1 -0
  613. package/dist/particle/ParticleBatchNode.d.ts +163 -0
  614. package/dist/particle/ParticleBatchNode.d.ts.map +1 -0
  615. package/dist/particle/ParticleBatchNode.js +447 -0
  616. package/dist/particle/ParticleBatchNode.js.map +1 -0
  617. package/dist/particle/ParticleBatchNodeWebGLRenderCmd.d.ts +8 -0
  618. package/dist/particle/ParticleBatchNodeWebGLRenderCmd.d.ts.map +1 -0
  619. package/dist/particle/ParticleBatchNodeWebGLRenderCmd.js +33 -0
  620. package/dist/particle/ParticleBatchNodeWebGLRenderCmd.js.map +1 -0
  621. package/dist/particle/ParticleSystem.d.ts +941 -0
  622. package/dist/particle/ParticleSystem.d.ts.map +1 -0
  623. package/dist/particle/ParticleSystem.js +2017 -0
  624. package/dist/particle/ParticleSystem.js.map +1 -0
  625. package/dist/particle/ParticleSystemWebGLRenderCmd.d.ts +29 -0
  626. package/dist/particle/ParticleSystemWebGLRenderCmd.d.ts.map +1 -0
  627. package/dist/particle/ParticleSystemWebGLRenderCmd.js +346 -0
  628. package/dist/particle/ParticleSystemWebGLRenderCmd.js.map +1 -0
  629. package/dist/particle/TIFFReader.d.ts +138 -0
  630. package/dist/particle/TIFFReader.d.ts.map +1 -0
  631. package/dist/particle/TIFFReader.js +596 -0
  632. package/dist/particle/TIFFReader.js.map +1 -0
  633. package/dist/particle/examples/ParticleFire.d.ts +60 -0
  634. package/dist/particle/examples/ParticleFire.d.ts.map +1 -0
  635. package/dist/particle/examples/ParticleFire.js +188 -0
  636. package/dist/particle/examples/ParticleFire.js.map +1 -0
  637. package/dist/particle/examples/ParticleGalaxy.d.ts +60 -0
  638. package/dist/particle/examples/ParticleGalaxy.d.ts.map +1 -0
  639. package/dist/particle/examples/ParticleGalaxy.js +199 -0
  640. package/dist/particle/examples/ParticleGalaxy.js.map +1 -0
  641. package/dist/particle/examples/ParticleSmoke.d.ts +60 -0
  642. package/dist/particle/examples/ParticleSmoke.d.ts.map +1 -0
  643. package/dist/particle/examples/ParticleSmoke.js +195 -0
  644. package/dist/particle/examples/ParticleSmoke.js.map +1 -0
  645. package/dist/particle/examples/ParticleSpiral.d.ts +38 -0
  646. package/dist/particle/examples/ParticleSpiral.d.ts.map +1 -0
  647. package/dist/particle/examples/ParticleSpiral.js +130 -0
  648. package/dist/particle/examples/ParticleSpiral.js.map +1 -0
  649. package/dist/particle/examples/index.d.ts +5 -0
  650. package/dist/particle/examples/index.d.ts.map +1 -0
  651. package/dist/particle/examples/index.js +5 -0
  652. package/dist/particle/examples/index.js.map +1 -0
  653. package/dist/particle/index.d.ts +2 -0
  654. package/dist/particle/index.d.ts.map +1 -0
  655. package/dist/particle/index.js +2 -0
  656. package/dist/particle/index.js.map +1 -0
  657. package/dist/polyfills.d.ts +34 -0
  658. package/dist/polyfills.d.ts.map +1 -0
  659. package/dist/polyfills.js +102 -0
  660. package/dist/polyfills.js.map +1 -0
  661. package/dist/progress-timer/ActionProgressTimer.d.ts +118 -0
  662. package/dist/progress-timer/ActionProgressTimer.d.ts.map +1 -0
  663. package/dist/progress-timer/ActionProgressTimer.js +173 -0
  664. package/dist/progress-timer/ActionProgressTimer.js.map +1 -0
  665. package/dist/progress-timer/ProgressTimer.d.ts +143 -0
  666. package/dist/progress-timer/ProgressTimer.d.ts.map +1 -0
  667. package/dist/progress-timer/ProgressTimer.js +228 -0
  668. package/dist/progress-timer/ProgressTimer.js.map +1 -0
  669. package/dist/progress-timer/ProgressTimerWebGLRenderCmd.d.ts +56 -0
  670. package/dist/progress-timer/ProgressTimerWebGLRenderCmd.d.ts.map +1 -0
  671. package/dist/progress-timer/ProgressTimerWebGLRenderCmd.js +445 -0
  672. package/dist/progress-timer/ProgressTimerWebGLRenderCmd.js.map +1 -0
  673. package/dist/progress-timer/index.d.ts +3 -0
  674. package/dist/progress-timer/index.d.ts.map +1 -0
  675. package/dist/progress-timer/index.js +3 -0
  676. package/dist/progress-timer/index.js.map +1 -0
  677. package/dist/render-texture/RenderTexture.d.ts +226 -0
  678. package/dist/render-texture/RenderTexture.d.ts.map +1 -0
  679. package/dist/render-texture/RenderTexture.js +332 -0
  680. package/dist/render-texture/RenderTexture.js.map +1 -0
  681. package/dist/render-texture/RenderTextureWebGLRenderCmd.d.ts +28 -0
  682. package/dist/render-texture/RenderTextureWebGLRenderCmd.d.ts.map +1 -0
  683. package/dist/render-texture/RenderTextureWebGLRenderCmd.js +276 -0
  684. package/dist/render-texture/RenderTextureWebGLRenderCmd.js.map +1 -0
  685. package/dist/render-texture/index.d.ts +2 -0
  686. package/dist/render-texture/index.d.ts.map +1 -0
  687. package/dist/render-texture/index.js +2 -0
  688. package/dist/render-texture/index.js.map +1 -0
  689. package/dist/shaders/GLProgram.d.ts +288 -0
  690. package/dist/shaders/GLProgram.d.ts.map +1 -0
  691. package/dist/shaders/GLProgram.js +794 -0
  692. package/dist/shaders/GLProgram.js.map +1 -0
  693. package/dist/shaders/GLProgramState.d.ts +58 -0
  694. package/dist/shaders/GLProgramState.d.ts.map +1 -0
  695. package/dist/shaders/GLProgramState.js +255 -0
  696. package/dist/shaders/GLProgramState.js.map +1 -0
  697. package/dist/shaders/GLStateCache.d.ts +97 -0
  698. package/dist/shaders/GLStateCache.d.ts.map +1 -0
  699. package/dist/shaders/GLStateCache.js +255 -0
  700. package/dist/shaders/GLStateCache.js.map +1 -0
  701. package/dist/shaders/ShaderCache.d.ts +111 -0
  702. package/dist/shaders/ShaderCache.d.ts.map +1 -0
  703. package/dist/shaders/ShaderCache.js +273 -0
  704. package/dist/shaders/ShaderCache.js.map +1 -0
  705. package/dist/shaders/Shaders.d.ts +84 -0
  706. package/dist/shaders/Shaders.d.ts.map +1 -0
  707. package/dist/shaders/Shaders.js +250 -0
  708. package/dist/shaders/Shaders.js.map +1 -0
  709. package/dist/shaders/index.d.ts +5 -0
  710. package/dist/shaders/index.d.ts.map +1 -0
  711. package/dist/shaders/index.js +5 -0
  712. package/dist/shaders/index.js.map +1 -0
  713. package/dist/shape-nodes/DrawNode.d.ts +61 -0
  714. package/dist/shape-nodes/DrawNode.d.ts.map +1 -0
  715. package/dist/shape-nodes/DrawNode.js +597 -0
  716. package/dist/shape-nodes/DrawNode.js.map +1 -0
  717. package/dist/shape-nodes/DrawNodeWebGLRenderCmd.d.ts +11 -0
  718. package/dist/shape-nodes/DrawNodeWebGLRenderCmd.d.ts.map +1 -0
  719. package/dist/shape-nodes/DrawNodeWebGLRenderCmd.js +27 -0
  720. package/dist/shape-nodes/DrawNodeWebGLRenderCmd.js.map +1 -0
  721. package/dist/text-input/IMEDispatcher.d.ts +180 -0
  722. package/dist/text-input/IMEDispatcher.d.ts.map +1 -0
  723. package/dist/text-input/IMEDispatcher.js +454 -0
  724. package/dist/text-input/IMEDispatcher.js.map +1 -0
  725. package/dist/text-input/TextFieldTTF.d.ts +219 -0
  726. package/dist/text-input/TextFieldTTF.d.ts.map +1 -0
  727. package/dist/text-input/TextFieldTTF.js +381 -0
  728. package/dist/text-input/TextFieldTTF.js.map +1 -0
  729. package/dist/textures/Texture2D.d.ts +10 -0
  730. package/dist/textures/Texture2D.d.ts.map +1 -0
  731. package/dist/textures/Texture2D.js +10 -0
  732. package/dist/textures/Texture2D.js.map +1 -0
  733. package/dist/textures/TextureAtlas.d.ts +204 -0
  734. package/dist/textures/TextureAtlas.d.ts.map +1 -0
  735. package/dist/textures/TextureAtlas.js +602 -0
  736. package/dist/textures/TextureAtlas.js.map +1 -0
  737. package/dist/textures/TextureCache.d.ts +147 -0
  738. package/dist/textures/TextureCache.d.ts.map +1 -0
  739. package/dist/textures/TextureCache.js +327 -0
  740. package/dist/textures/TextureCache.js.map +1 -0
  741. package/dist/textures/TexturesPropertyDefine.d.ts +2 -0
  742. package/dist/textures/TexturesPropertyDefine.d.ts.map +1 -0
  743. package/dist/textures/TexturesPropertyDefine.js +39 -0
  744. package/dist/textures/TexturesPropertyDefine.js.map +1 -0
  745. package/dist/textures/TexturesWebGL.d.ts +349 -0
  746. package/dist/textures/TexturesWebGL.d.ts.map +1 -0
  747. package/dist/textures/TexturesWebGL.js +765 -0
  748. package/dist/textures/TexturesWebGL.js.map +1 -0
  749. package/dist/textures/WebGLTextureCache.d.ts +2 -0
  750. package/dist/textures/WebGLTextureCache.d.ts.map +1 -0
  751. package/dist/textures/WebGLTextureCache.js +79 -0
  752. package/dist/textures/WebGLTextureCache.js.map +1 -0
  753. package/dist/textures/index.d.ts +3 -0
  754. package/dist/textures/index.d.ts.map +1 -0
  755. package/dist/textures/index.js +3 -0
  756. package/dist/textures/index.js.map +1 -0
  757. package/dist/tilemap/TGAlib.d.ts +103 -0
  758. package/dist/tilemap/TGAlib.d.ts.map +1 -0
  759. package/dist/tilemap/TGAlib.js +338 -0
  760. package/dist/tilemap/TGAlib.js.map +1 -0
  761. package/dist/tilemap/TMXLayer.d.ts +225 -0
  762. package/dist/tilemap/TMXLayer.d.ts.map +1 -0
  763. package/dist/tilemap/TMXLayer.js +694 -0
  764. package/dist/tilemap/TMXLayer.js.map +1 -0
  765. package/dist/tilemap/TMXLayerInfo.d.ts +42 -0
  766. package/dist/tilemap/TMXLayerInfo.d.ts.map +1 -0
  767. package/dist/tilemap/TMXLayerInfo.js +57 -0
  768. package/dist/tilemap/TMXLayerInfo.js.map +1 -0
  769. package/dist/tilemap/TMXLayerWebGLRenderCmd.d.ts +17 -0
  770. package/dist/tilemap/TMXLayerWebGLRenderCmd.d.ts.map +1 -0
  771. package/dist/tilemap/TMXLayerWebGLRenderCmd.js +209 -0
  772. package/dist/tilemap/TMXLayerWebGLRenderCmd.js.map +1 -0
  773. package/dist/tilemap/TMXMapInfo.d.ts +210 -0
  774. package/dist/tilemap/TMXMapInfo.d.ts.map +1 -0
  775. package/dist/tilemap/TMXMapInfo.js +614 -0
  776. package/dist/tilemap/TMXMapInfo.js.map +1 -0
  777. package/dist/tilemap/TMXObjectGroup.d.ts +70 -0
  778. package/dist/tilemap/TMXObjectGroup.d.ts.map +1 -0
  779. package/dist/tilemap/TMXObjectGroup.js +106 -0
  780. package/dist/tilemap/TMXObjectGroup.js.map +1 -0
  781. package/dist/tilemap/TMXTiledMap.d.ts +163 -0
  782. package/dist/tilemap/TMXTiledMap.d.ts.map +1 -0
  783. package/dist/tilemap/TMXTiledMap.js +347 -0
  784. package/dist/tilemap/TMXTiledMap.js.map +1 -0
  785. package/dist/tilemap/TMXTilesetInfo.d.ts +38 -0
  786. package/dist/tilemap/TMXTilesetInfo.d.ts.map +1 -0
  787. package/dist/tilemap/TMXTilesetInfo.js +59 -0
  788. package/dist/tilemap/TMXTilesetInfo.js.map +1 -0
  789. package/dist/tilemap/TMXXMLParser.d.ts +52 -0
  790. package/dist/tilemap/TMXXMLParser.d.ts.map +1 -0
  791. package/dist/tilemap/TMXXMLParser.js +52 -0
  792. package/dist/tilemap/TMXXMLParser.js.map +1 -0
  793. package/dist/tilemap/index.d.ts +4 -0
  794. package/dist/tilemap/index.d.ts.map +1 -0
  795. package/dist/tilemap/index.js +4 -0
  796. package/dist/tilemap/index.js.map +1 -0
  797. package/dist/ui/base/FocusNavigationController.d.ts +12 -0
  798. package/dist/ui/base/FocusNavigationController.d.ts.map +1 -0
  799. package/dist/ui/base/FocusNavigationController.js +54 -0
  800. package/dist/ui/base/FocusNavigationController.js.map +1 -0
  801. package/dist/ui/base/ProtectedNode.d.ts +66 -0
  802. package/dist/ui/base/ProtectedNode.d.ts.map +1 -0
  803. package/dist/ui/base/ProtectedNode.js +248 -0
  804. package/dist/ui/base/ProtectedNode.js.map +1 -0
  805. package/dist/ui/base/ProtectedNodeWebGLRenderCmd.d.ts +13 -0
  806. package/dist/ui/base/ProtectedNodeWebGLRenderCmd.d.ts.map +1 -0
  807. package/dist/ui/base/ProtectedNodeWebGLRenderCmd.js +136 -0
  808. package/dist/ui/base/ProtectedNodeWebGLRenderCmd.js.map +1 -0
  809. package/dist/ui/base/UIHelper.d.ts +48 -0
  810. package/dist/ui/base/UIHelper.d.ts.map +1 -0
  811. package/dist/ui/base/UIHelper.js +128 -0
  812. package/dist/ui/base/UIHelper.js.map +1 -0
  813. package/dist/ui/base/UIScale9Sprite.d.ts +224 -0
  814. package/dist/ui/base/UIScale9Sprite.d.ts.map +1 -0
  815. package/dist/ui/base/UIScale9Sprite.js +825 -0
  816. package/dist/ui/base/UIScale9Sprite.js.map +1 -0
  817. package/dist/ui/base/UIScale9SpriteWebGLRenderCmd.d.ts +15 -0
  818. package/dist/ui/base/UIScale9SpriteWebGLRenderCmd.d.ts.map +1 -0
  819. package/dist/ui/base/UIScale9SpriteWebGLRenderCmd.js +119 -0
  820. package/dist/ui/base/UIScale9SpriteWebGLRenderCmd.js.map +1 -0
  821. package/dist/ui/base/UIWidget.d.ts +794 -0
  822. package/dist/ui/base/UIWidget.d.ts.map +1 -0
  823. package/dist/ui/base/UIWidget.js +1634 -0
  824. package/dist/ui/base/UIWidget.js.map +1 -0
  825. package/dist/ui/base/UIWidgetRenderCmd.d.ts +9 -0
  826. package/dist/ui/base/UIWidgetRenderCmd.d.ts.map +1 -0
  827. package/dist/ui/base/UIWidgetRenderCmd.js +41 -0
  828. package/dist/ui/base/UIWidgetRenderCmd.js.map +1 -0
  829. package/dist/ui/index.d.ts +9 -0
  830. package/dist/ui/index.d.ts.map +1 -0
  831. package/dist/ui/index.js +9 -0
  832. package/dist/ui/index.js.map +1 -0
  833. package/dist/ui/layout/UILayout.d.ts +486 -0
  834. package/dist/ui/layout/UILayout.d.ts.map +1 -0
  835. package/dist/ui/layout/UILayout.js +1430 -0
  836. package/dist/ui/layout/UILayout.js.map +1 -0
  837. package/dist/ui/layout/UILayoutParameter.d.ts +344 -0
  838. package/dist/ui/layout/UILayoutParameter.d.ts.map +1 -0
  839. package/dist/ui/layout/UILayoutParameter.js +444 -0
  840. package/dist/ui/layout/UILayoutParameter.js.map +1 -0
  841. package/dist/ui/layout/UILayoutWebGLRenderCmd.d.ts +30 -0
  842. package/dist/ui/layout/UILayoutWebGLRenderCmd.d.ts.map +1 -0
  843. package/dist/ui/layout/UILayoutWebGLRenderCmd.js +136 -0
  844. package/dist/ui/layout/UILayoutWebGLRenderCmd.js.map +1 -0
  845. package/dist/ui/layout/constant.d.ts +30 -0
  846. package/dist/ui/layout/constant.d.ts.map +1 -0
  847. package/dist/ui/layout/constant.js +31 -0
  848. package/dist/ui/layout/constant.js.map +1 -0
  849. package/dist/ui/widget/UIButton.d.ts +248 -0
  850. package/dist/ui/widget/UIButton.d.ts.map +1 -0
  851. package/dist/ui/widget/UIButton.js +727 -0
  852. package/dist/ui/widget/UIButton.js.map +1 -0
  853. package/dist/ui/widget/UIRichText.d.ts +216 -0
  854. package/dist/ui/widget/UIRichText.d.ts.map +1 -0
  855. package/dist/ui/widget/UIRichText.js +549 -0
  856. package/dist/ui/widget/UIRichText.js.map +1 -0
  857. package/dist/ui/widget/UIScrollView.d.ts +547 -0
  858. package/dist/ui/widget/UIScrollView.d.ts.map +1 -0
  859. package/dist/ui/widget/UIScrollView.js +1544 -0
  860. package/dist/ui/widget/UIScrollView.js.map +1 -0
  861. package/dist/ui/widget/UIScrollViewBar.d.ts +101 -0
  862. package/dist/ui/widget/UIScrollViewBar.d.ts.map +1 -0
  863. package/dist/ui/widget/UIScrollViewBar.js +277 -0
  864. package/dist/ui/widget/UIScrollViewBar.js.map +1 -0
  865. package/dist/ui/widget/UIScrollViewWebGLRenderCmd.d.ts +10 -0
  866. package/dist/ui/widget/UIScrollViewWebGLRenderCmd.d.ts.map +1 -0
  867. package/dist/ui/widget/UIScrollViewWebGLRenderCmd.js +42 -0
  868. package/dist/ui/widget/UIScrollViewWebGLRenderCmd.js.map +1 -0
  869. package/dist/ui/widget/UISlider.d.ts +229 -0
  870. package/dist/ui/widget/UISlider.d.ts.map +1 -0
  871. package/dist/ui/widget/UISlider.js +667 -0
  872. package/dist/ui/widget/UISlider.js.map +1 -0
  873. package/dist/ui/widget/UIText.d.ts +90 -0
  874. package/dist/ui/widget/UIText.d.ts.map +1 -0
  875. package/dist/ui/widget/UIText.js +325 -0
  876. package/dist/ui/widget/UIText.js.map +1 -0
  877. package/dist/ui/widget/UITextField.d.ts +282 -0
  878. package/dist/ui/widget/UITextField.d.ts.map +1 -0
  879. package/dist/ui/widget/UITextField.js +549 -0
  880. package/dist/ui/widget/UITextField.js.map +1 -0
  881. package/dist/ui/widget/UITextFieldRenderer.d.ts +41 -0
  882. package/dist/ui/widget/UITextFieldRenderer.d.ts.map +1 -0
  883. package/dist/ui/widget/UITextFieldRenderer.js +150 -0
  884. package/dist/ui/widget/UITextFieldRenderer.js.map +1 -0
  885. package/eslint.config.ts +59 -0
  886. package/index.html +22 -0
  887. package/package.json +38 -0
  888. package/res/Button.mp3 +0 -0
  889. package/res/SmallSun.plist +108 -0
  890. package/res/Spiral.plist +102 -0
  891. package/res/base.png +0 -0
  892. package/res/button.png +0 -0
  893. package/res/button_plus.png +0 -0
  894. package/res/ortho-test1.png +0 -0
  895. package/res/orthogonal-test1.tmx +9 -0
  896. package/res/orthogonal-test1.tsx +4 -0
  897. package/res/particle.png +0 -0
  898. package/res/sliderThumb.png +0 -0
  899. package/res/sliderTrack.png +0 -0
  900. package/res/streak.png +0 -0
  901. package/res/ui.plist +578 -0
  902. package/res/ui.png +0 -0
  903. package/res/vite.svg +1 -0
  904. package/test/ActionScene.ts +15 -0
  905. package/test/DemoScene.ts +108 -0
  906. package/test/GraphicsTest.ts +17 -0
  907. package/test/ParticleScene.ts +24 -0
  908. package/test/TiledMapScene.ts +14 -0
  909. package/test/index.ts +28 -0
  910. package/vite.config.ts +13 -0
@@ -0,0 +1,1430 @@
1
+ import { pLength, pSub, Sprite } from '../../core';
2
+ import { Node } from '../../core/base-nodes/Node';
3
+ import { p, Rect, Size } from '../../core/cocoa/Geometry';
4
+ import { Color, color, FLT_MAX } from '../../core/platform';
5
+ import { assert, log } from '../../helper/Debugger';
6
+ import { DrawNode } from '../../shape-nodes/DrawNode';
7
+ import { Scale9Sprite } from '../base/UIScale9Sprite';
8
+ import { Widget } from '../base/UIWidget';
9
+ import { LayoutParameter, LinearLayoutParameter, RelativeLayoutParameter } from './UILayoutParameter';
10
+ import { LayoutWebGLRenderCmd } from './UILayoutWebGLRenderCmd';
11
+ export class Layout extends Widget {
12
+ _clippingEnabled = false;
13
+ _bgImageTexType = Widget.LOCAL_TEXTURE;
14
+ _opacity = 255;
15
+ _doLayoutDirty = true;
16
+ _clippingRectDirty = true;
17
+ _clippingStencil;
18
+ _scissorRectDirty = false;
19
+ _className = 'Layout';
20
+ _finalPositionX = 0;
21
+ _finalPositionY = 0;
22
+ _backGroundImageOpacity = 0;
23
+ _loopFocus = false; //whether enable loop focus or not
24
+ __passFocusToChild = true; //on default, it will pass the focus to the next nearest widget
25
+ _isFocusPassing = false; //when finding the next focused widget, use this variable to pass focus between layout & widget
26
+ _isInterceptTouch = false;
27
+ /**
28
+ * To specify a user-defined functor to decide which child widget of the layout should get focused
29
+ * @function
30
+ * @param {Number} direction
31
+ * @param {Widget} current
32
+ */
33
+ onPassFocusToChild = null;
34
+ /**
35
+ * Allocates and initializes an UILayout.
36
+ * Constructor of Layout
37
+ * @function
38
+ * @example
39
+ * // example
40
+ * var uiLayout = new Layout();
41
+ */
42
+ constructor() {
43
+ super();
44
+ this._layoutType = Layout.ABSOLUTE;
45
+ this._widgetType = Widget.TYPE_CONTAINER;
46
+ this._clippingType = Layout.CLIPPING_SCISSOR;
47
+ this._colorType = Layout.BG_COLOR_NONE;
48
+ this.ignoreContentAdaptWithSize(false);
49
+ this.setContentSize(Size(0, 0));
50
+ this.setAnchorPoint(0, 0);
51
+ this.onPassFocusToChild = this._findNearestChildWidgetIndex.bind(this);
52
+ this._backGroundImageCapInsets = Rect(0, 0, 0, 0);
53
+ this._color = color(255, 255, 255, 255);
54
+ this._startColor = color(255, 255, 255, 255);
55
+ this._endColor = color(255, 255, 255, 255);
56
+ this._alongVector = p(0, -1);
57
+ this._backGroundImageTextureSize = Size(0, 0);
58
+ this._clippingRect = Rect(0, 0, 0, 0);
59
+ this._backGroundImageColor = color(255, 255, 255, 255);
60
+ }
61
+ /**
62
+ * Calls its parent's onEnter, and calls its clippingStencil's onEnter if clippingStencil isn't null.
63
+ * @override
64
+ */
65
+ onEnter() {
66
+ super.onEnter();
67
+ if (this._clippingStencil)
68
+ this._clippingStencil._performRecursive(Node._stateCallbackType.onEnter);
69
+ this._doLayoutDirty = true;
70
+ this._clippingRectDirty = true;
71
+ }
72
+ /**
73
+ * Calls its parent's onExit, and calls its clippingStencil's onExit if clippingStencil isn't null.
74
+ * @override
75
+ */
76
+ onExit() {
77
+ super.onExit();
78
+ if (this._clippingStencil)
79
+ this._clippingStencil._performRecursive(Node._stateCallbackType.onExit);
80
+ }
81
+ /**
82
+ * <p>
83
+ * Calls adaptRenderers (its subclass will override it.) and do layout.
84
+ * If clippingEnabled is true, it will clip/scissor area.
85
+ * </p>
86
+ * @override
87
+ * @param {Node} [parent]
88
+ */
89
+ visit(parent) {
90
+ const cmd = this._renderCmd, parentCmd = parent ? parent._renderCmd : null;
91
+ // quick return if not visible
92
+ if (!this._visible) {
93
+ cmd._propagateFlagsDown(parentCmd);
94
+ return;
95
+ }
96
+ this._adaptRenderers();
97
+ this._doLayout();
98
+ cmd.visit(parentCmd);
99
+ const stencilClipping = this._clippingEnabled && this._clippingType === Layout.CLIPPING_STENCIL;
100
+ const scissorClipping = this._clippingEnabled && this._clippingType === Layout.CLIPPING_SCISSOR;
101
+ if (stencilClipping) {
102
+ cmd.stencilClippingVisit(parentCmd);
103
+ }
104
+ else if (scissorClipping) {
105
+ cmd.scissorClippingVisit(parentCmd);
106
+ }
107
+ let i;
108
+ const children = this._children;
109
+ const len = children.length;
110
+ let child;
111
+ let j;
112
+ const pChildren = this._protectedChildren;
113
+ const pLen = pChildren.length;
114
+ let pChild;
115
+ if (this._reorderChildDirty)
116
+ this.sortAllChildren();
117
+ if (this._reorderProtectedChildDirty)
118
+ this.sortAllProtectedChildren();
119
+ // draw children zOrder < 0
120
+ for (i = 0; i < len; i++) {
121
+ child = children[i];
122
+ if (child._localZOrder < 0) {
123
+ child.visit(this);
124
+ }
125
+ else
126
+ break;
127
+ }
128
+ for (j = 0; j < pLen; j++) {
129
+ pChild = pChildren[j];
130
+ if (pChild._localZOrder < 0) {
131
+ cmd._changeProtectedChild(pChild);
132
+ pChild.visit(this);
133
+ }
134
+ else
135
+ break;
136
+ }
137
+ // draw children zOrder >= 0
138
+ for (; i < len; i++) {
139
+ children[i].visit(this);
140
+ }
141
+ for (; j < pLen; j++) {
142
+ pChild = pChildren[j];
143
+ cmd._changeProtectedChild(pChild);
144
+ pChild.visit(this);
145
+ }
146
+ if (stencilClipping) {
147
+ cmd.postStencilVisit();
148
+ }
149
+ else if (scissorClipping) {
150
+ cmd.postScissorVisit();
151
+ }
152
+ cmd._dirtyFlag = 0;
153
+ }
154
+ /**
155
+ * If a layout is loop focused which means that the focus movement will be inside the layout
156
+ * @param {Boolean} loop pass true to let the focus movement loop inside the layout
157
+ */
158
+ setLoopFocus(loop) {
159
+ this._loopFocus = loop;
160
+ }
161
+ /**
162
+ * Gets whether enable focus loop
163
+ * @returns {boolean} If focus loop is enabled, then it will return true, otherwise it returns false. The default value is false.
164
+ */
165
+ isLoopFocus() {
166
+ return this._loopFocus;
167
+ }
168
+ /**
169
+ * Specifies whether the layout pass its focus to its child
170
+ * @param pass To specify whether the layout pass its focus to its child
171
+ */
172
+ setPassFocusToChild(pass) {
173
+ this.__passFocusToChild = pass;
174
+ }
175
+ /**
176
+ * Returns whether the layout will pass the focus to its children or not. The default value is true
177
+ * @returns {boolean} To query whether the layout will pass the focus to its children or not. The default value is true
178
+ */
179
+ isPassFocusToChild() {
180
+ return this.__passFocusToChild;
181
+ }
182
+ /**
183
+ * When a widget is in a layout, you could call this method to get the next focused widget within a specified direction.
184
+ * If the widget is not in a layout, it will return itself
185
+ * @param {Number} direction the direction to look for the next focused widget in a layout
186
+ * @param {Widget} current the current focused widget
187
+ * @returns {Widget} return the index of widget in the layout
188
+ */
189
+ findNextFocusedWidget(direction, current) {
190
+ if (this._isFocusPassing || this.isFocused()) {
191
+ const parent = this.getParent();
192
+ this._isFocusPassing = false;
193
+ if (this.__passFocusToChild) {
194
+ const w = this._passFocusToChild(direction, current);
195
+ if (w instanceof Layout && parent) {
196
+ parent._isFocusPassing = true;
197
+ return parent.findNextFocusedWidget(direction, this);
198
+ }
199
+ return w;
200
+ }
201
+ if (null == parent || !(parent instanceof Layout))
202
+ return this;
203
+ parent._isFocusPassing = true;
204
+ return parent.findNextFocusedWidget(direction, this);
205
+ }
206
+ else if (current.isFocused() || current instanceof Layout) {
207
+ if (this._layoutType === Layout.LINEAR_HORIZONTAL) {
208
+ switch (direction) {
209
+ case Widget.LEFT:
210
+ return this._getPreviousFocusedWidget(direction, current);
211
+ break;
212
+ case Widget.RIGHT:
213
+ return this._getNextFocusedWidget(direction, current);
214
+ break;
215
+ case Widget.DOWN:
216
+ case Widget.UP:
217
+ if (this._isLastWidgetInContainer(this, direction)) {
218
+ if (this._isWidgetAncestorSupportLoopFocus(current, direction))
219
+ return Widget.prototype.findNextFocusedWidget.call(this, direction, this);
220
+ return current;
221
+ }
222
+ else {
223
+ return Widget.prototype.findNextFocusedWidget.call(this, direction, this);
224
+ }
225
+ break;
226
+ default:
227
+ assert(0, 'Invalid Focus Direction');
228
+ return current;
229
+ }
230
+ }
231
+ else if (this._layoutType === Layout.LINEAR_VERTICAL) {
232
+ switch (direction) {
233
+ case Widget.LEFT:
234
+ case Widget.RIGHT:
235
+ if (this._isLastWidgetInContainer(this, direction)) {
236
+ if (this._isWidgetAncestorSupportLoopFocus(current, direction))
237
+ return Widget.prototype.findNextFocusedWidget.call(this, direction, this);
238
+ return current;
239
+ }
240
+ else
241
+ return Widget.prototype.findNextFocusedWidget.call(this, direction, this);
242
+ case Widget.DOWN:
243
+ return this._getNextFocusedWidget(direction, current);
244
+ case Widget.UP:
245
+ return this._getPreviousFocusedWidget(direction, current);
246
+ default:
247
+ assert(0, 'Invalid Focus Direction');
248
+ return current;
249
+ }
250
+ }
251
+ else {
252
+ assert(0, 'Un Supported Layout type, please use VBox and HBox instead!!!');
253
+ return current;
254
+ }
255
+ }
256
+ else
257
+ return current;
258
+ }
259
+ /**
260
+ * Adds a widget to the container.
261
+ * @param {Widget} widget
262
+ * @param {Number} [zOrder]
263
+ * @param {Number|string} [tag] tag or name
264
+ * @override
265
+ */
266
+ addChild(widget, zOrder, tag) {
267
+ if (widget instanceof Widget) {
268
+ this._supplyTheLayoutParameterLackToChild(widget);
269
+ }
270
+ Widget.prototype.addChild.call(this, widget, zOrder, tag);
271
+ this._doLayoutDirty = true;
272
+ }
273
+ /**
274
+ * Removes child widget from Layout, and sets the layout dirty flag to true.
275
+ * @param {Widget} widget
276
+ * @param {Boolean} [cleanup=true]
277
+ * @override
278
+ */
279
+ removeChild(widget, cleanup) {
280
+ Widget.prototype.removeChild.call(this, widget, cleanup);
281
+ this._doLayoutDirty = true;
282
+ }
283
+ /**
284
+ * Removes all children from the container with a cleanup, and sets the layout dirty flag to true.
285
+ * @param {Boolean} cleanup
286
+ */
287
+ removeAllChildren(cleanup) {
288
+ Widget.prototype.removeAllChildren.call(this, cleanup);
289
+ this._doLayoutDirty = true;
290
+ }
291
+ /**
292
+ * Removes all children from the container, do a cleanup to all running actions depending on the cleanup parameter,
293
+ * and sets the layout dirty flag to true.
294
+ * @param {Boolean} cleanup true if all running actions on all children nodes should be cleanup, false otherwise.
295
+ */
296
+ removeAllChildrenWithCleanup(cleanup) {
297
+ Widget.prototype.removeAllChildrenWithCleanup.call(this, cleanup);
298
+ this._doLayoutDirty = true;
299
+ }
300
+ /**
301
+ * Gets if layout is clipping enabled.
302
+ * @returns {Boolean} if layout is clipping enabled.
303
+ */
304
+ isClippingEnabled() {
305
+ return this._clippingEnabled;
306
+ }
307
+ /**
308
+ * Changes if layout can clip it's content and locChild.
309
+ * If you really need this, please enable it. But it would reduce the rendering efficiency.
310
+ * @param {Boolean} able clipping enabled.
311
+ */
312
+ setClippingEnabled(able) {
313
+ if (able === this._clippingEnabled)
314
+ return;
315
+ this._clippingEnabled = able;
316
+ switch (this._clippingType) {
317
+ case Layout.CLIPPING_SCISSOR:
318
+ case Layout.CLIPPING_STENCIL:
319
+ if (able) {
320
+ this._clippingStencil = new DrawNode();
321
+ this._renderCmd.rebindStencilRendering(this._clippingStencil);
322
+ if (this._running)
323
+ this._clippingStencil._performRecursive(Node._stateCallbackType.onEnter);
324
+ this._setStencilClippingSize(this._contentSize);
325
+ }
326
+ else {
327
+ if (this._running && this._clippingStencil)
328
+ this._clippingStencil._performRecursive(Node._stateCallbackType.onExit);
329
+ this._clippingStencil = null;
330
+ }
331
+ break;
332
+ default:
333
+ break;
334
+ }
335
+ }
336
+ /**
337
+ * Sets clipping type to Layout
338
+ * @param {Layout.CLIPPING_STENCIL|Layout.CLIPPING_SCISSOR} type
339
+ */
340
+ setClippingType(type) {
341
+ if (type === this._clippingType)
342
+ return;
343
+ const clippingEnabled = this.isClippingEnabled();
344
+ this.setClippingEnabled(false);
345
+ this._clippingType = type;
346
+ this.setClippingEnabled(clippingEnabled);
347
+ }
348
+ /**
349
+ * Gets clipping type of Layout
350
+ * @returns {Layout.CLIPPING_STENCIL|Layout.CLIPPING_SCISSOR}
351
+ */
352
+ getClippingType() {
353
+ return this._clippingType;
354
+ }
355
+ _setStencilClippingSize(size) {
356
+ if (this._clippingEnabled) {
357
+ const rect = [];
358
+ rect[0] = p(0, 0);
359
+ rect[1] = p(size.width, 0);
360
+ rect[2] = p(size.width, size.height);
361
+ rect[3] = p(0, size.height);
362
+ const green = Color.GREEN;
363
+ this._clippingStencil.clear();
364
+ this._clippingStencil.setLocalBB(0, 0, size.width, size.height);
365
+ this._clippingStencil.drawPoly(rect, green, 0, green);
366
+ }
367
+ }
368
+ _getClippingRect() {
369
+ if (this._clippingRectDirty) {
370
+ const worldPos = this.convertToWorldSpace(p(0, 0));
371
+ const t = this.getNodeToWorldTransform();
372
+ const scissorWidth = this._contentSize.width * t.a;
373
+ const scissorHeight = this._contentSize.height * t.d;
374
+ let parentClippingRect;
375
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
376
+ let parent = this;
377
+ while (parent) {
378
+ parent = parent.getParent();
379
+ if (parent && parent instanceof Layout && parent.isClippingEnabled()) {
380
+ this._clippingParent = parent;
381
+ break;
382
+ }
383
+ }
384
+ if (this._clippingParent) {
385
+ parentClippingRect = this._clippingParent._getClippingRect();
386
+ this._clippingRect.x = Math.max(worldPos.x, parentClippingRect.x);
387
+ this._clippingRect.y = Math.max(worldPos.y, parentClippingRect.y);
388
+ const right = Math.min(worldPos.x + scissorWidth, parentClippingRect.x + parentClippingRect.width);
389
+ const top = Math.min(worldPos.y + scissorHeight, parentClippingRect.y + parentClippingRect.height);
390
+ this._clippingRect.width = Math.max(0.0, right - this._clippingRect.x);
391
+ this._clippingRect.height = Math.max(0.0, top - this._clippingRect.y);
392
+ }
393
+ else {
394
+ this._clippingRect.x = worldPos.x;
395
+ this._clippingRect.y = worldPos.y;
396
+ this._clippingRect.width = scissorWidth;
397
+ this._clippingRect.height = scissorHeight;
398
+ }
399
+ this._clippingRectDirty = false;
400
+ }
401
+ return this._clippingRect;
402
+ }
403
+ _onSizeChanged() {
404
+ Widget.prototype._onSizeChanged.call(this);
405
+ const locContentSize = this._contentSize;
406
+ this._setStencilClippingSize(locContentSize);
407
+ this._doLayoutDirty = true;
408
+ this._clippingRectDirty = true;
409
+ if (this._backGroundImage) {
410
+ this._backGroundImage.setPosition(locContentSize.width * 0.5, locContentSize.height * 0.5);
411
+ if (this._backGroundScale9Enabled && this._backGroundImage instanceof Scale9Sprite)
412
+ this._backGroundImage.setPreferredSize(locContentSize);
413
+ }
414
+ if (this._colorRender)
415
+ this._colorRender.setContentSize(locContentSize);
416
+ if (this._gradientRender)
417
+ this._gradientRender.setContentSize(locContentSize);
418
+ }
419
+ /**
420
+ * Sets background image use scale9 renderer.
421
+ * @param {Boolean} able true that use scale9 renderer, false otherwise.
422
+ */
423
+ setBackGroundImageScale9Enabled(able) {
424
+ if (this._backGroundScale9Enabled === able)
425
+ return;
426
+ this.removeProtectedChild(this._backGroundImage);
427
+ this._backGroundImage = null;
428
+ this._backGroundScale9Enabled = able;
429
+ this._addBackGroundImage();
430
+ this.setBackGroundImage(this._backGroundImageFileName, this._bgImageTexType);
431
+ this.setBackGroundImageCapInsets(this._backGroundImageCapInsets);
432
+ }
433
+ /**
434
+ * Get whether background image is use scale9 renderer.
435
+ * @returns {Boolean}
436
+ */
437
+ isBackGroundImageScale9Enabled() {
438
+ return this._backGroundScale9Enabled;
439
+ }
440
+ /**
441
+ * Sets a background image for layout
442
+ * @param {String} fileName
443
+ * @param {Widget.LOCAL_TEXTURE|Widget.PLIST_TEXTURE} texType
444
+ */
445
+ setBackGroundImage(fileName, texType) {
446
+ if (!fileName)
447
+ return;
448
+ texType = texType || Widget.LOCAL_TEXTURE;
449
+ if (this._backGroundImage === null) {
450
+ this._addBackGroundImage();
451
+ this.setBackGroundImageScale9Enabled(this._backGroundScale9Enabled);
452
+ }
453
+ this._backGroundImageFileName = fileName;
454
+ this._bgImageTexType = texType;
455
+ const locBackgroundImage = this._backGroundImage;
456
+ switch (this._bgImageTexType) {
457
+ case Widget.LOCAL_TEXTURE:
458
+ locBackgroundImage.initWithFile(fileName);
459
+ break;
460
+ case Widget.PLIST_TEXTURE:
461
+ locBackgroundImage.initWithSpriteFrameName(fileName);
462
+ break;
463
+ default:
464
+ break;
465
+ }
466
+ if (this._backGroundScale9Enabled)
467
+ locBackgroundImage.setPreferredSize(this._contentSize);
468
+ this._backGroundImageTextureSize = locBackgroundImage.getContentSize();
469
+ locBackgroundImage.setPosition(this._contentSize.width * 0.5, this._contentSize.height * 0.5);
470
+ this._updateBackGroundImageColor();
471
+ }
472
+ /**
473
+ * Sets a background image CapInsets for layout, if the background image is a scale9 render.
474
+ * @param {Rect} capInsets capinsets of background image.
475
+ */
476
+ setBackGroundImageCapInsets(capInsets) {
477
+ if (!capInsets)
478
+ return;
479
+ const locInsets = this._backGroundImageCapInsets;
480
+ locInsets.x = capInsets.x;
481
+ locInsets.y = capInsets.y;
482
+ locInsets.width = capInsets.width;
483
+ locInsets.height = capInsets.height;
484
+ if (this._backGroundScale9Enabled)
485
+ this._backGroundImage.setCapInsets(capInsets);
486
+ }
487
+ /**
488
+ * Gets background image capinsets of Layout.
489
+ * @returns {Rect}
490
+ */
491
+ getBackGroundImageCapInsets() {
492
+ return Rect(this._backGroundImageCapInsets);
493
+ }
494
+ _supplyTheLayoutParameterLackToChild(locChild) {
495
+ if (!locChild) {
496
+ return;
497
+ }
498
+ switch (this._layoutType) {
499
+ case Layout.ABSOLUTE:
500
+ break;
501
+ case Layout.LINEAR_HORIZONTAL:
502
+ case Layout.LINEAR_VERTICAL: {
503
+ const layoutParameter = locChild.getLayoutParameter(LayoutParameter.LINEAR);
504
+ if (!layoutParameter)
505
+ locChild.setLayoutParameter(new LinearLayoutParameter());
506
+ break;
507
+ }
508
+ case Layout.RELATIVE: {
509
+ const layoutParameter = locChild.getLayoutParameter(LayoutParameter.RELATIVE);
510
+ if (!layoutParameter)
511
+ locChild.setLayoutParameter(new RelativeLayoutParameter());
512
+ break;
513
+ }
514
+ default:
515
+ break;
516
+ }
517
+ }
518
+ _addBackGroundImage() {
519
+ const contentSize = this._contentSize;
520
+ if (this._backGroundScale9Enabled) {
521
+ this._backGroundImage = new Scale9Sprite();
522
+ this._backGroundImage.setPreferredSize(contentSize);
523
+ }
524
+ else
525
+ this._backGroundImage = new Sprite();
526
+ this.addProtectedChild(this._backGroundImage, Layout.BACKGROUND_IMAGE_ZORDER, -1);
527
+ this._backGroundImage.setPosition(contentSize.width * 0.5, contentSize.height * 0.5);
528
+ }
529
+ /**
530
+ * Remove the background image of Layout.
531
+ */
532
+ removeBackGroundImage() {
533
+ if (!this._backGroundImage)
534
+ return;
535
+ this.removeProtectedChild(this._backGroundImage);
536
+ this._backGroundImage = null;
537
+ this._backGroundImageFileName = '';
538
+ this._backGroundImageTextureSize.width = 0;
539
+ this._backGroundImageTextureSize.height = 0;
540
+ }
541
+ /**
542
+ * Sets Color Type for Layout.
543
+ * @param {Layout.BG_COLOR_NONE|Layout.BG_COLOR_SOLID|Layout.BG_COLOR_GRADIENT} type
544
+ */
545
+ setBackGroundColorType(type) {
546
+ if (this._colorType === type)
547
+ return;
548
+ switch (this._colorType) {
549
+ case Layout.BG_COLOR_NONE:
550
+ if (this._colorRender) {
551
+ this.removeProtectedChild(this._colorRender);
552
+ this._colorRender = null;
553
+ }
554
+ if (this._gradientRender) {
555
+ this.removeProtectedChild(this._gradientRender);
556
+ this._gradientRender = null;
557
+ }
558
+ break;
559
+ case Layout.BG_COLOR_SOLID:
560
+ if (this._colorRender) {
561
+ this.removeProtectedChild(this._colorRender);
562
+ this._colorRender = null;
563
+ }
564
+ break;
565
+ case Layout.BG_COLOR_GRADIENT:
566
+ if (this._gradientRender) {
567
+ this.removeProtectedChild(this._gradientRender);
568
+ this._gradientRender = null;
569
+ }
570
+ break;
571
+ default:
572
+ break;
573
+ }
574
+ this._colorType = type;
575
+ switch (this._colorType) {
576
+ case Layout.BG_COLOR_NONE:
577
+ break;
578
+ // case Layout.BG_COLOR_SOLID:
579
+ // this._colorRender = new LayerColor()
580
+ // this._colorRender.setContentSize(this._contentSize)
581
+ // this._colorRender.setOpacity(this._opacity)
582
+ // this._colorRender.setColor(this._color)
583
+ // this.addProtectedChild(this._colorRender, Layout.BACKGROUND_RENDERER_ZORDER, -1)
584
+ // break
585
+ // case Layout.BG_COLOR_GRADIENT:
586
+ // this._gradientRender = new LayerGradient(color(255, 0, 0, 255), color(0, 255, 0, 255))
587
+ // this._gradientRender.setContentSize(this._contentSize)
588
+ // this._gradientRender.setOpacity(this._opacity)
589
+ // this._gradientRender.setStartColor(this._startColor)
590
+ // this._gradientRender.setEndColor(this._endColor)
591
+ // this._gradientRender.setVector(this._alongVector)
592
+ // this.addProtectedChild(this._gradientRender, Layout.BACKGROUND_RENDERER_ZORDER, -1)
593
+ // break
594
+ default:
595
+ break;
596
+ }
597
+ }
598
+ /**
599
+ * Get background color type of Layout.
600
+ * @returns {Layout.BG_COLOR_NONE|Layout.BG_COLOR_SOLID|Layout.BG_COLOR_GRADIENT}
601
+ */
602
+ getBackGroundColorType() {
603
+ return this._colorType;
604
+ }
605
+ /**
606
+ * Sets background color for layout, if color type is Layout.COLOR_SOLID
607
+ * @param {Color} color
608
+ * @param {Color} [endColor]
609
+ */
610
+ setBackGroundColor(color, endColor) {
611
+ if (!endColor) {
612
+ this._color.r = color.r;
613
+ this._color.g = color.g;
614
+ this._color.b = color.b;
615
+ if (this._colorRender)
616
+ this._colorRender.setColor(color);
617
+ }
618
+ else {
619
+ this._startColor.r = color.r;
620
+ this._startColor.g = color.g;
621
+ this._startColor.b = color.b;
622
+ if (this._gradientRender)
623
+ this._gradientRender.setStartColor(color);
624
+ this._endColor.r = endColor.r;
625
+ this._endColor.g = endColor.g;
626
+ this._endColor.b = endColor.b;
627
+ if (this._gradientRender)
628
+ this._gradientRender.setEndColor(endColor);
629
+ }
630
+ }
631
+ /**
632
+ * Gets background color of Layout, if color type is Layout.COLOR_SOLID.
633
+ * @returns {Color}
634
+ */
635
+ getBackGroundColor() {
636
+ const tmpColor = this._color;
637
+ return color(tmpColor.r, tmpColor.g, tmpColor.b, tmpColor.a);
638
+ }
639
+ /**
640
+ * Gets background start color of Layout
641
+ * @returns {Color}
642
+ */
643
+ getBackGroundStartColor() {
644
+ const tmpColor = this._startColor;
645
+ return color(tmpColor.r, tmpColor.g, tmpColor.b, tmpColor.a);
646
+ }
647
+ /**
648
+ * Gets background end color of Layout
649
+ * @returns {Color}
650
+ */
651
+ getBackGroundEndColor() {
652
+ const tmpColor = this._endColor;
653
+ return color(tmpColor.r, tmpColor.g, tmpColor.b, tmpColor.a);
654
+ }
655
+ /**
656
+ * Sets background opacity to Layout.
657
+ * @param {number} opacity
658
+ */
659
+ setBackGroundColorOpacity(opacity) {
660
+ this._opacity = opacity;
661
+ switch (this._colorType) {
662
+ case Layout.BG_COLOR_NONE:
663
+ break;
664
+ case Layout.BG_COLOR_SOLID:
665
+ this._colorRender.setOpacity(opacity);
666
+ break;
667
+ case Layout.BG_COLOR_GRADIENT:
668
+ this._gradientRender.setOpacity(opacity);
669
+ break;
670
+ default:
671
+ break;
672
+ }
673
+ }
674
+ /**
675
+ * Get background opacity value of Layout.
676
+ * @returns {Number}
677
+ */
678
+ getBackGroundColorOpacity() {
679
+ return this._opacity;
680
+ }
681
+ /**
682
+ * Sets background color vector for layout, if color type is Layout.COLOR_GRADIENT
683
+ * @param {Point} vector
684
+ */
685
+ setBackGroundColorVector(vector) {
686
+ this._alongVector.x = vector.x;
687
+ this._alongVector.y = vector.y;
688
+ if (this._gradientRender) {
689
+ this._gradientRender.setVector(vector);
690
+ }
691
+ }
692
+ /**
693
+ * Gets background color vector of Layout, if color type is Layout.COLOR_GRADIENT
694
+ * @returns {Point}
695
+ */
696
+ getBackGroundColorVector() {
697
+ return this._alongVector;
698
+ }
699
+ /**
700
+ * Sets backGround image color
701
+ * @param {Color} color
702
+ */
703
+ setBackGroundImageColor(color) {
704
+ this._backGroundImageColor.r = color.r;
705
+ this._backGroundImageColor.g = color.g;
706
+ this._backGroundImageColor.b = color.b;
707
+ this._updateBackGroundImageColor();
708
+ }
709
+ /**
710
+ * Sets backGround image Opacity
711
+ * @param {Number} opacity
712
+ */
713
+ setBackGroundImageOpacity(opacity) {
714
+ this._backGroundImageColor.a = opacity;
715
+ this.getBackGroundImageColor();
716
+ }
717
+ /**
718
+ * Gets backGround image color
719
+ * @returns {Color}
720
+ */
721
+ getBackGroundImageColor() {
722
+ return color(this._backGroundImageColor);
723
+ }
724
+ /**
725
+ * Gets backGround image opacity
726
+ * @returns {Number}
727
+ */
728
+ getBackGroundImageOpacity() {
729
+ return this._backGroundImageColor.a;
730
+ }
731
+ _updateBackGroundImageColor() {
732
+ if (this._backGroundImage)
733
+ this._backGroundImage.setColor(this._backGroundImageColor);
734
+ }
735
+ /**
736
+ * Gets background image texture size.
737
+ * @returns {Size}
738
+ */
739
+ getBackGroundImageTextureSize() {
740
+ return this._backGroundImageTextureSize;
741
+ }
742
+ /**
743
+ * Sets LayoutType to Layout, LayoutManager will do layout by layout type..
744
+ * @param {Layout.ABSOLUTE|Layout.LINEAR_VERTICAL|Layout.LINEAR_HORIZONTAL|Layout.RELATIVE} type
745
+ */
746
+ setLayoutType(type) {
747
+ this._layoutType = type;
748
+ const layoutChildrenArray = this._children;
749
+ let locChild;
750
+ for (let i = 0; i < layoutChildrenArray.length; i++) {
751
+ locChild = layoutChildrenArray[i];
752
+ if (locChild instanceof Widget)
753
+ this._supplyTheLayoutParameterLackToChild(locChild);
754
+ }
755
+ this._doLayoutDirty = true;
756
+ }
757
+ /**
758
+ * Gets LayoutType of Layout.
759
+ * @returns {null}
760
+ */
761
+ getLayoutType() {
762
+ return this._layoutType;
763
+ }
764
+ /**
765
+ * request to refresh widget layout, it will do layout at visit calls
766
+ */
767
+ requestDoLayout() {
768
+ this._doLayoutDirty = true;
769
+ }
770
+ _doLayout() {
771
+ if (!this._doLayoutDirty)
772
+ return;
773
+ this.sortAllChildren();
774
+ // const executant = getLayoutManager(this._layoutType)
775
+ // if (executant) executant._doLayout(this)
776
+ this._doLayoutDirty = false;
777
+ }
778
+ _getLayoutContentSize() {
779
+ return this.getContentSize();
780
+ }
781
+ _getLayoutElements() {
782
+ return this.getChildren();
783
+ }
784
+ _updateBackGroundImageOpacity() {
785
+ if (this._backGroundImage)
786
+ this._backGroundImage.setOpacity(this._backGroundImageOpacity);
787
+ }
788
+ _updateBackGroundImageRGBA() {
789
+ if (this._backGroundImage) {
790
+ this._backGroundImage.setColor(this._backGroundImageColor);
791
+ this._backGroundImage.setOpacity(this._backGroundImageOpacity);
792
+ }
793
+ }
794
+ /**
795
+ * Gets the content size of the layout, it will accumulate all its children's content size
796
+ * @returns {Size}
797
+ * @private
798
+ */
799
+ _getLayoutAccumulatedSize() {
800
+ const children = this.getChildren();
801
+ const layoutSize = Size(0, 0);
802
+ let widgetCount = 0, locSize;
803
+ for (let i = 0, len = children.length; i < len; i++) {
804
+ const layout = children[i];
805
+ if (null !== layout && layout instanceof Layout) {
806
+ locSize = layout._getLayoutAccumulatedSize();
807
+ layoutSize.width += locSize.width;
808
+ layoutSize.height += locSize.height;
809
+ }
810
+ else {
811
+ if (layout instanceof Widget) {
812
+ widgetCount++;
813
+ const m = layout.getLayoutParameter().getMargin();
814
+ locSize = layout.getContentSize();
815
+ layoutSize.width += locSize.width + (m.right + m.left) * 0.5;
816
+ layoutSize.height += locSize.height + (m.top + m.bottom) * 0.5;
817
+ }
818
+ }
819
+ }
820
+ //substract extra size
821
+ const type = this.getLayoutType();
822
+ if (type === Layout.LINEAR_HORIZONTAL)
823
+ layoutSize.height = layoutSize.height - (layoutSize.height / widgetCount) * (widgetCount - 1);
824
+ if (type === Layout.LINEAR_VERTICAL)
825
+ layoutSize.width = layoutSize.width - (layoutSize.width / widgetCount) * (widgetCount - 1);
826
+ return layoutSize;
827
+ }
828
+ /**
829
+ * When the layout get focused, it the layout pass the focus to its child, it will use this method to determine which child <br/>
830
+ * will get the focus. The current algorithm to determine which child will get focus is nearest-distance-priority algorithm
831
+ * @param {Number} direction next focused widget direction
832
+ * @param {Widget} baseWidget
833
+ * @returns {Number}
834
+ * @private
835
+ */
836
+ _findNearestChildWidgetIndex(direction, baseWidget) {
837
+ if (baseWidget == null || baseWidget === this)
838
+ return this._findFirstFocusEnabledWidgetIndex();
839
+ let index = 0;
840
+ const locChildren = this.getChildren();
841
+ const count = locChildren.length;
842
+ let widgetPosition;
843
+ let distance = FLT_MAX, found = 0;
844
+ if (direction === Widget.LEFT || direction === Widget.RIGHT || direction === Widget.DOWN || direction === Widget.UP) {
845
+ widgetPosition = this._getWorldCenterPoint(baseWidget);
846
+ while (index < count) {
847
+ const w = locChildren[index];
848
+ if (w && w instanceof Widget && w.isFocusEnabled()) {
849
+ const length = w instanceof Layout ? w._calculateNearestDistance(baseWidget) : pLength(pSub(this._getWorldCenterPoint(w), widgetPosition));
850
+ if (length < distance) {
851
+ found = index;
852
+ distance = length;
853
+ }
854
+ }
855
+ index++;
856
+ }
857
+ return found;
858
+ }
859
+ log('invalid focus direction!');
860
+ return 0;
861
+ }
862
+ /**
863
+ * When the layout get focused, it the layout pass the focus to its child, it will use this method to determine which child
864
+ * will get the focus. The current algorithm to determine which child will get focus is farthest-distance-priority algorithm
865
+ * @param {Number} direction next focused widget direction
866
+ * @param {Widget} baseWidget
867
+ * @returns {Number} The index of child widget in the container
868
+ * @private
869
+ */
870
+ _findFarthestChildWidgetIndex(direction, baseWidget) {
871
+ if (baseWidget == null || baseWidget === this)
872
+ return this._findFirstFocusEnabledWidgetIndex();
873
+ let index = 0;
874
+ const locChildren = this.getChildren();
875
+ const count = locChildren.length;
876
+ let distance = -FLT_MAX, found = 0;
877
+ if (direction === Widget.LEFT || direction === Widget.RIGHT || direction === Widget.DOWN || direction === Widget.UP) {
878
+ const widgetPosition = this._getWorldCenterPoint(baseWidget);
879
+ while (index < count) {
880
+ const w = locChildren[index];
881
+ if (w && w instanceof Widget && w.isFocusEnabled()) {
882
+ const length = w instanceof Layout ? w._calculateFarthestDistance(baseWidget) : pLength(pSub(this._getWorldCenterPoint(w), widgetPosition));
883
+ if (length > distance) {
884
+ found = index;
885
+ distance = length;
886
+ }
887
+ }
888
+ index++;
889
+ }
890
+ return found;
891
+ }
892
+ log('invalid focus direction!!!');
893
+ return 0;
894
+ }
895
+ /**
896
+ * calculate the nearest distance between the baseWidget and the children of the layout
897
+ * @param {Widget} baseWidget the base widget which will be used to calculate the distance between the layout's children and itself
898
+ * @returns {Number} return the nearest distance between the baseWidget and the layout's children
899
+ * @private
900
+ */
901
+ _calculateNearestDistance(baseWidget) {
902
+ let distance = FLT_MAX;
903
+ const widgetPosition = this._getWorldCenterPoint(baseWidget);
904
+ const locChildren = this._children;
905
+ for (let i = 0, len = locChildren.length; i < len; i++) {
906
+ const widget = locChildren[i];
907
+ let length;
908
+ if (widget instanceof Layout)
909
+ length = widget._calculateNearestDistance(baseWidget);
910
+ else {
911
+ if (widget instanceof Widget && widget.isFocusEnabled())
912
+ length = pLength(pSub(this._getWorldCenterPoint(widget), widgetPosition));
913
+ else
914
+ continue;
915
+ }
916
+ if (length < distance)
917
+ distance = length;
918
+ }
919
+ return distance;
920
+ }
921
+ /**
922
+ * calculate the farthest distance between the baseWidget and the children of the layout
923
+ * @param baseWidget
924
+ * @returns {number}
925
+ * @private
926
+ */
927
+ _calculateFarthestDistance(baseWidget) {
928
+ let distance = -FLT_MAX;
929
+ const widgetPosition = this._getWorldCenterPoint(baseWidget);
930
+ const locChildren = this._children;
931
+ for (let i = 0, len = locChildren.length; i < len; i++) {
932
+ const layout = locChildren[i];
933
+ let length;
934
+ if (layout instanceof Layout)
935
+ length = layout._calculateFarthestDistance(baseWidget);
936
+ else {
937
+ if (layout instanceof Widget && layout.isFocusEnabled()) {
938
+ const wPosition = this._getWorldCenterPoint(layout);
939
+ length = pLength(pSub(wPosition, widgetPosition));
940
+ }
941
+ else
942
+ continue;
943
+ }
944
+ if (length > distance)
945
+ distance = length;
946
+ }
947
+ return distance;
948
+ }
949
+ /**
950
+ * when a layout pass the focus to it's child, use this method to determine which algorithm to use, nearest or farthest distance algorithm or not
951
+ * @param direction
952
+ * @param baseWidget
953
+ * @private
954
+ */
955
+ _findProperSearchingFunctor(direction, baseWidget) {
956
+ if (baseWidget === undefined)
957
+ return;
958
+ const previousWidgetPosition = this._getWorldCenterPoint(baseWidget);
959
+ const widgetPosition = this._getWorldCenterPoint(this._findFirstNonLayoutWidget());
960
+ if (direction === Widget.LEFT) {
961
+ this.onPassFocusToChild =
962
+ previousWidgetPosition.x > widgetPosition.x ? this._findNearestChildWidgetIndex : this._findFarthestChildWidgetIndex;
963
+ }
964
+ else if (direction === Widget.RIGHT) {
965
+ this.onPassFocusToChild =
966
+ previousWidgetPosition.x > widgetPosition.x ? this._findFarthestChildWidgetIndex : this._findNearestChildWidgetIndex;
967
+ }
968
+ else if (direction === Widget.DOWN) {
969
+ this.onPassFocusToChild =
970
+ previousWidgetPosition.y > widgetPosition.y ? this._findNearestChildWidgetIndex : this._findFarthestChildWidgetIndex;
971
+ }
972
+ else if (direction === Widget.UP) {
973
+ this.onPassFocusToChild =
974
+ previousWidgetPosition.y < widgetPosition.y ? this._findNearestChildWidgetIndex : this._findFarthestChildWidgetIndex;
975
+ }
976
+ else
977
+ log('invalid direction!');
978
+ }
979
+ /**
980
+ * find the first non-layout widget in this layout
981
+ * @returns {Widget}
982
+ * @private
983
+ */
984
+ _findFirstNonLayoutWidget() {
985
+ const locChildren = this._children;
986
+ for (let i = 0, len = locChildren.length; i < len; i++) {
987
+ const child = locChildren[i];
988
+ if (child instanceof Layout) {
989
+ const widget = child._findFirstNonLayoutWidget();
990
+ if (widget)
991
+ return widget;
992
+ }
993
+ else {
994
+ if (child instanceof Widget)
995
+ return child;
996
+ }
997
+ }
998
+ return null;
999
+ }
1000
+ /**
1001
+ * find the first focus enabled widget index in the layout, it will recursive searching the child widget
1002
+ * @returns {number}
1003
+ * @private
1004
+ */
1005
+ _findFirstFocusEnabledWidgetIndex() {
1006
+ let index = 0;
1007
+ const locChildren = this.getChildren();
1008
+ const count = locChildren.length;
1009
+ while (index < count) {
1010
+ const w = locChildren[index];
1011
+ if (w && w instanceof Widget && w.isFocusEnabled())
1012
+ return index;
1013
+ index++;
1014
+ }
1015
+ return 0;
1016
+ }
1017
+ /**
1018
+ * find a focus enabled child Widget in the layout by index
1019
+ * @param index
1020
+ * @returns {*}
1021
+ * @private
1022
+ */
1023
+ _findFocusEnabledChildWidgetByIndex(index) {
1024
+ const widget = this._getChildWidgetByIndex(index);
1025
+ if (widget) {
1026
+ if (widget.isFocusEnabled())
1027
+ return widget;
1028
+ index = index + 1;
1029
+ return this._findFocusEnabledChildWidgetByIndex(index);
1030
+ }
1031
+ return null;
1032
+ }
1033
+ /**
1034
+ * get the center point of a widget in world space
1035
+ * @param {Widget} widget
1036
+ * @returns {Point}
1037
+ * @private
1038
+ */
1039
+ _getWorldCenterPoint(widget) {
1040
+ //FIXEDME: we don't need to calculate the content size of layout anymore
1041
+ const widgetSize = widget instanceof Layout ? widget._getLayoutAccumulatedSize() : widget.getContentSize();
1042
+ return widget.convertToWorldSpace(p(widgetSize.width / 2, widgetSize.height / 2));
1043
+ }
1044
+ /**
1045
+ * this method is called internally by nextFocusedWidget. When the dir is Right/Down, then this method will be called
1046
+ * @param {Number} direction
1047
+ * @param {Widget} current the current focused widget
1048
+ * @returns {Widget} the next focused widget
1049
+ * @private
1050
+ */
1051
+ _getNextFocusedWidget(direction, current) {
1052
+ let nextWidget;
1053
+ const locChildren = this._children;
1054
+ let previousWidgetPos = locChildren.indexOf(current);
1055
+ previousWidgetPos = previousWidgetPos + 1;
1056
+ if (previousWidgetPos < locChildren.length) {
1057
+ nextWidget = this._getChildWidgetByIndex(previousWidgetPos);
1058
+ //handle widget
1059
+ if (nextWidget) {
1060
+ if (nextWidget.isFocusEnabled()) {
1061
+ if (nextWidget instanceof Layout) {
1062
+ nextWidget._isFocusPassing = true;
1063
+ return nextWidget.findNextFocusedWidget(direction, nextWidget);
1064
+ }
1065
+ else {
1066
+ this.dispatchFocusEvent(current, nextWidget);
1067
+ return nextWidget;
1068
+ }
1069
+ }
1070
+ else
1071
+ return this._getNextFocusedWidget(direction, nextWidget);
1072
+ }
1073
+ else
1074
+ return current;
1075
+ }
1076
+ else {
1077
+ if (this._loopFocus) {
1078
+ if (this._checkFocusEnabledChild()) {
1079
+ previousWidgetPos = 0;
1080
+ nextWidget = this._getChildWidgetByIndex(previousWidgetPos);
1081
+ if (nextWidget.isFocusEnabled()) {
1082
+ if (nextWidget instanceof Layout) {
1083
+ nextWidget._isFocusPassing = true;
1084
+ return nextWidget.findNextFocusedWidget(direction, nextWidget);
1085
+ }
1086
+ else {
1087
+ this.dispatchFocusEvent(current, nextWidget);
1088
+ return nextWidget;
1089
+ }
1090
+ }
1091
+ else
1092
+ return this._getNextFocusedWidget(direction, nextWidget);
1093
+ }
1094
+ else
1095
+ return current instanceof Layout ? current : Widget._focusedWidget;
1096
+ }
1097
+ else {
1098
+ if (this._isLastWidgetInContainer(current, direction)) {
1099
+ if (this._isWidgetAncestorSupportLoopFocus(this, direction))
1100
+ return Widget.prototype.findNextFocusedWidget.call(this, direction, this);
1101
+ return current instanceof Layout ? current : Widget._focusedWidget;
1102
+ }
1103
+ else
1104
+ return Widget.prototype.findNextFocusedWidget.call(this, direction, this);
1105
+ }
1106
+ }
1107
+ }
1108
+ /**
1109
+ * this method is called internally by nextFocusedWidget. When the dir is Left/Up, then this method will be called
1110
+ * @param direction
1111
+ * @param {Widget} current the current focused widget
1112
+ * @returns {Widget} the next focused widget
1113
+ * @private
1114
+ */
1115
+ _getPreviousFocusedWidget(direction, current) {
1116
+ let nextWidget;
1117
+ const locChildren = this._children;
1118
+ let previousWidgetPos = locChildren.indexOf(current);
1119
+ previousWidgetPos = previousWidgetPos - 1;
1120
+ if (previousWidgetPos >= 0) {
1121
+ nextWidget = this._getChildWidgetByIndex(previousWidgetPos);
1122
+ if (nextWidget.isFocusEnabled()) {
1123
+ if (nextWidget instanceof Layout) {
1124
+ nextWidget._isFocusPassing = true;
1125
+ return nextWidget.findNextFocusedWidget(direction, nextWidget);
1126
+ }
1127
+ this.dispatchFocusEvent(current, nextWidget);
1128
+ return nextWidget;
1129
+ }
1130
+ else
1131
+ return this._getPreviousFocusedWidget(direction, nextWidget); //handling the disabled widget, there is no actual focus lose or get, so we don't need any envet
1132
+ }
1133
+ else {
1134
+ if (this._loopFocus) {
1135
+ if (this._checkFocusEnabledChild()) {
1136
+ previousWidgetPos = locChildren.length - 1;
1137
+ nextWidget = this._getChildWidgetByIndex(previousWidgetPos);
1138
+ if (nextWidget.isFocusEnabled()) {
1139
+ if (nextWidget instanceof Layout) {
1140
+ nextWidget._isFocusPassing = true;
1141
+ return nextWidget.findNextFocusedWidget(direction, nextWidget);
1142
+ }
1143
+ else {
1144
+ this.dispatchFocusEvent(current, nextWidget);
1145
+ return nextWidget;
1146
+ }
1147
+ }
1148
+ else
1149
+ return this._getPreviousFocusedWidget(direction, nextWidget);
1150
+ }
1151
+ else
1152
+ return current instanceof Layout ? current : Widget._focusedWidget;
1153
+ }
1154
+ else {
1155
+ if (this._isLastWidgetInContainer(current, direction)) {
1156
+ if (this._isWidgetAncestorSupportLoopFocus(this, direction))
1157
+ return Widget.prototype.findNextFocusedWidget.call(this, direction, this);
1158
+ return current instanceof Layout ? current : Widget._focusedWidget;
1159
+ }
1160
+ else
1161
+ return Widget.prototype.findNextFocusedWidget.call(this, direction, this);
1162
+ }
1163
+ }
1164
+ }
1165
+ /**
1166
+ * find the nth element in the _children array. Only the Widget descendant object will be returned
1167
+ * @param {Number} index
1168
+ * @returns {Widget}
1169
+ * @private
1170
+ */
1171
+ _getChildWidgetByIndex(index) {
1172
+ const locChildren = this._children;
1173
+ const size = locChildren.length;
1174
+ let count = 0;
1175
+ const oldIndex = index;
1176
+ while (index < size) {
1177
+ const firstChild = locChildren[index];
1178
+ if (firstChild && firstChild instanceof Widget)
1179
+ return firstChild;
1180
+ count++;
1181
+ index++;
1182
+ }
1183
+ let begin = 0;
1184
+ while (begin < oldIndex) {
1185
+ const child = locChildren[begin];
1186
+ if (child && child instanceof Widget)
1187
+ return child;
1188
+ count++;
1189
+ begin++;
1190
+ }
1191
+ return null;
1192
+ }
1193
+ /**
1194
+ * whether it is the last element according to all their parents
1195
+ * @param {Widget} widget
1196
+ * @param {Number} direction
1197
+ * @returns {Boolean}
1198
+ * @private
1199
+ */
1200
+ _isLastWidgetInContainer(widget, direction) {
1201
+ const parent = widget.getParent();
1202
+ if (parent == null || !(parent instanceof Layout))
1203
+ return true;
1204
+ const container = parent.getChildren();
1205
+ const index = container.indexOf(widget);
1206
+ if (parent.getLayoutType() === Layout.LINEAR_HORIZONTAL) {
1207
+ if (direction === Widget.LEFT) {
1208
+ if (index === 0)
1209
+ return this._isLastWidgetInContainer(parent, direction);
1210
+ else
1211
+ return false;
1212
+ }
1213
+ if (direction === Widget.RIGHT) {
1214
+ if (index === container.length - 1)
1215
+ return this._isLastWidgetInContainer(parent, direction);
1216
+ else
1217
+ return false;
1218
+ }
1219
+ if (direction === Widget.DOWN)
1220
+ return this._isLastWidgetInContainer(parent, direction);
1221
+ if (direction === Widget.UP)
1222
+ return this._isLastWidgetInContainer(parent, direction);
1223
+ }
1224
+ else if (parent.getLayoutType() === Layout.LINEAR_VERTICAL) {
1225
+ if (direction === Widget.UP) {
1226
+ if (index === 0)
1227
+ return this._isLastWidgetInContainer(parent, direction);
1228
+ else
1229
+ return false;
1230
+ }
1231
+ if (direction === Widget.DOWN) {
1232
+ if (index === container.length - 1)
1233
+ return this._isLastWidgetInContainer(parent, direction);
1234
+ else
1235
+ return false;
1236
+ }
1237
+ if (direction === Widget.LEFT)
1238
+ return this._isLastWidgetInContainer(parent, direction);
1239
+ if (direction === Widget.RIGHT)
1240
+ return this._isLastWidgetInContainer(parent, direction);
1241
+ }
1242
+ else {
1243
+ log('invalid layout Type');
1244
+ return false;
1245
+ }
1246
+ }
1247
+ /**
1248
+ * Lookup any parent widget with a layout type as the direction, if the layout is loop focused, then return true, otherwise it returns false.
1249
+ * @param {Widget} widget
1250
+ * @param {Number} direction
1251
+ * @returns {Boolean}
1252
+ * @private
1253
+ */
1254
+ _isWidgetAncestorSupportLoopFocus(widget, direction) {
1255
+ const parent = widget.getParent();
1256
+ if (parent == null || !(parent instanceof Layout))
1257
+ return false;
1258
+ if (parent.isLoopFocus()) {
1259
+ const layoutType = parent.getLayoutType();
1260
+ if (layoutType === Layout.LINEAR_HORIZONTAL) {
1261
+ if (direction === Widget.LEFT || direction === Widget.RIGHT)
1262
+ return true;
1263
+ else
1264
+ return this._isWidgetAncestorSupportLoopFocus(parent, direction);
1265
+ }
1266
+ if (layoutType === Layout.LINEAR_VERTICAL) {
1267
+ if (direction === Widget.DOWN || direction === Widget.UP)
1268
+ return true;
1269
+ else
1270
+ return this._isWidgetAncestorSupportLoopFocus(parent, direction);
1271
+ }
1272
+ else {
1273
+ assert(0, 'invalid layout type');
1274
+ return false;
1275
+ }
1276
+ }
1277
+ else
1278
+ return this._isWidgetAncestorSupportLoopFocus(parent, direction);
1279
+ }
1280
+ /**
1281
+ * pass the focus to the layout's next focus enabled child
1282
+ * @param {Number} direction
1283
+ * @param {Widget} current
1284
+ * @returns {Widget}
1285
+ * @private
1286
+ */
1287
+ _passFocusToChild(direction, current) {
1288
+ if (this._checkFocusEnabledChild()) {
1289
+ const previousWidget = Widget.getCurrentFocusedWidget();
1290
+ this._findProperSearchingFunctor(direction, previousWidget);
1291
+ const index = this.onPassFocusToChild(direction, previousWidget);
1292
+ const widget = this._getChildWidgetByIndex(index);
1293
+ if (widget instanceof Layout) {
1294
+ widget._isFocusPassing = true;
1295
+ return widget.findNextFocusedWidget(direction, widget);
1296
+ }
1297
+ else {
1298
+ this.dispatchFocusEvent(current, widget);
1299
+ return widget;
1300
+ }
1301
+ }
1302
+ else
1303
+ return this;
1304
+ }
1305
+ /**
1306
+ * If there are no focus enabled child in the layout, it will return false, otherwise it returns true
1307
+ * @returns {boolean}
1308
+ * @private
1309
+ */
1310
+ _checkFocusEnabledChild() {
1311
+ const locChildren = this._children;
1312
+ for (let i = 0, len = locChildren.length; i < len; i++) {
1313
+ const widget = locChildren[i];
1314
+ if (widget && widget instanceof Widget && widget.isFocusEnabled())
1315
+ return true;
1316
+ }
1317
+ return false;
1318
+ }
1319
+ /**
1320
+ * Returns the "class name" of widget.
1321
+ * @returns {string}
1322
+ */
1323
+ getDescription() {
1324
+ return 'Layout';
1325
+ }
1326
+ _createCloneInstance() {
1327
+ return new Layout();
1328
+ }
1329
+ _copyClonedWidgetChildren(model) {
1330
+ Widget.prototype._copyClonedWidgetChildren.call(this, model);
1331
+ }
1332
+ _copySpecialProperties(layout) {
1333
+ if (!(layout instanceof Layout))
1334
+ return;
1335
+ this.setBackGroundImageScale9Enabled(layout._backGroundScale9Enabled);
1336
+ this.setBackGroundImage(layout._backGroundImageFileName, layout._bgImageTexType);
1337
+ this.setBackGroundImageCapInsets(layout._backGroundImageCapInsets);
1338
+ this.setBackGroundColorType(layout._colorType);
1339
+ this.setBackGroundColor(layout._color);
1340
+ this.setBackGroundColor(layout._startColor, layout._endColor);
1341
+ this.setBackGroundColorOpacity(layout._opacity);
1342
+ this.setBackGroundColorVector(layout._alongVector);
1343
+ this.setLayoutType(layout._layoutType);
1344
+ this.setClippingEnabled(layout._clippingEnabled);
1345
+ this.setClippingType(layout._clippingType);
1346
+ this._loopFocus = layout._loopFocus;
1347
+ this.__passFocusToChild = layout.__passFocusToChild;
1348
+ this._isInterceptTouch = layout._isInterceptTouch;
1349
+ }
1350
+ /**
1351
+ * force refresh widget layout
1352
+ */
1353
+ forceDoLayout() {
1354
+ this.requestDoLayout();
1355
+ this._doLayout();
1356
+ }
1357
+ _createRenderCmd() {
1358
+ return new LayoutWebGLRenderCmd(this);
1359
+ }
1360
+ //layoutBackGround color type
1361
+ /**
1362
+ * The None of Layout's background color type
1363
+ * @constant
1364
+ * @type {number}
1365
+ */
1366
+ static BG_COLOR_NONE = 0;
1367
+ /**
1368
+ * The solid of Layout's background color type, it will use a LayerColor to draw the background.
1369
+ * @constant
1370
+ * @type {number}
1371
+ */
1372
+ static BG_COLOR_SOLID = 1;
1373
+ /**
1374
+ * The gradient of Layout's background color type, it will use a LayerGradient to draw the background.
1375
+ * @constant
1376
+ * @type {number}
1377
+ */
1378
+ static BG_COLOR_GRADIENT = 2;
1379
+ //Layout type
1380
+ /**
1381
+ * The absolute of Layout's layout type.
1382
+ * @type {number}
1383
+ * @constant
1384
+ */
1385
+ static ABSOLUTE = 0;
1386
+ /**
1387
+ * The vertical of Layout's layout type.
1388
+ * @type {number}
1389
+ * @constant
1390
+ */
1391
+ static LINEAR_VERTICAL = 1;
1392
+ /**
1393
+ * The horizontal of Layout's layout type.
1394
+ * @type {number}
1395
+ * @constant
1396
+ */
1397
+ static LINEAR_HORIZONTAL = 2;
1398
+ /**
1399
+ * The relative of Layout's layout type.
1400
+ * @type {number}
1401
+ * @constant
1402
+ */
1403
+ static RELATIVE = 3;
1404
+ //Layout clipping type
1405
+ /**
1406
+ * The stencil of Layout's clipping type.
1407
+ * @type {number}
1408
+ * @constant
1409
+ */
1410
+ static CLIPPING_STENCIL = 0;
1411
+ /**
1412
+ * The scissor of Layout's clipping type.
1413
+ * @type {number}
1414
+ * @constant
1415
+ */
1416
+ static CLIPPING_SCISSOR = 1;
1417
+ /**
1418
+ * The zOrder value of Layout's image background.
1419
+ * @type {number}
1420
+ * @constant
1421
+ */
1422
+ static BACKGROUND_IMAGE_ZORDER = -1;
1423
+ /**
1424
+ * The zOrder value of Layout's color background.
1425
+ * @type {number}
1426
+ * @constant
1427
+ */
1428
+ static BACKGROUND_RENDERER_ZORDER = -2;
1429
+ }
1430
+ //# sourceMappingURL=UILayout.js.map