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,1544 @@
1
+ import { renderer } from '../..';
2
+ import { pAdd, pLength, pMult, pSub } from '../../core';
3
+ import { p, Size } from '../../core/cocoa/Geometry';
4
+ import { Color, color } from '../../core/platform';
5
+ import { assert, log } from '../../helper/Debugger';
6
+ import { Widget } from '../base/UIWidget';
7
+ import { Layout } from '../layout/UILayout';
8
+ import { ScrollViewBar } from './UIScrollViewBar';
9
+ import { ScrollViewWebGLRenderCmd } from './UIScrollViewWebGLRenderCmd';
10
+ export class ScrollView extends Layout {
11
+ static DIR_NONE = 0;
12
+ static DIR_VERTICAL = 1;
13
+ static DIR_HORIZONTAL = 2;
14
+ static DIR_BOTH = 3;
15
+ static EVENT_SCROLL_TO_TOP = 0;
16
+ static EVENT_SCROLL_TO_BOTTOM = 1;
17
+ static EVENT_SCROLL_TO_LEFT = 2;
18
+ static EVENT_SCROLL_TO_RIGHT = 3;
19
+ static EVENT_SCROLLING = 4;
20
+ static EVENT_BOUNCE_TOP = 5;
21
+ static EVENT_BOUNCE_BOTTOM = 6;
22
+ static EVENT_BOUNCE_LEFT = 7;
23
+ static EVENT_BOUNCE_RIGHT = 8;
24
+ static EVENT_CONTAINER_MOVED = 9;
25
+ static EVENT_AUTOSCROLL_ENDED = 10;
26
+ static MOVEDIR_TOP = 0;
27
+ static MOVEDIR_BOTTOM = 1;
28
+ static MOVEDIR_LEFT = 2;
29
+ static MOVEDIR_RIGHT = 3;
30
+ _topBoundary = 0;
31
+ _bottomBoundary = 0;
32
+ _leftBoundary = 0;
33
+ _rightBoundary = 0;
34
+ _touchMoveDisplacements = [];
35
+ _touchMoveTimeDeltas = [];
36
+ _touchMovePreviousTimestamp = 0;
37
+ _touchTotalTimeThreshold = 0.5;
38
+ _autoScrolling = false;
39
+ _autoScrollAttenuate = true;
40
+ _autoScrollTotalTime = 0;
41
+ _autoScrollAccumulatedTime = 0;
42
+ _autoScrollCurrentlyOutOfBoundary = false;
43
+ _autoScrollBraking = false;
44
+ _bePressed = false;
45
+ _childFocusCancelOffset = 0;
46
+ bounceEnabled = false;
47
+ _outOfBoundaryAmountDirty = true;
48
+ inertiaScrollEnabled = false;
49
+ _scrollBarEnabled = true;
50
+ _className = 'ScrollView';
51
+ /**
52
+ * Allocates and initializes a UIScrollView.
53
+ * Constructor of ScrollView. override it to extend the construction behavior, remember to call "super()" in the extended constructor.
54
+ * @example
55
+ * // example
56
+ * var uiScrollView = new ScrollView();
57
+ */
58
+ constructor() {
59
+ super();
60
+ this.setClippingEnabled(true);
61
+ this._innerContainer.setTouchEnabled(false);
62
+ this._direction = ScrollView.DIR_NONE;
63
+ this._childFocusCancelOffset = 5;
64
+ this.inertiaScrollEnabled = true;
65
+ this._outOfBoundaryAmount = p(0, 0);
66
+ this._autoScrollTargetDelta = p(0, 0);
67
+ this._autoScrollStartPosition = p(0, 0);
68
+ this._autoScrollBrakingStartPosition = p(0, 0);
69
+ this._touchMoveDisplacements = [];
70
+ this._touchMoveTimeDeltas = [];
71
+ this._touchMovePreviousTimestamp = 0;
72
+ this._scrollBarEnabled = true;
73
+ this._initScrollBar();
74
+ this.setTouchEnabled(true);
75
+ }
76
+ /**
77
+ * Calls the parent class' onEnter and schedules update function.
78
+ * @override
79
+ */
80
+ onEnter() {
81
+ super.onEnter();
82
+ this.scheduleUpdate();
83
+ }
84
+ onExit() {
85
+ renderer._removeCache(this.__instanceId);
86
+ super.onExit();
87
+ }
88
+ visit(parent) {
89
+ const cmd = this._renderCmd, parentCmd = parent ? parent._renderCmd : null;
90
+ // quick return if not visible
91
+ if (!this._visible) {
92
+ cmd._propagateFlagsDown(parentCmd);
93
+ return;
94
+ }
95
+ this._adaptRenderers();
96
+ this._doLayout();
97
+ cmd.visit(parentCmd);
98
+ renderer.pushRenderCommand(cmd);
99
+ if (cmd instanceof ScrollViewWebGLRenderCmd) {
100
+ const currentID = this.__instanceId;
101
+ renderer._turnToCacheMode(currentID);
102
+ }
103
+ const stencilClipping = this._clippingEnabled && this._clippingType === Layout.CLIPPING_STENCIL;
104
+ const scissorClipping = this._clippingEnabled && this._clippingType === Layout.CLIPPING_SCISSOR;
105
+ if (stencilClipping) {
106
+ cmd.stencilClippingVisit(parentCmd);
107
+ }
108
+ else if (scissorClipping) {
109
+ cmd.scissorClippingVisit(parentCmd);
110
+ }
111
+ let i;
112
+ const children = this._children;
113
+ const len = children.length;
114
+ let child;
115
+ let j;
116
+ const pChildren = this._protectedChildren;
117
+ const pLen = pChildren.length;
118
+ let pChild;
119
+ if (this._reorderChildDirty)
120
+ this.sortAllChildren();
121
+ if (this._reorderProtectedChildDirty)
122
+ this.sortAllProtectedChildren();
123
+ for (i = 0; i < len; i++) {
124
+ child = children[i];
125
+ if (child && child._visible) {
126
+ child.visit(this);
127
+ }
128
+ }
129
+ for (j = 0; j < pLen; j++) {
130
+ pChild = pChildren[j];
131
+ if (pChild && pChild._visible) {
132
+ cmd._changeProtectedChild(pChild);
133
+ pChild.visit(this);
134
+ }
135
+ }
136
+ if (stencilClipping) {
137
+ cmd.postStencilVisit();
138
+ }
139
+ else if (scissorClipping) {
140
+ cmd.postScissorVisit();
141
+ }
142
+ if (cmd instanceof ScrollViewWebGLRenderCmd) {
143
+ renderer._turnToNormalMode();
144
+ }
145
+ // Need to update children after do layout
146
+ this.updateChildren();
147
+ cmd._dirtyFlag = 0;
148
+ }
149
+ /**
150
+ * When a widget is in a layout, you could call this method to get the next focused widget within a specified _direction. <br/>
151
+ * If the widget is not in a layout, it will return itself
152
+ *
153
+ * @param {Number} _direction the _direction to look for the next focused widget in a layout
154
+ * @param {Widget} current the current focused widget
155
+ * @returns {Widget}
156
+ */
157
+ findNextFocusedWidget(direction, current) {
158
+ if (this.getLayoutType() === Layout.LINEAR_VERTICAL || this.getLayoutType() === Layout.LINEAR_HORIZONTAL) {
159
+ return this._innerContainer.findNextFocusedWidget(direction, current);
160
+ }
161
+ else
162
+ return super.findNextFocusedWidget(direction, current);
163
+ }
164
+ _initRenderer() {
165
+ super._initRenderer();
166
+ this._innerContainer = new Layout();
167
+ this._innerContainer.setColor(color(255, 255, 255));
168
+ this._innerContainer.setOpacity(255);
169
+ this._innerContainer.setCascadeColorEnabled(true);
170
+ this._innerContainer.setCascadeOpacityEnabled(true);
171
+ this.addProtectedChild(this._innerContainer, 1, 1);
172
+ }
173
+ _createRenderCmd() {
174
+ return new ScrollViewWebGLRenderCmd(this);
175
+ }
176
+ _onSizeChanged() {
177
+ super._onSizeChanged();
178
+ const locSize = this._contentSize;
179
+ this._topBoundary = locSize.height;
180
+ this._rightBoundary = locSize.width;
181
+ const innerSize = this._innerContainer.getContentSize();
182
+ this._innerContainer.setContentSize(Size(Math.max(innerSize.width, locSize.width), Math.max(innerSize.height, locSize.height)));
183
+ this._innerContainer.setPosition(0, locSize.height - this._innerContainer.getContentSize().height);
184
+ if (this._verticalScrollBar)
185
+ this._verticalScrollBar.onScrolled(this._getHowMuchOutOfBoundary());
186
+ if (this._horizontalScrollBar)
187
+ this._horizontalScrollBar.onScrolled(this._getHowMuchOutOfBoundary());
188
+ }
189
+ /**
190
+ * Changes inner container size of ScrollView. <br/>
191
+ * Inner container size must be larger than or equal the size of ScrollView.
192
+ * @param {Size} size inner container size.
193
+ */
194
+ setInnerContainerSize(size) {
195
+ const innerContainer = this._innerContainer;
196
+ const locSize = this._contentSize;
197
+ let innerSizeWidth = locSize.width;
198
+ let innerSizeHeight = locSize.height;
199
+ if (size.width < locSize.width)
200
+ log('Inner width <= ScrollView width, it will be force sized!');
201
+ else
202
+ innerSizeWidth = size.width;
203
+ if (size.height < locSize.height)
204
+ log('Inner height <= ScrollView height, it will be force sized!');
205
+ else
206
+ innerSizeHeight = size.height;
207
+ innerContainer.setContentSize(Size(innerSizeWidth, innerSizeHeight));
208
+ const pos = this._innerContainer.getPosition();
209
+ const contAP = this._innerContainer.getAnchorPoint();
210
+ if (this._innerContainer.getLeftBoundary() != 0.0) {
211
+ pos.x = contAP.x * innerSizeWidth;
212
+ }
213
+ if (this._innerContainer.getTopBoundary() != this._contentSize.height) {
214
+ pos.y = this._contentSize.height - (1.0 - contAP.y) * innerSizeHeight;
215
+ }
216
+ this.setInnerContainerPosition(pos);
217
+ this._updateScrollBar(p(0, 0));
218
+ }
219
+ _setInnerWidth(width) {
220
+ const locW = this._contentSize.width;
221
+ let innerWidth = locW;
222
+ const container = this._innerContainer;
223
+ const oldInnerWidth = container.width;
224
+ if (width < locW)
225
+ log('Inner width <= scrollview width, it will be force sized!');
226
+ else
227
+ innerWidth = width;
228
+ container.width = innerWidth;
229
+ switch (this._direction) {
230
+ case ScrollView.DIR_HORIZONTAL:
231
+ case ScrollView.DIR_BOTH:
232
+ if (container.getRightBoundary() <= locW) {
233
+ const newInnerWidth = container.width;
234
+ const offset = oldInnerWidth - newInnerWidth;
235
+ this._scrollChildren(offset, 0);
236
+ }
237
+ break;
238
+ }
239
+ const innerAX = container.anchorX;
240
+ if (container.getLeftBoundary() > 0.0)
241
+ container.x = innerAX * innerWidth;
242
+ if (container.getRightBoundary() < locW)
243
+ container.x = locW - (1.0 - innerAX) * innerWidth;
244
+ }
245
+ _setInnerHeight(height) {
246
+ const locH = this._contentSize.height;
247
+ let innerHeight = locH;
248
+ const container = this._innerContainer;
249
+ const oldInnerHeight = container.height;
250
+ if (height < locH)
251
+ log('Inner height <= scrollview height, it will be force sized!');
252
+ else
253
+ innerHeight = height;
254
+ container.height = innerHeight;
255
+ switch (this._direction) {
256
+ case ScrollView.DIR_VERTICAL:
257
+ case ScrollView.DIR_BOTH: {
258
+ const newInnerHeight = innerHeight;
259
+ const offset = oldInnerHeight - newInnerHeight;
260
+ this._scrollChildren(0, offset);
261
+ break;
262
+ }
263
+ }
264
+ const innerAY = container.anchorY;
265
+ if (container.getLeftBoundary() > 0.0)
266
+ container.y = innerAY * innerHeight;
267
+ if (container.getRightBoundary() < locH)
268
+ container.y = locH - (1.0 - innerAY) * innerHeight;
269
+ }
270
+ /**
271
+ * Set inner container position
272
+ *
273
+ * @param {Point} position Inner container position.
274
+ */
275
+ setInnerContainerPosition(position) {
276
+ if (position.x === this._innerContainer.getPositionX() && position.y === this._innerContainer.getPositionY()) {
277
+ return;
278
+ }
279
+ this._innerContainer.setPosition(position);
280
+ this._outOfBoundaryAmountDirty = true;
281
+ // Process bouncing events
282
+ if (this.bounceEnabled) {
283
+ for (let _direction = ScrollView.MOVEDIR_TOP; _direction < ScrollView.MOVEDIR_RIGHT; ++_direction) {
284
+ if (this._isOutOfBoundary(_direction)) {
285
+ this._processScrollEvent(_direction, true);
286
+ }
287
+ }
288
+ }
289
+ this._dispatchEvent(ScrollView.EVENT_CONTAINER_MOVED);
290
+ }
291
+ /**
292
+ * Get inner container position
293
+ *
294
+ * @return The inner container position.
295
+ */
296
+ getInnerContainerPosition() {
297
+ return this._innerContainer.getPosition();
298
+ }
299
+ /**
300
+ * Returns inner container size of ScrollView. <br/>
301
+ * Inner container size must be larger than or equal ScrollView's size.
302
+ *
303
+ * @return {Size} inner container size.
304
+ */
305
+ getInnerContainerSize() {
306
+ return this._innerContainer.getContentSize();
307
+ }
308
+ _getInnerWidth() {
309
+ return this._innerContainer.width;
310
+ }
311
+ _getInnerHeight() {
312
+ return this._innerContainer.height;
313
+ }
314
+ _isInContainer(widget) {
315
+ if (!this._clippingEnabled)
316
+ return true;
317
+ const wPos = widget._position;
318
+ const wSize = widget._contentSize;
319
+ const wAnchor = widget._anchorPoint;
320
+ const size = this._customSize;
321
+ const pos = this._innerContainer._position;
322
+ let bottom;
323
+ let left;
324
+ if (
325
+ // Top
326
+ (bottom = wPos.y - wAnchor.y * wSize.height) >= size.height - pos.y ||
327
+ // Bottom
328
+ bottom + wSize.height <= -pos.y ||
329
+ // right
330
+ (left = wPos.x - wAnchor.x * wSize.width) >= size.width - pos.x ||
331
+ // left
332
+ left + wSize.width <= -pos.x)
333
+ return false;
334
+ else
335
+ return true;
336
+ }
337
+ updateChildren() {
338
+ let child, i, l;
339
+ const childrenArray = this._innerContainer._children;
340
+ for (i = 0, l = childrenArray.length; i < l; i++) {
341
+ child = childrenArray[i];
342
+ if (child._inViewRect === true && this._isInContainer(child) === false)
343
+ child._inViewRect = false;
344
+ else if (child._inViewRect === false && this._isInContainer(child) === true)
345
+ child._inViewRect = true;
346
+ }
347
+ }
348
+ /**
349
+ * Add child to ScrollView.
350
+ * @param {Node} widget
351
+ * @param {Number} [zOrder]
352
+ * @param {Number|string} [tag] tag or name
353
+ * @returns {boolean}
354
+ */
355
+ addChild(widget, zOrder, tag) {
356
+ if (!widget)
357
+ return false;
358
+ if (this._isInContainer(widget) === false)
359
+ widget._inViewRect = false;
360
+ zOrder = zOrder || widget.getLocalZOrder();
361
+ tag = tag || widget.getTag();
362
+ return this._innerContainer.addChild(widget, zOrder, tag);
363
+ }
364
+ /**
365
+ * Removes all children.
366
+ */
367
+ removeAllChildren() {
368
+ this.removeAllChildrenWithCleanup(true);
369
+ }
370
+ /**
371
+ * Removes all children.
372
+ * @param {Boolean} cleanup
373
+ */
374
+ removeAllChildrenWithCleanup(cleanup) {
375
+ this._innerContainer.removeAllChildrenWithCleanup(cleanup);
376
+ }
377
+ /**
378
+ * Removes widget child
379
+ * @override
380
+ * @param {Widget} child
381
+ * @param {Boolean} cleanup
382
+ * @returns {boolean}
383
+ */
384
+ removeChild(child, cleanup) {
385
+ return this._innerContainer.removeChild(child, cleanup);
386
+ }
387
+ /**
388
+ * Returns inner container's children
389
+ * @returns {Array}
390
+ */
391
+ getChildren() {
392
+ return this._innerContainer.getChildren();
393
+ }
394
+ /**
395
+ * Gets the count of inner container's children
396
+ * @returns {Number}
397
+ */
398
+ getChildrenCount() {
399
+ return this._innerContainer.getChildrenCount();
400
+ }
401
+ /**
402
+ * Gets a child from the container given its tag
403
+ * @param {Number} tag
404
+ * @returns {Widget}
405
+ */
406
+ getChildByTag(tag) {
407
+ return this._innerContainer.getChildByTag(tag);
408
+ }
409
+ /**
410
+ * Gets a child from the container given its name
411
+ * @param {String} name
412
+ * @returns {Widget}
413
+ */
414
+ getChildByName(name) {
415
+ return this._innerContainer.getChildByName(name);
416
+ }
417
+ _flattenVectorByDirection(vector) {
418
+ const result = p(0, 0);
419
+ result.x = this._direction === ScrollView.DIR_VERTICAL ? 0 : vector.x;
420
+ result.y = this._direction === ScrollView.DIR_HORIZONTAL ? 0 : vector.y;
421
+ return result;
422
+ }
423
+ _getHowMuchOutOfBoundary(addition) {
424
+ if (addition === undefined)
425
+ addition = p(0, 0);
426
+ if (addition.x === 0 && addition.y === 0 && !this._outOfBoundaryAmountDirty) {
427
+ return this._outOfBoundaryAmount;
428
+ }
429
+ const outOfBoundaryAmount = p(0, 0);
430
+ if (this._innerContainer.getLeftBoundary() + addition.x > this._leftBoundary) {
431
+ outOfBoundaryAmount.x = this._leftBoundary - (this._innerContainer.getLeftBoundary() + addition.x);
432
+ }
433
+ else if (this._innerContainer.getRightBoundary() + addition.x < this._rightBoundary) {
434
+ outOfBoundaryAmount.x = this._rightBoundary - (this._innerContainer.getRightBoundary() + addition.x);
435
+ }
436
+ if (this._innerContainer.getTopBoundary() + addition.y < this._topBoundary) {
437
+ outOfBoundaryAmount.y = this._topBoundary - (this._innerContainer.getTopBoundary() + addition.y);
438
+ }
439
+ else if (this._innerContainer.getBottomBoundary() + addition.y > this._bottomBoundary) {
440
+ outOfBoundaryAmount.y = this._bottomBoundary - (this._innerContainer.getBottomBoundary() + addition.y);
441
+ }
442
+ if (addition.x === 0 && addition.y === 0) {
443
+ this._outOfBoundaryAmount = outOfBoundaryAmount;
444
+ this._outOfBoundaryAmountDirty = false;
445
+ }
446
+ return outOfBoundaryAmount;
447
+ }
448
+ _isOutOfBoundary(dir) {
449
+ const outOfBoundary = this._getHowMuchOutOfBoundary();
450
+ if (dir !== undefined) {
451
+ switch (dir) {
452
+ case ScrollView.MOVEDIR_TOP:
453
+ return outOfBoundary.y > 0;
454
+ case ScrollView.MOVEDIR_BOTTOM:
455
+ return outOfBoundary.y < 0;
456
+ case ScrollView.MOVEDIR_LEFT:
457
+ return outOfBoundary.x < 0;
458
+ case ScrollView.MOVEDIR_RIGHT:
459
+ return outOfBoundary.x > 0;
460
+ }
461
+ }
462
+ else {
463
+ return !this._fltEqualZero(outOfBoundary);
464
+ }
465
+ return false;
466
+ }
467
+ _moveInnerContainer(deltaMove, canStartBounceBack) {
468
+ const adjustedMove = this._flattenVectorByDirection(deltaMove);
469
+ this.setInnerContainerPosition(pAdd(this.getInnerContainerPosition(), adjustedMove));
470
+ const outOfBoundary = this._getHowMuchOutOfBoundary();
471
+ this._updateScrollBar(outOfBoundary);
472
+ if (this.bounceEnabled && canStartBounceBack) {
473
+ this._startBounceBackIfNeeded();
474
+ }
475
+ }
476
+ _updateScrollBar(outOfBoundary) {
477
+ if (this._verticalScrollBar) {
478
+ this._verticalScrollBar.onScrolled(outOfBoundary);
479
+ }
480
+ if (this._horizontalScrollBar) {
481
+ this._horizontalScrollBar.onScrolled(outOfBoundary);
482
+ }
483
+ }
484
+ _calculateTouchMoveVelocity() {
485
+ let totalTime = 0;
486
+ for (let i = 0; i < this._touchMoveTimeDeltas.length; ++i) {
487
+ totalTime += this._touchMoveTimeDeltas[i];
488
+ }
489
+ if (totalTime == 0 || totalTime >= this._touchTotalTimeThreshold) {
490
+ return p(0, 0);
491
+ }
492
+ const totalMovement = p(0, 0);
493
+ for (let i = 0; i < this._touchMoveDisplacements.length; ++i) {
494
+ totalMovement.x += this._touchMoveDisplacements[i].x;
495
+ totalMovement.y += this._touchMoveDisplacements[i].y;
496
+ }
497
+ return pMult(totalMovement, 1 / totalTime);
498
+ }
499
+ /**
500
+ * Set the touch total time threshold
501
+ * @param {Number} touchTotalTimeThreshold
502
+ */
503
+ setTouchTotalTimeThreshold(touchTotalTimeThreshold) {
504
+ this._touchTotalTimeThreshold = touchTotalTimeThreshold;
505
+ }
506
+ /**
507
+ * Get the touch total time threshold
508
+ * @returns {Number}
509
+ */
510
+ getTouchTotalTimeThreshold() {
511
+ return this._touchTotalTimeThreshold;
512
+ }
513
+ _startInertiaScroll(touchMoveVelocity) {
514
+ const MOVEMENT_FACTOR = 0.7;
515
+ const inertiaTotalMovement = pMult(touchMoveVelocity, MOVEMENT_FACTOR);
516
+ this._startAttenuatingAutoScroll(inertiaTotalMovement, touchMoveVelocity);
517
+ }
518
+ _startBounceBackIfNeeded() {
519
+ if (!this.bounceEnabled) {
520
+ return false;
521
+ }
522
+ const bounceBackAmount = this._getHowMuchOutOfBoundary();
523
+ if (this._fltEqualZero(bounceBackAmount)) {
524
+ return false;
525
+ }
526
+ const BOUNCE_BACK_DURATION = 1.0;
527
+ this._startAutoScroll(bounceBackAmount, BOUNCE_BACK_DURATION, true);
528
+ return true;
529
+ }
530
+ _startAutoScrollToDestination(destination, timeInSec, attenuated) {
531
+ this._startAutoScroll(pSub(destination, this._innerContainer.getPosition()), timeInSec, attenuated);
532
+ }
533
+ _calculateAutoScrollTimeByInitialSpeed(initialSpeed) {
534
+ // Calculate the time from the initial speed according to quintic polynomial.
535
+ return Math.sqrt(Math.sqrt(initialSpeed / 5));
536
+ }
537
+ _startAttenuatingAutoScroll(deltaMove, initialVelocity) {
538
+ const time = this._calculateAutoScrollTimeByInitialSpeed(pLength(initialVelocity));
539
+ this._startAutoScroll(deltaMove, time, true);
540
+ }
541
+ _startAutoScroll(deltaMove, timeInSec, attenuated) {
542
+ const adjustedDeltaMove = this._flattenVectorByDirection(deltaMove);
543
+ this._autoScrolling = true;
544
+ this._autoScrollTargetDelta = adjustedDeltaMove;
545
+ this._autoScrollAttenuate = attenuated;
546
+ this._autoScrollStartPosition = this._innerContainer.getPosition();
547
+ this._autoScrollTotalTime = timeInSec;
548
+ this._autoScrollAccumulatedTime = 0;
549
+ this._autoScrollBraking = false;
550
+ this._autoScrollBrakingStartPosition = p(0, 0);
551
+ // If the destination is also out of boundary of same side, start brake from beggining.
552
+ const currentOutOfBoundary = this._getHowMuchOutOfBoundary();
553
+ if (!this._fltEqualZero(currentOutOfBoundary)) {
554
+ this._autoScrollCurrentlyOutOfBoundary = true;
555
+ const afterOutOfBoundary = this._getHowMuchOutOfBoundary(adjustedDeltaMove);
556
+ if (currentOutOfBoundary.x * afterOutOfBoundary.x > 0 || currentOutOfBoundary.y * afterOutOfBoundary.y > 0) {
557
+ this._autoScrollBraking = true;
558
+ }
559
+ }
560
+ }
561
+ /**
562
+ * Immediately stops inner container scroll initiated by any of the "scrollTo*" member functions
563
+ */
564
+ stopAutoScroll() {
565
+ this._autoScrolling = false;
566
+ this._autoScrollAttenuate = true;
567
+ this._autoScrollTotalTime = 0;
568
+ this._autoScrollAccumulatedTime = 0;
569
+ }
570
+ _isNecessaryAutoScrollBrake() {
571
+ if (this._autoScrollBraking) {
572
+ return true;
573
+ }
574
+ if (this._isOutOfBoundary()) {
575
+ // It just went out of boundary.
576
+ if (!this._autoScrollCurrentlyOutOfBoundary) {
577
+ this._autoScrollCurrentlyOutOfBoundary = true;
578
+ this._autoScrollBraking = true;
579
+ this._autoScrollBrakingStartPosition = this.getInnerContainerPosition();
580
+ return true;
581
+ }
582
+ }
583
+ else {
584
+ this._autoScrollCurrentlyOutOfBoundary = false;
585
+ }
586
+ return false;
587
+ }
588
+ _getAutoScrollStopEpsilon() {
589
+ return 0.0001;
590
+ }
591
+ _fltEqualZero(point) {
592
+ return Math.abs(point.x) <= 0.0001 && Math.abs(point.y) <= 0.0001;
593
+ }
594
+ _processAutoScrolling(deltaTime) {
595
+ const OUT_OF_BOUNDARY_BREAKING_FACTOR = 0.05;
596
+ // Make auto scroll shorter if it needs to deaccelerate.
597
+ const brakingFactor = this._isNecessaryAutoScrollBrake() ? OUT_OF_BOUNDARY_BREAKING_FACTOR : 1;
598
+ // Elapsed time
599
+ this._autoScrollAccumulatedTime += deltaTime * (1 / brakingFactor);
600
+ // Calculate the progress percentage
601
+ let percentage = Math.min(1, this._autoScrollAccumulatedTime / this._autoScrollTotalTime);
602
+ if (this._autoScrollAttenuate) {
603
+ percentage -= 1;
604
+ percentage = percentage * percentage * percentage * percentage * percentage + 1;
605
+ }
606
+ // Calculate the new position
607
+ let newPosition = pAdd(this._autoScrollStartPosition, pMult(this._autoScrollTargetDelta, percentage));
608
+ let reachedEnd = Math.abs(percentage - 1) <= this._getAutoScrollStopEpsilon();
609
+ if (this.bounceEnabled) {
610
+ // The new position is adjusted if out of boundary
611
+ newPosition = pAdd(this._autoScrollBrakingStartPosition, pMult(pSub(newPosition, this._autoScrollBrakingStartPosition), brakingFactor));
612
+ }
613
+ else {
614
+ // Don't let go out of boundary
615
+ const moveDelta = pSub(newPosition, this.getInnerContainerPosition());
616
+ const outOfBoundary = this._getHowMuchOutOfBoundary(moveDelta);
617
+ if (!this._fltEqualZero(outOfBoundary)) {
618
+ newPosition.x += outOfBoundary.x;
619
+ newPosition.y += outOfBoundary.y;
620
+ reachedEnd = true;
621
+ }
622
+ }
623
+ // Finish auto scroll if it ended
624
+ if (reachedEnd) {
625
+ this._autoScrolling = false;
626
+ this._dispatchEvent(ScrollView.EVENT_AUTOSCROLL_ENDED);
627
+ }
628
+ this._moveInnerContainer(pSub(newPosition, this.getInnerContainerPosition()), reachedEnd);
629
+ }
630
+ _jumpToDestination(desOrX, y) {
631
+ if (desOrX.x === undefined) {
632
+ desOrX = p(desOrX, y);
633
+ }
634
+ this._autoScrolling = false;
635
+ this._moveInnerContainer(pSub(desOrX, this.getInnerContainerPosition()), true);
636
+ }
637
+ _scrollChildren(deltaMove, offset) {
638
+ const realMove = deltaMove;
639
+ if (this.bounceEnabled) {
640
+ // If the position of the inner container is out of the boundary, the offsets should be divided by two.
641
+ const outOfBoundary = this._getHowMuchOutOfBoundary();
642
+ realMove.x *= outOfBoundary.x == 0 ? 1 : 0.5;
643
+ realMove.y *= outOfBoundary.y == 0 ? 1 : 0.5;
644
+ }
645
+ if (!this.bounceEnabled) {
646
+ const outOfBoundary = this._getHowMuchOutOfBoundary(realMove);
647
+ realMove.x += outOfBoundary.x;
648
+ realMove.y += outOfBoundary.y;
649
+ }
650
+ let scrolledToLeft = false;
651
+ let scrolledToRight = false;
652
+ let scrolledToTop = false;
653
+ let scrolledToBottom = false;
654
+ if (realMove.y > 0.0) {
655
+ // up
656
+ const icBottomPos = this._innerContainer.getBottomBoundary();
657
+ if (icBottomPos + realMove.y >= this._bottomBoundary) {
658
+ scrolledToBottom = true;
659
+ }
660
+ }
661
+ else if (realMove.y < 0.0) {
662
+ // down
663
+ const icTopPos = this._innerContainer.getTopBoundary();
664
+ if (icTopPos + realMove.y <= this._topBoundary) {
665
+ scrolledToTop = true;
666
+ }
667
+ }
668
+ if (realMove.x < 0.0) {
669
+ // left
670
+ const icRightPos = this._innerContainer.getRightBoundary();
671
+ if (icRightPos + realMove.x <= this._rightBoundary) {
672
+ scrolledToRight = true;
673
+ }
674
+ }
675
+ else if (realMove.x > 0.0) {
676
+ // right
677
+ const icLeftPos = this._innerContainer.getLeftBoundary();
678
+ if (icLeftPos + realMove.x >= this._leftBoundary) {
679
+ scrolledToLeft = true;
680
+ }
681
+ }
682
+ this._moveInnerContainer(realMove, false);
683
+ if (realMove.x != 0 || realMove.y != 0) {
684
+ this._processScrollingEvent();
685
+ }
686
+ if (scrolledToBottom) {
687
+ this._processScrollEvent(ScrollView.MOVEDIR_BOTTOM, false);
688
+ }
689
+ if (scrolledToTop) {
690
+ this._processScrollEvent(ScrollView.MOVEDIR_TOP, false);
691
+ }
692
+ if (scrolledToLeft) {
693
+ this._processScrollEvent(ScrollView.MOVEDIR_LEFT, false);
694
+ }
695
+ if (scrolledToRight) {
696
+ this._processScrollEvent(ScrollView.MOVEDIR_RIGHT, false);
697
+ }
698
+ }
699
+ /**
700
+ * Scroll inner container to bottom boundary of ScrollView.
701
+ * @param {Number} time
702
+ * @param {Boolean} attenuated
703
+ */
704
+ scrollToBottom(time, attenuated) {
705
+ this._startAutoScrollToDestination(p(this._innerContainer.getPositionX(), 0), time, attenuated);
706
+ }
707
+ /**
708
+ * Scroll inner container to top boundary of ScrollView.
709
+ * @param {Number} time
710
+ * @param {Boolean} attenuated
711
+ */
712
+ scrollToTop(time, attenuated) {
713
+ this._startAutoScrollToDestination(p(this._innerContainer.getPositionX(), this._contentSize.height - this._innerContainer.getContentSize().height), time, attenuated);
714
+ }
715
+ /**
716
+ * Scroll inner container to left boundary of ScrollView.
717
+ * @param {Number} time
718
+ * @param {Boolean} attenuated
719
+ */
720
+ scrollToLeft(time, attenuated) {
721
+ this._startAutoScrollToDestination(p(0, this._innerContainer.getPositionY()), time, attenuated);
722
+ }
723
+ /**
724
+ * Scroll inner container to right boundary of ScrollView.
725
+ * @param {Number} time
726
+ * @param {Boolean} attenuated
727
+ */
728
+ scrollToRight(time, attenuated) {
729
+ this._startAutoScrollToDestination(p(this._contentSize.width - this._innerContainer.getContentSize().width, this._innerContainer.getPositionY()), time, attenuated);
730
+ }
731
+ /**
732
+ * Scroll inner container to top and left boundary of ScrollView.
733
+ * @param {Number} time
734
+ * @param {Boolean} attenuated
735
+ */
736
+ scrollToTopLeft(time, attenuated) {
737
+ if (this._direction !== ScrollView.DIR_BOTH) {
738
+ log('Scroll direction is not both!');
739
+ return;
740
+ }
741
+ this._startAutoScrollToDestination(p(0, this._contentSize.height - this._innerContainer.getContentSize().height), time, attenuated);
742
+ }
743
+ /**
744
+ * Scroll inner container to top and right boundary of ScrollView.
745
+ * @param {Number} time
746
+ * @param {Boolean} attenuated
747
+ */
748
+ scrollToTopRight(time, attenuated) {
749
+ if (this._direction !== ScrollView.DIR_BOTH) {
750
+ log('Scroll direction is not both!');
751
+ return;
752
+ }
753
+ const inSize = this._innerContainer.getContentSize();
754
+ this._startAutoScrollToDestination(p(this._contentSize.width - inSize.width, this._contentSize.height - inSize.height), time, attenuated);
755
+ }
756
+ /**
757
+ * Scroll inner container to bottom and left boundary of ScrollView.
758
+ * @param {Number} time
759
+ * @param {Boolean} attenuated
760
+ */
761
+ scrollToBottomLeft(time, attenuated) {
762
+ if (this._direction !== ScrollView.DIR_BOTH) {
763
+ log('Scroll direction is not both!');
764
+ return;
765
+ }
766
+ this._startAutoScrollToDestination(p(0, 0), time, attenuated);
767
+ }
768
+ /**
769
+ * Scroll inner container to bottom and right boundary of ScrollView.
770
+ * @param {Number} time
771
+ * @param {Boolean} attenuated
772
+ */
773
+ scrollToBottomRight(time, attenuated) {
774
+ if (this._direction !== ScrollView.DIR_BOTH) {
775
+ log('Scroll direction is not both!');
776
+ return;
777
+ }
778
+ this._startAutoScrollToDestination(p(this._contentSize.width - this._innerContainer.getContentSize().width, 0), time, attenuated);
779
+ }
780
+ /**
781
+ * Scroll inner container to vertical percent position of ScrollView.
782
+ * @param {Number} percent
783
+ * @param {Number} time
784
+ * @param {Boolean} attenuated
785
+ */
786
+ scrollToPercentVertical(percent, time, attenuated) {
787
+ const minY = this._contentSize.height - this._innerContainer.getContentSize().height;
788
+ const h = -minY;
789
+ this._startAutoScrollToDestination(p(this._innerContainer.getPositionX(), minY + (percent * h) / 100), time, attenuated);
790
+ }
791
+ /**
792
+ * Scroll inner container to horizontal percent position of ScrollView.
793
+ * @param {Number} percent
794
+ * @param {Number} time
795
+ * @param {Boolean} attenuated
796
+ */
797
+ scrollToPercentHorizontal(percent, time, attenuated) {
798
+ const w = this._innerContainer.getContentSize().width - this._contentSize.width;
799
+ this._startAutoScrollToDestination(p(-((percent * w) / 100), this._innerContainer.getPositionY()), time, attenuated);
800
+ }
801
+ /**
802
+ * Scroll inner container to both _direction percent position of ScrollView.
803
+ * @param {Point} percent
804
+ * @param {Number} time
805
+ * @param {Boolean} attenuated
806
+ */
807
+ scrollToPercentBothDirection(percent, time, attenuated) {
808
+ if (this._direction !== ScrollView.DIR_BOTH)
809
+ return;
810
+ const minY = this._contentSize.height - this._innerContainer.getContentSize().height;
811
+ const h = -minY;
812
+ const w = this._innerContainer.getContentSize().width - this._contentSize.width;
813
+ this._startAutoScrollToDestination(p(-((percent.x * w) / 100), minY + (percent.y * h) / 100), time, attenuated);
814
+ }
815
+ /**
816
+ * Move inner container to bottom boundary of ScrollView.
817
+ */
818
+ jumpToBottom() {
819
+ this._jumpToDestination(this._innerContainer.getPositionX(), 0);
820
+ }
821
+ /**
822
+ * Move inner container to top boundary of ScrollView.
823
+ */
824
+ jumpToTop() {
825
+ this._jumpToDestination(this._innerContainer.getPositionX(), this._contentSize.height - this._innerContainer.getContentSize().height);
826
+ }
827
+ /**
828
+ * Move inner container to left boundary of ScrollView.
829
+ */
830
+ jumpToLeft() {
831
+ this._jumpToDestination(0, this._innerContainer.getPositionY());
832
+ }
833
+ /**
834
+ * Move inner container to right boundary of ScrollView.
835
+ */
836
+ jumpToRight() {
837
+ this._jumpToDestination(this._contentSize.width - this._innerContainer.getContentSize().width, this._innerContainer.getPositionY());
838
+ }
839
+ /**
840
+ * Move inner container to top and left boundary of ScrollView.
841
+ */
842
+ jumpToTopLeft() {
843
+ if (this._direction !== ScrollView.DIR_BOTH) {
844
+ log('Scroll _direction is not both!');
845
+ return;
846
+ }
847
+ this._jumpToDestination(0, this._contentSize.height - this._innerContainer.getContentSize().height);
848
+ }
849
+ /**
850
+ * Move inner container to top and right boundary of ScrollView.
851
+ */
852
+ jumpToTopRight() {
853
+ if (this._direction !== ScrollView.DIR_BOTH) {
854
+ log('Scroll _direction is not both!');
855
+ return;
856
+ }
857
+ const inSize = this._innerContainer.getContentSize();
858
+ this._jumpToDestination(this._contentSize.width - inSize.width, this._contentSize.height - inSize.height);
859
+ }
860
+ /**
861
+ * Move inner container to bottom and left boundary of ScrollView.
862
+ */
863
+ jumpToBottomLeft() {
864
+ if (this._direction !== ScrollView.DIR_BOTH) {
865
+ log('Scroll _direction is not both!');
866
+ return;
867
+ }
868
+ this._jumpToDestination(0, 0);
869
+ }
870
+ /**
871
+ * Move inner container to bottom and right boundary of ScrollView.
872
+ */
873
+ jumpToBottomRight() {
874
+ if (this._direction !== ScrollView.DIR_BOTH) {
875
+ log('Scroll _direction is not both!');
876
+ return;
877
+ }
878
+ this._jumpToDestination(this._contentSize.width - this._innerContainer.getContentSize().width, 0);
879
+ }
880
+ /**
881
+ * Move inner container to vertical percent position of ScrollView.
882
+ * @param {Number} percent The destination vertical percent, accept value between 0 - 100
883
+ */
884
+ jumpToPercentVertical(percent) {
885
+ const minY = this._contentSize.height - this._innerContainer.getContentSize().height;
886
+ const h = -minY;
887
+ this._jumpToDestination(this._innerContainer.getPositionX(), minY + (percent * h) / 100);
888
+ }
889
+ /**
890
+ * Move inner container to horizontal percent position of ScrollView.
891
+ * @param {Number} percent The destination vertical percent, accept value between 0 - 100
892
+ */
893
+ jumpToPercentHorizontal(percent) {
894
+ const w = this._innerContainer.getContentSize().width - this._contentSize.width;
895
+ this._jumpToDestination(-((percent * w) / 100), this._innerContainer.getPositionY());
896
+ }
897
+ /**
898
+ * Move inner container to both _direction percent position of ScrollView.
899
+ * @param {Point} percent The destination vertical percent, accept value between 0 - 100
900
+ */
901
+ jumpToPercentBothDirection(percent) {
902
+ if (this._direction !== ScrollView.DIR_BOTH)
903
+ return;
904
+ const inSize = this._innerContainer.getContentSize();
905
+ const minY = this._contentSize.height - inSize.height;
906
+ const h = -minY;
907
+ const w = inSize.width - this._contentSize.width;
908
+ this._jumpToDestination(-((percent.x * w) / 100), minY + (percent.y * h) / 100);
909
+ }
910
+ _gatherTouchMove(delta) {
911
+ const NUMBER_OF_GATHERED_TOUCHES_FOR_MOVE_SPEED = 5;
912
+ while (this._touchMoveDisplacements.length >= NUMBER_OF_GATHERED_TOUCHES_FOR_MOVE_SPEED) {
913
+ this._touchMoveDisplacements.splice(0, 1);
914
+ this._touchMoveTimeDeltas.splice(0, 1);
915
+ }
916
+ this._touchMoveDisplacements.push(delta);
917
+ const timestamp = new Date().getTime();
918
+ this._touchMoveTimeDeltas.push((timestamp - this._touchMovePreviousTimestamp) / 1000);
919
+ this._touchMovePreviousTimestamp = timestamp;
920
+ }
921
+ _handlePressLogic(touch) {
922
+ this._bePressed = true;
923
+ this._autoScrolling = false;
924
+ // Clear gathered touch move information
925
+ this._touchMovePreviousTimestamp = new Date().getTime();
926
+ this._touchMoveDisplacements.length = 0;
927
+ this._touchMoveTimeDeltas.length = 0;
928
+ if (this._verticalScrollBar) {
929
+ this._verticalScrollBar.onTouchBegan();
930
+ }
931
+ if (this._horizontalScrollBar) {
932
+ this._horizontalScrollBar.onTouchBegan();
933
+ }
934
+ }
935
+ _handleMoveLogic(touch) {
936
+ const touchPositionInNodeSpace = this.convertToNodeSpace(touch.getLocation()), previousTouchPositionInNodeSpace = this.convertToNodeSpace(touch.getPreviousLocation());
937
+ const delta = pSub(touchPositionInNodeSpace, previousTouchPositionInNodeSpace);
938
+ this._scrollChildren(delta);
939
+ this._gatherTouchMove(delta);
940
+ }
941
+ _handleReleaseLogic(touch) {
942
+ const touchPositionInNodeSpace = this.convertToNodeSpace(touch.getLocation()), previousTouchPositionInNodeSpace = this.convertToNodeSpace(touch.getPreviousLocation());
943
+ const delta = pSub(touchPositionInNodeSpace, previousTouchPositionInNodeSpace);
944
+ this._gatherTouchMove(delta);
945
+ this._bePressed = false;
946
+ const bounceBackStarted = this._startBounceBackIfNeeded();
947
+ if (!bounceBackStarted && this.inertiaScrollEnabled) {
948
+ const touchMoveVelocity = this._calculateTouchMoveVelocity();
949
+ if (touchMoveVelocity.x !== 0 || touchMoveVelocity.y !== 0) {
950
+ this._startInertiaScroll(touchMoveVelocity);
951
+ }
952
+ }
953
+ if (this._verticalScrollBar) {
954
+ this._verticalScrollBar.onTouchEnded();
955
+ }
956
+ if (this._horizontalScrollBar) {
957
+ this._horizontalScrollBar.onTouchEnded();
958
+ }
959
+ }
960
+ /**
961
+ * The touch began event callback handler of ScrollView.
962
+ * @param {Touch} touch
963
+ * @param {Event} event
964
+ * @returns {boolean}
965
+ */
966
+ onTouchBegan(touch, event) {
967
+ const pass = Layout.prototype.onTouchBegan.call(this, touch, event);
968
+ if (!this._isInterceptTouch) {
969
+ if (this._hit)
970
+ this._handlePressLogic(touch);
971
+ }
972
+ return pass;
973
+ }
974
+ /**
975
+ * The touch moved event callback handler of ScrollView.
976
+ * @param {Touch} touch
977
+ * @param {Event} event
978
+ */
979
+ onTouchMoved(touch, event) {
980
+ Layout.prototype.onTouchMoved.call(this, touch, event);
981
+ if (!this._isInterceptTouch)
982
+ this._handleMoveLogic(touch);
983
+ }
984
+ /**
985
+ * The touch ended event callback handler of ScrollView.
986
+ * @param {Touch} touch
987
+ * @param {Event} event
988
+ */
989
+ onTouchEnded(touch, event) {
990
+ Layout.prototype.onTouchEnded.call(this, touch, event);
991
+ if (!this._isInterceptTouch)
992
+ this._handleReleaseLogic(touch);
993
+ this._isInterceptTouch = false;
994
+ }
995
+ /**
996
+ * The touch canceled event callback of ScrollView.
997
+ * @param {Touch} touch
998
+ * @param {Event} event
999
+ */
1000
+ onTouchCancelled(touch, event) {
1001
+ super.onTouchCancelled(touch, event);
1002
+ if (!this._isInterceptTouch)
1003
+ this._handleReleaseLogic(touch);
1004
+ this._isInterceptTouch = false;
1005
+ }
1006
+ /**
1007
+ * The update callback handler.
1008
+ * @param {Number} dt
1009
+ */
1010
+ update(dt) {
1011
+ if (this._autoScrolling)
1012
+ this._processAutoScrolling(dt);
1013
+ }
1014
+ /**
1015
+ * Intercept touch event, handle its child's touch event.
1016
+ * @override
1017
+ * @param {number} event event type
1018
+ * @param {Widget} sender
1019
+ * @param {Touch} touch
1020
+ */
1021
+ interceptTouchEvent(event, sender, touch) {
1022
+ if (!this._touchEnabled) {
1023
+ Layout.prototype.interceptTouchEvent.call(this, event, sender, touch);
1024
+ return;
1025
+ }
1026
+ if (this._direction === ScrollView.DIR_NONE)
1027
+ return;
1028
+ const touchPoint = touch.getLocation();
1029
+ switch (event) {
1030
+ case Widget.TOUCH_BEGAN:
1031
+ this._isInterceptTouch = true;
1032
+ this._touchBeganPosition.x = touchPoint.x;
1033
+ this._touchBeganPosition.y = touchPoint.y;
1034
+ this._handlePressLogic(touch);
1035
+ break;
1036
+ case Widget.TOUCH_MOVED: {
1037
+ const offset = pLength(pSub(sender.getTouchBeganPosition(), touchPoint));
1038
+ this._touchMovePosition.x = touchPoint.x;
1039
+ this._touchMovePosition.y = touchPoint.y;
1040
+ if (offset > this._childFocusCancelOffset) {
1041
+ sender.setHighlighted(false);
1042
+ this._handleMoveLogic(touch);
1043
+ }
1044
+ break;
1045
+ }
1046
+ case Widget.TOUCH_CANCELED:
1047
+ case Widget.TOUCH_ENDED:
1048
+ this._touchEndPosition.x = touchPoint.x;
1049
+ this._touchEndPosition.y = touchPoint.y;
1050
+ this._handleReleaseLogic(touch);
1051
+ if (sender.isSwallowTouches())
1052
+ this._isInterceptTouch = false;
1053
+ break;
1054
+ }
1055
+ }
1056
+ _processScrollEvent(_directionEvent, bounce) {
1057
+ let event = 0;
1058
+ switch (_directionEvent) {
1059
+ case ScrollView.MOVEDIR_TOP:
1060
+ event = bounce ? ScrollView.EVENT_BOUNCE_TOP : ScrollView.EVENT_SCROLL_TO_TOP;
1061
+ break;
1062
+ case ScrollView.MOVEDIR_BOTTOM:
1063
+ event = bounce ? ScrollView.EVENT_BOUNCE_BOTTOM : ScrollView.EVENT_SCROLL_TO_BOTTOM;
1064
+ break;
1065
+ case ScrollView.MOVEDIR_LEFT:
1066
+ event = bounce ? ScrollView.EVENT_BOUNCE_LEFT : ScrollView.EVENT_SCROLL_TO_LEFT;
1067
+ break;
1068
+ case ScrollView.MOVEDIR_RIGHT:
1069
+ event = bounce ? ScrollView.EVENT_BOUNCE_RIGHT : ScrollView.EVENT_SCROLL_TO_RIGHT;
1070
+ break;
1071
+ }
1072
+ this._dispatchEvent(event);
1073
+ }
1074
+ _processScrollingEvent() {
1075
+ this._dispatchEvent(ScrollView.EVENT_SCROLLING);
1076
+ }
1077
+ _dispatchEvent(event) {
1078
+ if (this._scrollViewEventSelector) {
1079
+ if (this._scrollViewEventListener)
1080
+ this._scrollViewEventSelector.call(this._scrollViewEventListener, this, event);
1081
+ else
1082
+ this._scrollViewEventSelector(this, event);
1083
+ }
1084
+ if (this._ccEventCallback)
1085
+ this._ccEventCallback(this, event);
1086
+ }
1087
+ /**
1088
+ * Adds callback function called ScrollView event triggered
1089
+ * @param {Function} selector
1090
+ * @param {Object} [target=]
1091
+ * @deprecated since v3.0, please use addEventListener instead.
1092
+ */
1093
+ addEventListenerScrollView(selector, target) {
1094
+ this._scrollViewEventSelector = selector;
1095
+ this._scrollViewEventListener = target;
1096
+ }
1097
+ /**
1098
+ * Adds callback function called ScrollView event triggered
1099
+ * @param {Function} selector
1100
+ */
1101
+ addEventListener(selector) {
1102
+ this._ccEventCallback = selector;
1103
+ }
1104
+ /**
1105
+ * Changes scroll _direction of ScrollView.
1106
+ * @param {ScrollView.DIR_NONE | ScrollView.DIR_VERTICAL | ScrollView.DIR_HORIZONTAL | ScrollView.DIR_BOTH} dir
1107
+ * Direction::VERTICAL means vertical scroll, Direction::HORIZONTAL means horizontal scroll
1108
+ */
1109
+ setDirection(dir) {
1110
+ this._direction = dir;
1111
+ if (this._scrollBarEnabled) {
1112
+ this._removeScrollBar();
1113
+ this._initScrollBar();
1114
+ }
1115
+ }
1116
+ /**
1117
+ * Returns scroll direction of ScrollView.
1118
+ * @returns {ScrollView.DIR_NONE | ScrollView.DIR_VERTICAL | ScrollView.DIR_HORIZONTAL | ScrollView.DIR_BOTH}
1119
+ */
1120
+ getDirection() {
1121
+ return this._direction;
1122
+ }
1123
+ /**
1124
+ * Sets bounce enabled
1125
+ * @param {Boolean} enabled
1126
+ */
1127
+ setBounceEnabled(enabled) {
1128
+ this.bounceEnabled = enabled;
1129
+ }
1130
+ /**
1131
+ * Returns whether bounce is enabled
1132
+ * @returns {boolean}
1133
+ */
1134
+ isBounceEnabled() {
1135
+ return this.bounceEnabled;
1136
+ }
1137
+ /**
1138
+ * Sets inertiaScroll enabled
1139
+ * @param {boolean} enabled
1140
+ */
1141
+ setInertiaScrollEnabled(enabled) {
1142
+ this.inertiaScrollEnabled = enabled;
1143
+ }
1144
+ /**
1145
+ * Returns whether inertiaScroll is enabled
1146
+ * @returns {boolean}
1147
+ */
1148
+ isInertiaScrollEnabled() {
1149
+ return this.inertiaScrollEnabled;
1150
+ }
1151
+ /**
1152
+ * Toggle scroll bar enabled.
1153
+ * @param {boolean} enabled True if enable scroll bar, false otherwise.
1154
+ */
1155
+ setScrollBarEnabled(enabled) {
1156
+ if (this._scrollBarEnabled === enabled) {
1157
+ return;
1158
+ }
1159
+ if (this._scrollBarEnabled) {
1160
+ this._removeScrollBar();
1161
+ }
1162
+ this._scrollBarEnabled = enabled;
1163
+ if (this._scrollBarEnabled) {
1164
+ this._initScrollBar();
1165
+ }
1166
+ }
1167
+ /**
1168
+ * Query scroll bar state.
1169
+ * @returns {boolean} True if scroll bar is enabled, false otherwise.
1170
+ */
1171
+ isScrollBarEnabled() {
1172
+ return this._scrollBarEnabled;
1173
+ }
1174
+ /**
1175
+ * Set the scroll bar positions from the left-bottom corner (horizontal) and right-top corner (vertical).
1176
+ * @param {Point} positionFromCorner The position from the left-bottom corner (horizontal) and right-top corner (vertical).
1177
+ */
1178
+ setScrollBarPositionFromCorner(positionFromCorner) {
1179
+ if (this._direction !== ScrollView.DIR_HORIZONTAL) {
1180
+ this.setScrollBarPositionFromCornerForVertical(positionFromCorner);
1181
+ }
1182
+ if (this._direction !== ScrollView.DIR_VERTICAL) {
1183
+ this.setScrollBarPositionFromCornerForHorizontal(positionFromCorner);
1184
+ }
1185
+ }
1186
+ /**
1187
+ * Set the vertical scroll bar position from right-top corner.
1188
+ * @param {Point} positionFromCorner The position from right-top corner
1189
+ */
1190
+ setScrollBarPositionFromCornerForVertical(positionFromCorner) {
1191
+ assert(this._scrollBarEnabled, 'Scroll bar should be enabled!');
1192
+ assert(this._direction !== ScrollView.DIR_HORIZONTAL, 'Scroll view doesnt have a vertical scroll bar!');
1193
+ this._verticalScrollBar.setPositionFromCorner(positionFromCorner);
1194
+ }
1195
+ /**
1196
+ * Get the vertical scroll bar's position from right-top corner.
1197
+ * @returns {Point}
1198
+ */
1199
+ getScrollBarPositionFromCornerForVertical() {
1200
+ assert(this._scrollBarEnabled, 'Scroll bar should be enabled!');
1201
+ assert(this._direction !== ScrollView.DIR_HORIZONTAL, 'Scroll view doesnt have a vertical scroll bar!');
1202
+ return this._verticalScrollBar.getPositionFromCorner();
1203
+ }
1204
+ /**
1205
+ * Set the horizontal scroll bar position from left-bottom corner.
1206
+ * @param {Point} positionFromCorner The position from left-bottom corner
1207
+ */
1208
+ setScrollBarPositionFromCornerForHorizontal(positionFromCorner) {
1209
+ assert(this._scrollBarEnabled, 'Scroll bar should be enabled!');
1210
+ assert(this._direction !== ScrollView.DIR_VERTICAL, 'Scroll view doesnt have a horizontal scroll bar!');
1211
+ this._horizontalScrollBar.setPositionFromCorner(positionFromCorner);
1212
+ }
1213
+ /**
1214
+ * Get the horizontal scroll bar's position from right-top corner.
1215
+ * @returns {Point}
1216
+ */
1217
+ getScrollBarPositionFromCornerForHorizontal() {
1218
+ assert(this._scrollBarEnabled, 'Scroll bar should be enabled!');
1219
+ assert(this._direction !== ScrollView.DIR_VERTICAL, 'Scroll view doesnt have a horizontal scroll bar!');
1220
+ return this._horizontalScrollBar.getPositionFromCorner();
1221
+ }
1222
+ /**
1223
+ * Set the scroll bar's width
1224
+ * @param {number} width The scroll bar's width
1225
+ */
1226
+ setScrollBarWidth(width) {
1227
+ assert(this._scrollBarEnabled, 'Scroll bar should be enabled!');
1228
+ if (this._verticalScrollBar) {
1229
+ this._verticalScrollBar.setWidth(width);
1230
+ }
1231
+ if (this._horizontalScrollBar) {
1232
+ this._horizontalScrollBar.setWidth(width);
1233
+ }
1234
+ }
1235
+ /**
1236
+ * Get the scroll bar's width
1237
+ * @returns {number} the scroll bar's width
1238
+ */
1239
+ getScrollBarWidth() {
1240
+ assert(this._scrollBarEnabled, 'Scroll bar should be enabled!');
1241
+ if (this._verticalScrollBar) {
1242
+ return this._verticalScrollBar.getWidth();
1243
+ }
1244
+ if (this._horizontalScrollBar) {
1245
+ return this._horizontalScrollBar.getWidth();
1246
+ }
1247
+ return 0;
1248
+ }
1249
+ /**
1250
+ * Set the scroll bar's color
1251
+ * @param {Color} color the scroll bar's color
1252
+ */
1253
+ setScrollBarColor(color) {
1254
+ assert(this._scrollBarEnabled, 'Scroll bar should be enabled!');
1255
+ if (this._verticalScrollBar) {
1256
+ this._verticalScrollBar.setColor(color);
1257
+ }
1258
+ if (this._horizontalScrollBar) {
1259
+ this._horizontalScrollBar.setColor(color);
1260
+ }
1261
+ }
1262
+ /**
1263
+ * Get the scroll bar's color
1264
+ * @returns {Color} the scroll bar's color
1265
+ */
1266
+ getScrollBarColor() {
1267
+ assert(this._scrollBarEnabled, 'Scroll bar should be enabled!');
1268
+ if (this._verticalScrollBar) {
1269
+ this._verticalScrollBar.getColor();
1270
+ }
1271
+ if (this._horizontalScrollBar) {
1272
+ this._horizontalScrollBar.getColor();
1273
+ }
1274
+ return Color.WHITE;
1275
+ }
1276
+ /**
1277
+ * Set the scroll bar's opacity
1278
+ * @param {number} opacity the scroll bar's opacity
1279
+ */
1280
+ setScrollBarOpacity(opacity) {
1281
+ assert(this._scrollBarEnabled, 'Scroll bar should be enabled!');
1282
+ if (this._verticalScrollBar) {
1283
+ this._verticalScrollBar.opacity = opacity;
1284
+ }
1285
+ if (this._horizontalScrollBar) {
1286
+ this._horizontalScrollBar.opacity = opacity;
1287
+ }
1288
+ }
1289
+ /**
1290
+ * Get the scroll bar's opacity
1291
+ * @returns {number}
1292
+ */
1293
+ getScrollBarOpacity() {
1294
+ assert(this._scrollBarEnabled, 'Scroll bar should be enabled!');
1295
+ if (this._verticalScrollBar) {
1296
+ return this._verticalScrollBar.opacity;
1297
+ }
1298
+ if (this._horizontalScrollBar) {
1299
+ return this._horizontalScrollBar.opacity;
1300
+ }
1301
+ return -1;
1302
+ }
1303
+ /**
1304
+ * Set scroll bar auto hide state
1305
+ * @param {boolean} autoHideEnabled scroll bar auto hide state
1306
+ */
1307
+ setScrollBarAutoHideEnabled(autoHideEnabled) {
1308
+ assert(this._scrollBarEnabled, 'Scroll bar should be enabled!');
1309
+ if (this._verticalScrollBar) {
1310
+ this._verticalScrollBar.autoHideEnabled = autoHideEnabled;
1311
+ }
1312
+ if (this._horizontalScrollBar) {
1313
+ this._horizontalScrollBar.autoHideEnabled = autoHideEnabled;
1314
+ }
1315
+ }
1316
+ /**
1317
+ * Query scroll bar auto hide state
1318
+ * @returns {boolean}
1319
+ */
1320
+ isScrollBarAutoHideEnabled() {
1321
+ assert(this._scrollBarEnabled, 'Scroll bar should be enabled!');
1322
+ if (this._verticalScrollBar) {
1323
+ return this._verticalScrollBar.autoHideEnabled;
1324
+ }
1325
+ if (this._horizontalScrollBar) {
1326
+ return this._horizontalScrollBar.autoHideEnabled;
1327
+ }
1328
+ return false;
1329
+ }
1330
+ /**
1331
+ * Set scroll bar auto hide time
1332
+ * @param {number} autoHideTime scroll bar auto hide state
1333
+ */
1334
+ setScrollBarAutoHideTime(autoHideTime) {
1335
+ assert(this._scrollBarEnabled, 'Scroll bar should be enabled!');
1336
+ if (this._verticalScrollBar) {
1337
+ this._verticalScrollBar.autoHideTime = autoHideTime;
1338
+ }
1339
+ if (this._horizontalScrollBar) {
1340
+ this._horizontalScrollBar.autoHideTime = autoHideTime;
1341
+ }
1342
+ }
1343
+ /**
1344
+ * Get the scroll bar's auto hide time
1345
+ * @returns {number}
1346
+ */
1347
+ getScrollBarAutoHideTime() {
1348
+ assert(this._scrollBarEnabled, 'Scroll bar should be enabled!');
1349
+ if (this._verticalScrollBar) {
1350
+ return this._verticalScrollBar.autoHideTime;
1351
+ }
1352
+ if (this._horizontalScrollBar) {
1353
+ return this._horizontalScrollBar.autoHideTime;
1354
+ }
1355
+ return 0;
1356
+ }
1357
+ /**
1358
+ * Gets inner container of ScrollView. Inner container is the container of ScrollView's children.
1359
+ * @returns {Layout}
1360
+ */
1361
+ getInnerContainer() {
1362
+ return this._innerContainer;
1363
+ }
1364
+ /**
1365
+ * Sets LayoutType of ScrollView.
1366
+ * @param {Layout.ABSOLUTE|Layout.LINEAR_VERTICAL|Layout.LINEAR_HORIZONTAL|Layout.RELATIVE} type
1367
+ */
1368
+ setLayoutType(type) {
1369
+ this._innerContainer.setLayoutType(type);
1370
+ }
1371
+ /**
1372
+ * Returns the layout type of ScrollView.
1373
+ * @returns {Layout.ABSOLUTE|Layout.LINEAR_VERTICAL|Layout.LINEAR_HORIZONTAL|Layout.RELATIVE}
1374
+ */
1375
+ getLayoutType() {
1376
+ return this._innerContainer.getLayoutType();
1377
+ }
1378
+ _doLayout() {
1379
+ if (!this._doLayoutDirty)
1380
+ return;
1381
+ this._doLayoutDirty = false;
1382
+ }
1383
+ /**
1384
+ * Returns the "class name" of ScrollView.
1385
+ * @returns {string}
1386
+ */
1387
+ getDescription() {
1388
+ return 'ScrollView';
1389
+ }
1390
+ _createCloneInstance() {
1391
+ return new ScrollView();
1392
+ }
1393
+ _copyClonedWidgetChildren(model) {
1394
+ Layout.prototype._copyClonedWidgetChildren.call(this, model);
1395
+ }
1396
+ _copySpecialProperties(scrollView) {
1397
+ if (scrollView instanceof ScrollView) {
1398
+ Layout.prototype._copySpecialProperties.call(this, scrollView);
1399
+ this.setInnerContainerSize(scrollView.getInnerContainerSize());
1400
+ this.setInnerContainerPosition(scrollView.getInnerContainerPosition());
1401
+ this.setDirection(scrollView._direction);
1402
+ this._topBoundary = scrollView._topBoundary;
1403
+ this._bottomBoundary = scrollView._bottomBoundary;
1404
+ this._leftBoundary = scrollView._leftBoundary;
1405
+ this._rightBoundary = scrollView._rightBoundary;
1406
+ this._bePressed = scrollView._bePressed;
1407
+ this._childFocusCancelOffset = scrollView._childFocusCancelOffset;
1408
+ this._touchMoveDisplacements = scrollView._touchMoveDisplacements;
1409
+ this._touchMoveTimeDeltas = scrollView._touchMoveTimeDeltas;
1410
+ this._touchMovePreviousTimestamp = scrollView._touchMovePreviousTimestamp;
1411
+ this._autoScrolling = scrollView._autoScrolling;
1412
+ this._autoScrollAttenuate = scrollView._autoScrollAttenuate;
1413
+ this._autoScrollStartPosition = scrollView._autoScrollStartPosition;
1414
+ this._autoScrollTargetDelta = scrollView._autoScrollTargetDelta;
1415
+ this._autoScrollTotalTime = scrollView._autoScrollTotalTime;
1416
+ this._autoScrollAccumulatedTime = scrollView._autoScrollAccumulatedTime;
1417
+ this._autoScrollCurrentlyOutOfBoundary = scrollView._autoScrollCurrentlyOutOfBoundary;
1418
+ this._autoScrollBraking = scrollView._autoScrollBraking;
1419
+ this._autoScrollBrakingStartPosition = scrollView._autoScrollBrakingStartPosition;
1420
+ this.setBounceEnabled(scrollView.bounceEnabled);
1421
+ this.setInertiaScrollEnabled(scrollView.inertiaScrollEnabled);
1422
+ this._scrollViewEventListener = scrollView._scrollViewEventListener;
1423
+ this._scrollViewEventSelector = scrollView._scrollViewEventSelector;
1424
+ this._ccEventCallback = scrollView._ccEventCallback;
1425
+ this.setScrollBarEnabled(scrollView.isScrollBarEnabled());
1426
+ if (this.isScrollBarEnabled()) {
1427
+ if (this._direction !== ScrollView.DIR_HORIZONTAL) {
1428
+ this.setScrollBarPositionFromCornerForVertical(scrollView.getScrollBarPositionFromCornerForVertical());
1429
+ }
1430
+ if (this._direction !== ScrollView.DIR_VERTICAL) {
1431
+ this.setScrollBarPositionFromCornerForHorizontal(scrollView.getScrollBarPositionFromCornerForHorizontal());
1432
+ }
1433
+ this.setScrollBarWidth(scrollView.getScrollBarWidth());
1434
+ this.setScrollBarColor(scrollView.getScrollBarColor());
1435
+ this.setScrollBarAutoHideEnabled(scrollView.isScrollBarAutoHideEnabled());
1436
+ this.setScrollBarAutoHideTime(scrollView.getScrollBarAutoHideTime());
1437
+ }
1438
+ }
1439
+ }
1440
+ _initScrollBar() {
1441
+ if (this._direction !== ScrollView.DIR_HORIZONTAL && !this._verticalScrollBar) {
1442
+ this._verticalScrollBar = new ScrollViewBar(this, ScrollView.DIR_VERTICAL);
1443
+ this.addProtectedChild(this._verticalScrollBar, 2);
1444
+ }
1445
+ if (this._direction !== ScrollView.DIR_VERTICAL && !this._horizontalScrollBar) {
1446
+ this._horizontalScrollBar = new ScrollViewBar(this, ScrollView.DIR_HORIZONTAL);
1447
+ this.addProtectedChild(this._horizontalScrollBar, 2);
1448
+ }
1449
+ }
1450
+ _removeScrollBar() {
1451
+ if (this._verticalScrollBar) {
1452
+ this.removeProtectedChild(this._verticalScrollBar);
1453
+ this._verticalScrollBar = null;
1454
+ }
1455
+ if (this._horizontalScrollBar) {
1456
+ this.removeProtectedChild(this._horizontalScrollBar);
1457
+ this._horizontalScrollBar = null;
1458
+ }
1459
+ }
1460
+ /**
1461
+ * Returns a node by tag
1462
+ * @param {Number} tag
1463
+ * @returns {Node}
1464
+ * @deprecated since v3.0, please use getChildByTag instead.
1465
+ */
1466
+ getNodeByTag(tag) {
1467
+ return this._innerContainer.getNodeByTag(tag);
1468
+ }
1469
+ /**
1470
+ * Returns all nodes of inner container
1471
+ * @returns {Array}
1472
+ * @deprecated since v3.0, please use getChildren instead.
1473
+ */
1474
+ getNodes() {
1475
+ return this._innerContainer.getNodes();
1476
+ }
1477
+ /**
1478
+ * Removes a node from ScrollView.
1479
+ * @param {Node} node
1480
+ * @deprecated since v3.0, please use removeChild instead.
1481
+ */
1482
+ removeNode(node) {
1483
+ this._innerContainer.removeNode(node);
1484
+ }
1485
+ /**
1486
+ * Removes a node by tag
1487
+ * @param {Number} tag
1488
+ * @deprecated since v3.0, please use removeChildByTag instead.
1489
+ */
1490
+ removeNodeByTag(tag) {
1491
+ this._innerContainer.removeNodeByTag(tag);
1492
+ }
1493
+ /**
1494
+ * Remove all node from ScrollView.
1495
+ * @deprecated since v3.0, please use removeAllChildren instead.
1496
+ */
1497
+ removeAllNodes() {
1498
+ this._innerContainer.removeAllNodes();
1499
+ }
1500
+ /**
1501
+ * Add node for scrollView
1502
+ * @param {Node} node
1503
+ * @param {Number} zOrder
1504
+ * @param {Number} tag
1505
+ * @deprecated since v3.0, please use addChild instead.
1506
+ */
1507
+ addNode(node, zOrder, tag) {
1508
+ this._innerContainer.addNode(node, zOrder, tag);
1509
+ }
1510
+ }
1511
+ // Extended properties with getter/setter
1512
+ Object.defineProperty(ScrollView.prototype, 'innerWidth', {
1513
+ get: function () {
1514
+ return this._getInnerWidth();
1515
+ },
1516
+ set: function (val) {
1517
+ this._setInnerWidth(val);
1518
+ },
1519
+ });
1520
+ Object.defineProperty(ScrollView.prototype, 'innerHeight', {
1521
+ get: function () {
1522
+ return this._getInnerHeight();
1523
+ },
1524
+ set: function (val) {
1525
+ this._setInnerHeight(val);
1526
+ },
1527
+ });
1528
+ Object.defineProperty(ScrollView.prototype, 'direction', {
1529
+ get: function () {
1530
+ return this.getDirection();
1531
+ },
1532
+ set: function (val) {
1533
+ this.setDirection(val);
1534
+ },
1535
+ });
1536
+ Object.defineProperty(ScrollView.prototype, 'touchTotalTimeThreshold', {
1537
+ get: function () {
1538
+ return this.getTouchTotalTimeThreshold();
1539
+ },
1540
+ set: function (val) {
1541
+ this.setTouchTotalTimeThreshold(val);
1542
+ },
1543
+ });
1544
+ //# sourceMappingURL=UIScrollView.js.map