@pie-element/hotspot 11.1.1 → 11.1.2-next.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 (354) hide show
  1. package/configure.js +2 -0
  2. package/controller.js +1 -0
  3. package/dist/author/DeleteWidget.d.ts +38 -0
  4. package/dist/author/DeleteWidget.js +46 -0
  5. package/dist/author/button.d.ts +31 -0
  6. package/dist/author/button.js +27 -0
  7. package/dist/author/buttons/circle.d.ts +18 -0
  8. package/dist/author/buttons/circle.js +25 -0
  9. package/dist/author/buttons/polygon.d.ts +18 -0
  10. package/dist/author/buttons/polygon.js +36 -0
  11. package/dist/author/buttons/rectangle.d.ts +18 -0
  12. package/dist/author/buttons/rectangle.js +36 -0
  13. package/dist/author/defaults.d.ts +157 -0
  14. package/dist/author/defaults.js +119 -0
  15. package/dist/author/hotspot-circle.d.ts +21 -0
  16. package/dist/author/hotspot-circle.js +124 -0
  17. package/dist/author/hotspot-container.d.ts +29 -0
  18. package/dist/author/hotspot-container.js +210 -0
  19. package/dist/author/hotspot-drawable.d.ts +31 -0
  20. package/dist/author/hotspot-drawable.js +312 -0
  21. package/dist/author/hotspot-palette.d.ts +14 -0
  22. package/dist/author/hotspot-palette.js +72 -0
  23. package/dist/author/hotspot-polygon.d.ts +38 -0
  24. package/dist/author/hotspot-polygon.js +200 -0
  25. package/dist/author/hotspot-rectangle.d.ts +20 -0
  26. package/dist/author/hotspot-rectangle.js +119 -0
  27. package/dist/author/icons.d.ts +9 -0
  28. package/dist/author/icons.js +4 -0
  29. package/dist/author/image-konva.d.ts +19 -0
  30. package/dist/author/image-konva.js +49 -0
  31. package/dist/author/index.d.ts +52 -0
  32. package/dist/author/index.js +143 -0
  33. package/dist/author/root.d.ts +15 -0
  34. package/dist/author/root.js +215 -0
  35. package/dist/author/shapes/circle.d.ts +18 -0
  36. package/dist/author/shapes/circle.js +47 -0
  37. package/dist/author/shapes/index.d.ts +12 -0
  38. package/dist/author/shapes/polygon.d.ts +19 -0
  39. package/dist/author/shapes/polygon.js +51 -0
  40. package/dist/author/shapes/rectagle.d.ts +18 -0
  41. package/dist/author/shapes/rectagle.js +57 -0
  42. package/dist/author/shapes/utils.d.ts +19 -0
  43. package/dist/author/shapes/utils.js +16 -0
  44. package/dist/author/upload-control.d.ts +29 -0
  45. package/dist/author/upload-control.js +28 -0
  46. package/dist/author/utils.d.ts +24 -0
  47. package/dist/author/utils.js +83 -0
  48. package/dist/browser/ReactKonva-Z9-1H-UZ.js +19329 -0
  49. package/dist/browser/ReactKonva-Z9-1H-UZ.js.map +1 -0
  50. package/dist/browser/author/index.js +42297 -0
  51. package/dist/browser/author/index.js.map +1 -0
  52. package/dist/browser/browser-CfnAFove.js +210 -0
  53. package/dist/browser/browser-CfnAFove.js.map +1 -0
  54. package/dist/browser/controller/index.js +198 -0
  55. package/dist/browser/controller/index.js.map +1 -0
  56. package/dist/browser/delivery/index.js +2460 -0
  57. package/dist/browser/delivery/index.js.map +1 -0
  58. package/dist/browser/hotspot.css +2 -0
  59. package/dist/browser/isEqual-D3CTSc6W.js +601 -0
  60. package/dist/browser/isEqual-D3CTSc6W.js.map +1 -0
  61. package/dist/controller/defaults.d.ts +35 -0
  62. package/dist/controller/defaults.js +29 -0
  63. package/dist/controller/index.d.ts +22 -0
  64. package/dist/controller/index.js +154 -0
  65. package/dist/controller/utils.d.ts +10 -0
  66. package/dist/controller/utils.js +13 -0
  67. package/dist/delivery/hotspot/circle.d.ts +19 -0
  68. package/dist/delivery/hotspot/circle.js +100 -0
  69. package/dist/delivery/hotspot/container.d.ts +16 -0
  70. package/dist/delivery/hotspot/container.js +150 -0
  71. package/dist/delivery/hotspot/icons.d.ts +10 -0
  72. package/dist/delivery/hotspot/icons.js +4 -0
  73. package/dist/delivery/hotspot/image-konva-tooltip.d.ts +19 -0
  74. package/dist/delivery/hotspot/image-konva-tooltip.js +66 -0
  75. package/dist/delivery/hotspot/index.d.ts +17 -0
  76. package/dist/delivery/hotspot/index.js +114 -0
  77. package/dist/delivery/hotspot/polygon.d.ts +21 -0
  78. package/dist/delivery/hotspot/polygon.js +108 -0
  79. package/dist/delivery/hotspot/rectangle.d.ts +19 -0
  80. package/dist/delivery/hotspot/rectangle.js +104 -0
  81. package/dist/delivery/index.d.ts +20 -0
  82. package/dist/delivery/index.js +107 -0
  83. package/dist/delivery/session-updater.d.ts +10 -0
  84. package/dist/delivery/session-updater.js +14 -0
  85. package/dist/index.d.ts +1 -0
  86. package/dist/index.iife.d.ts +8 -0
  87. package/dist/index.iife.js +169 -0
  88. package/dist/index.js +2 -0
  89. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +6 -0
  90. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +16 -0
  91. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +16 -0
  92. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +6 -0
  93. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +16 -0
  94. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +6 -0
  95. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +6 -0
  96. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js +11 -0
  97. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +14 -0
  98. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +5 -0
  99. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +5 -0
  100. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +6 -0
  101. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +7 -0
  102. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +10 -0
  103. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
  104. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +7 -0
  105. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js +7 -0
  106. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +10 -0
  107. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +8 -0
  108. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +8 -0
  109. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +8 -0
  110. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +12 -0
  111. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +57 -0
  112. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +14 -0
  113. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
  114. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +10 -0
  115. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +9 -0
  116. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js +8 -0
  117. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js +30 -0
  118. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +9 -0
  119. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +11 -0
  120. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +9 -0
  121. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
  122. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +12 -0
  123. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +13 -0
  124. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +7 -0
  125. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +8 -0
  126. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js +6 -0
  127. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
  128. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +10 -0
  129. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +8 -0
  130. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +8 -0
  131. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +8 -0
  132. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +8 -0
  133. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +8 -0
  134. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +14 -0
  135. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +8 -0
  136. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +8 -0
  137. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +5 -0
  138. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +10 -0
  139. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js +35 -0
  140. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js +35 -0
  141. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js +32 -0
  142. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +4 -0
  143. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +9 -0
  144. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +9 -0
  145. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +8 -0
  146. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +9 -0
  147. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +5 -0
  148. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +14 -0
  149. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +10 -0
  150. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +11 -0
  151. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +23 -0
  152. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +6 -0
  153. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +7 -0
  154. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +7 -0
  155. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +13 -0
  156. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +9 -0
  157. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +9 -0
  158. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +8 -0
  159. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +33 -0
  160. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +9 -0
  161. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +8 -0
  162. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +7 -0
  163. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +11 -0
  164. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +8 -0
  165. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +6 -0
  166. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +9 -0
  167. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +8 -0
  168. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +7 -0
  169. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +8 -0
  170. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +13 -0
  171. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +8 -0
  172. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +7 -0
  173. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +7 -0
  174. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +8 -0
  175. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js +9 -0
  176. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +5 -0
  177. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +5 -0
  178. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +8 -0
  179. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +9 -0
  180. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +7 -0
  181. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +8 -0
  182. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +5 -0
  183. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js +7 -0
  184. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js +6 -0
  185. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js +9 -0
  186. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +7 -0
  187. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +7 -0
  188. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +6 -0
  189. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +6 -0
  190. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +16 -0
  191. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +15 -0
  192. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +8 -0
  193. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +6 -0
  194. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +10 -0
  195. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +4 -0
  196. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +8 -0
  197. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +6 -0
  198. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +21 -0
  199. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEqual.js +7 -0
  200. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +11 -0
  201. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +7 -0
  202. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +7 -0
  203. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +7 -0
  204. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +6 -0
  205. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +7 -0
  206. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +7 -0
  207. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +9 -0
  208. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +9 -0
  209. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +6 -0
  210. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +6 -0
  211. package/package.json +78 -16
  212. package/CHANGELOG.json +0 -997
  213. package/CHANGELOG.md +0 -2214
  214. package/LICENSE.md +0 -5
  215. package/README.md +0 -1
  216. package/configure/CHANGELOG.json +0 -682
  217. package/configure/CHANGELOG.md +0 -1951
  218. package/configure/lib/DeleteWidget.js +0 -64
  219. package/configure/lib/DeleteWidget.js.map +0 -1
  220. package/configure/lib/button.js +0 -42
  221. package/configure/lib/button.js.map +0 -1
  222. package/configure/lib/buttons/circle.js +0 -33
  223. package/configure/lib/buttons/circle.js.map +0 -1
  224. package/configure/lib/buttons/polygon.js +0 -39
  225. package/configure/lib/buttons/polygon.js.map +0 -1
  226. package/configure/lib/buttons/rectangle.js +0 -39
  227. package/configure/lib/buttons/rectangle.js.map +0 -1
  228. package/configure/lib/defaults.js +0 -155
  229. package/configure/lib/defaults.js.map +0 -1
  230. package/configure/lib/hotspot-circle.js +0 -192
  231. package/configure/lib/hotspot-circle.js.map +0 -1
  232. package/configure/lib/hotspot-container.js +0 -320
  233. package/configure/lib/hotspot-container.js.map +0 -1
  234. package/configure/lib/hotspot-drawable.js +0 -519
  235. package/configure/lib/hotspot-drawable.js.map +0 -1
  236. package/configure/lib/hotspot-palette.js +0 -107
  237. package/configure/lib/hotspot-palette.js.map +0 -1
  238. package/configure/lib/hotspot-polygon.js +0 -293
  239. package/configure/lib/hotspot-polygon.js.map +0 -1
  240. package/configure/lib/hotspot-rectangle.js +0 -190
  241. package/configure/lib/hotspot-rectangle.js.map +0 -1
  242. package/configure/lib/icons.js +0 -7
  243. package/configure/lib/icons.js.map +0 -1
  244. package/configure/lib/image-konva.js +0 -66
  245. package/configure/lib/image-konva.js.map +0 -1
  246. package/configure/lib/index.js +0 -194
  247. package/configure/lib/index.js.map +0 -1
  248. package/configure/lib/root.js +0 -330
  249. package/configure/lib/root.js.map +0 -1
  250. package/configure/lib/shapes/circle.js +0 -84
  251. package/configure/lib/shapes/circle.js.map +0 -1
  252. package/configure/lib/shapes/index.js +0 -50
  253. package/configure/lib/shapes/index.js.map +0 -1
  254. package/configure/lib/shapes/polygon.js +0 -82
  255. package/configure/lib/shapes/polygon.js.map +0 -1
  256. package/configure/lib/shapes/rectagle.js +0 -84
  257. package/configure/lib/shapes/rectagle.js.map +0 -1
  258. package/configure/lib/shapes/utils.js +0 -21
  259. package/configure/lib/shapes/utils.js.map +0 -1
  260. package/configure/lib/upload-control.js +0 -41
  261. package/configure/lib/upload-control.js.map +0 -1
  262. package/configure/lib/utils.js +0 -185
  263. package/configure/lib/utils.js.map +0 -1
  264. package/configure/package.json +0 -26
  265. package/configure/src/DeleteWidget.jsx +0 -51
  266. package/configure/src/__tests__/DeleteWidget.test.jsx +0 -366
  267. package/configure/src/__tests__/button.test.jsx +0 -198
  268. package/configure/src/__tests__/hotspot-circle.test.jsx +0 -259
  269. package/configure/src/__tests__/hotspot-container.test.js +0 -366
  270. package/configure/src/__tests__/hotspot-drawable.test.js +0 -271
  271. package/configure/src/__tests__/hotspot-palette.test.jsx +0 -71
  272. package/configure/src/__tests__/image-konva.test.jsx +0 -226
  273. package/configure/src/__tests__/index.test.js +0 -329
  274. package/configure/src/__tests__/root.test.js +0 -400
  275. package/configure/src/__tests__/utils.test.js +0 -241
  276. package/configure/src/button.jsx +0 -35
  277. package/configure/src/buttons/circle.jsx +0 -18
  278. package/configure/src/buttons/polygon.jsx +0 -29
  279. package/configure/src/buttons/rectangle.jsx +0 -29
  280. package/configure/src/defaults.js +0 -109
  281. package/configure/src/hotspot-circle.jsx +0 -183
  282. package/configure/src/hotspot-container.jsx +0 -330
  283. package/configure/src/hotspot-drawable.jsx +0 -527
  284. package/configure/src/hotspot-palette.jsx +0 -90
  285. package/configure/src/hotspot-polygon.jsx +0 -294
  286. package/configure/src/hotspot-rectangle.jsx +0 -169
  287. package/configure/src/icons.js +0 -5
  288. package/configure/src/image-konva.jsx +0 -63
  289. package/configure/src/index.js +0 -208
  290. package/configure/src/root.jsx +0 -346
  291. package/configure/src/shapes/circle.js +0 -81
  292. package/configure/src/shapes/index.js +0 -4
  293. package/configure/src/shapes/polygon.js +0 -81
  294. package/configure/src/shapes/rectagle.js +0 -82
  295. package/configure/src/shapes/utils.js +0 -16
  296. package/configure/src/upload-control.jsx +0 -33
  297. package/configure/src/utils.js +0 -210
  298. package/controller/CHANGELOG.json +0 -362
  299. package/controller/CHANGELOG.md +0 -1304
  300. package/controller/lib/defaults.js +0 -33
  301. package/controller/lib/defaults.js.map +0 -1
  302. package/controller/lib/index.js +0 -341
  303. package/controller/lib/index.js.map +0 -1
  304. package/controller/lib/utils.js +0 -32
  305. package/controller/lib/utils.js.map +0 -1
  306. package/controller/package.json +0 -18
  307. package/controller/src/__tests__/index.test.js +0 -419
  308. package/controller/src/__tests__/utils.test.js +0 -5
  309. package/controller/src/defaults.js +0 -19
  310. package/controller/src/index.js +0 -328
  311. package/controller/src/utils.js +0 -29
  312. package/docs/config-schema.json +0 -2023
  313. package/docs/config-schema.json.md +0 -1495
  314. package/docs/demo/config.js +0 -8
  315. package/docs/demo/generate.js +0 -118
  316. package/docs/demo/index.html +0 -1
  317. package/docs/demo/session.js +0 -11
  318. package/docs/pie-schema.json +0 -1204
  319. package/docs/pie-schema.json.md +0 -851
  320. package/lib/hotspot/circle.js +0 -156
  321. package/lib/hotspot/circle.js.map +0 -1
  322. package/lib/hotspot/container.js +0 -206
  323. package/lib/hotspot/container.js.map +0 -1
  324. package/lib/hotspot/icons.js +0 -8
  325. package/lib/hotspot/icons.js.map +0 -1
  326. package/lib/hotspot/image-konva-tooltip.js +0 -86
  327. package/lib/hotspot/image-konva-tooltip.js.map +0 -1
  328. package/lib/hotspot/index.js +0 -163
  329. package/lib/hotspot/index.js.map +0 -1
  330. package/lib/hotspot/polygon.js +0 -203
  331. package/lib/hotspot/polygon.js.map +0 -1
  332. package/lib/hotspot/rectangle.js +0 -175
  333. package/lib/hotspot/rectangle.js.map +0 -1
  334. package/lib/index.js +0 -213
  335. package/lib/index.js.map +0 -1
  336. package/lib/session-updater.js +0 -42
  337. package/lib/session-updater.js.map +0 -1
  338. package/src/__tests__/container.test.jsx +0 -58
  339. package/src/__tests__/index.test.js +0 -123
  340. package/src/__tests__/session-updater.test.jsx +0 -69
  341. package/src/hotspot/__tests__/circle.test.jsx +0 -464
  342. package/src/hotspot/__tests__/container.test.jsx +0 -546
  343. package/src/hotspot/__tests__/image-konva-tooltip.test.jsx +0 -510
  344. package/src/hotspot/__tests__/polygon.test.jsx +0 -502
  345. package/src/hotspot/__tests__/rectangle.test.jsx +0 -418
  346. package/src/hotspot/circle.jsx +0 -152
  347. package/src/hotspot/container.jsx +0 -217
  348. package/src/hotspot/icons.js +0 -7
  349. package/src/hotspot/image-konva-tooltip.jsx +0 -76
  350. package/src/hotspot/index.jsx +0 -165
  351. package/src/hotspot/polygon.jsx +0 -195
  352. package/src/hotspot/rectangle.jsx +0 -171
  353. package/src/index.js +0 -226
  354. package/src/session-updater.js +0 -29
@@ -1,330 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.Root = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _react = _interopRequireDefault(require("react"));
10
- var _configUi = require("@pie-lib/config-ui");
11
- var _propTypes = _interopRequireDefault(require("prop-types"));
12
- var _editableHtmlTipTap = _interopRequireDefault(require("@pie-lib/editable-html-tip-tap"));
13
- var _styles = require("@mui/material/styles");
14
- var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
15
- var _Info = _interopRequireDefault(require("@mui/icons-material/Info"));
16
- var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
17
- var _hotspotPalette = _interopRequireDefault(require("./hotspot-palette"));
18
- var _hotspotContainer = _interopRequireDefault(require("./hotspot-container"));
19
- var _utils = require("./utils");
20
- const {
21
- Panel,
22
- toggle,
23
- dropdown
24
- } = _configUi.settings;
25
- const DimensionsContainer = (0, _styles.styled)('div')(({
26
- theme
27
- }) => ({
28
- display: 'flex',
29
- marginBottom: theme.spacing(1.5)
30
- }));
31
- const FieldContainer = (0, _styles.styled)('div')({
32
- flex: 1,
33
- width: '90%'
34
- });
35
- const PromptContainer = (0, _styles.styled)(_configUi.InputContainer)(({
36
- theme
37
- }) => ({
38
- paddingTop: theme.spacing(1),
39
- marginTop: theme.spacing(2),
40
- marginBottom: theme.spacing(2),
41
- width: '100%'
42
- }));
43
- const SubHeading = (0, _styles.styled)(_Typography.default)(({
44
- theme
45
- }) => ({
46
- marginRight: theme.spacing(1)
47
- }));
48
- const FlexContainer = (0, _styles.styled)('div')({
49
- display: 'flex',
50
- alignItems: 'center'
51
- });
52
- const StyledTooltip = (0, _styles.styled)(_Tooltip.default)(({
53
- theme
54
- }) => ({
55
- '& .MuiTooltip-tooltip': {
56
- fontSize: theme.typography.fontSize - 2,
57
- whiteSpace: 'pre',
58
- maxWidth: '500px'
59
- }
60
- }));
61
- const ErrorText = (0, _styles.styled)('div')(({
62
- theme
63
- }) => ({
64
- fontSize: theme.typography.fontSize - 2,
65
- color: theme.palette.error.main,
66
- paddingTop: theme.spacing(1)
67
- }));
68
- class Root extends _react.default.Component {
69
- constructor(...args) {
70
- super(...args);
71
- (0, _defineProperty2.default)(this, "handleColorChange", (fieldType, color) => {
72
- const {
73
- onColorChanged
74
- } = this.props;
75
- const cType = `${fieldType}Color`;
76
- onColorChanged(cType, color);
77
- });
78
- (0, _defineProperty2.default)(this, "handleOnUpdateImageDimensions", (value, resizeType) => {
79
- const {
80
- model: {
81
- dimensions,
82
- shapes
83
- },
84
- configuration: {
85
- preserveAspectRatio = {}
86
- },
87
- onUpdateImageDimension,
88
- onUpdateShapes
89
- } = this.props;
90
- const nextImageDimensions = {
91
- ...dimensions,
92
- [resizeType]: value
93
- };
94
-
95
- // if preserveAspectRatio.enabled, updateImageDimensions function makes sure aspect ratio is kept
96
- const updatedDimensions = (0, _utils.updateImageDimensions)(dimensions, nextImageDimensions, preserveAspectRatio.enabled, resizeType);
97
- // transform shapes map into shapes array
98
- const shapesArray = (0, _utils.getAllShapes)(shapes);
99
- // transform all the shapes to fit the re-sized image
100
- const updatedShapes = (0, _utils.getUpdatedShapes)(dimensions, updatedDimensions, shapesArray);
101
- // transform shapes array back into shapes map
102
-
103
- onUpdateShapes((0, _utils.groupShapes)(updatedShapes));
104
- onUpdateImageDimension(updatedDimensions);
105
- });
106
- }
107
- render() {
108
- const {
109
- configuration,
110
- model,
111
- imageSupport,
112
- uploadSoundSupport,
113
- onConfigurationChanged,
114
- onImageUpload,
115
- onModelChangedByConfig,
116
- onPromptChanged,
117
- onRationaleChanged,
118
- onUpdateImageDimension,
119
- onTeacherInstructionsChanged,
120
- onUpdateShapes
121
- } = this.props;
122
- const {
123
- baseInputConfiguration = {},
124
- contentDimensions = {},
125
- maxImageWidth = {},
126
- maxImageHeight = {},
127
- multipleCorrect = {},
128
- partialScoring = {},
129
- preserveAspectRatio = {},
130
- prompt = {},
131
- rationale = {},
132
- settingsPanelDisabled,
133
- spellCheck = {},
134
- teacherInstructions = {},
135
- withRubric = {},
136
- mathMlOptions = {},
137
- language = {},
138
- languageChoices = {}
139
- } = configuration || {};
140
- const {
141
- errors,
142
- extraCSSRules,
143
- promptEnabled,
144
- rationaleEnabled,
145
- spellCheckEnabled,
146
- teacherInstructionsEnabled,
147
- toolbarEditorPosition
148
- } = model || {};
149
- const {
150
- prompt: promptError,
151
- rationale: rationaleError,
152
- shapes: shapesError,
153
- selections: selectionsError,
154
- teacherInstructions: teacherInstructionsError
155
- } = errors || {};
156
- const validationMessage = (0, _utils.generateValidationMessage)(configuration);
157
- const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
158
- const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
159
- const toolbarOpts = {
160
- position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
161
- };
162
- const panelSettings = {
163
- multipleCorrect: multipleCorrect.settings && toggle(multipleCorrect.label),
164
- partialScoring: partialScoring.settings && toggle(partialScoring.label),
165
- promptEnabled: prompt.settings && toggle(prompt.label),
166
- 'language.enabled': language.settings && toggle(language.label, true),
167
- language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options)
168
- };
169
- const panelProperties = {
170
- teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
171
- rationaleEnabled: rationale.settings && toggle(rationale.label),
172
- spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
173
- rubricEnabled: withRubric?.settings && toggle(withRubric?.label)
174
- };
175
- const getPluginProps = (props = {}) => ({
176
- ...baseInputConfiguration,
177
- ...props
178
- });
179
- return /*#__PURE__*/_react.default.createElement(_configUi.layout.ConfigLayout, {
180
- extraCSSRules: extraCSSRules,
181
- dimensions: contentDimensions,
182
- hideSettings: settingsPanelDisabled,
183
- settings: /*#__PURE__*/_react.default.createElement(Panel, {
184
- model: model,
185
- onChangeModel: onModelChangedByConfig,
186
- configuration: configuration,
187
- onChangeConfiguration: onConfigurationChanged,
188
- groups: {
189
- Settings: panelSettings,
190
- Properties: panelProperties
191
- }
192
- })
193
- }, teacherInstructionsEnabled && /*#__PURE__*/_react.default.createElement(PromptContainer, {
194
- label: teacherInstructions.label
195
- }, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
196
- markup: model.teacherInstructions || '',
197
- onChange: onTeacherInstructionsChanged,
198
- imageSupport: imageSupport,
199
- nonEmpty: false,
200
- error: teacherInstructionsError,
201
- toolbarOpts: toolbarOpts,
202
- pluginProps: getPluginProps(teacherInstructions?.inputConfiguration),
203
- spellCheck: spellCheckEnabled,
204
- maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
205
- maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
206
- uploadSoundSupport: uploadSoundSupport,
207
- languageCharactersProps: [{
208
- language: 'spanish'
209
- }, {
210
- language: 'special'
211
- }],
212
- mathMlOptions: mathMlOptions
213
- }), teacherInstructionsError && /*#__PURE__*/_react.default.createElement(ErrorText, null, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react.default.createElement(PromptContainer, {
214
- label: prompt.label
215
- }, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
216
- markup: model.prompt || '',
217
- onChange: onPromptChanged,
218
- imageSupport: imageSupport,
219
- nonEmpty: false,
220
- error: promptError,
221
- toolbarOpts: toolbarOpts,
222
- pluginProps: getPluginProps(prompt?.inputConfiguration),
223
- spellCheck: spellCheckEnabled,
224
- maxImageWidth: defaultImageMaxWidth,
225
- maxImageHeight: defaultImageMaxHeight,
226
- uploadSoundSupport: uploadSoundSupport,
227
- languageCharactersProps: [{
228
- language: 'spanish'
229
- }, {
230
- language: 'special'
231
- }],
232
- mathMlOptions: mathMlOptions
233
- }), promptError && /*#__PURE__*/_react.default.createElement(ErrorText, null, promptError)), /*#__PURE__*/_react.default.createElement(FlexContainer, null, /*#__PURE__*/_react.default.createElement(SubHeading, {
234
- variant: "h6"
235
- }, "Define Hotspot"), /*#__PURE__*/_react.default.createElement(StyledTooltip, {
236
- disableFocusListener: true,
237
- disableTouchListener: true,
238
- placement: 'left',
239
- title: validationMessage
240
- }, /*#__PURE__*/_react.default.createElement(_Info.default, {
241
- fontSize: 'small',
242
- color: 'primary',
243
- style: {
244
- float: 'right'
245
- }
246
- }))), /*#__PURE__*/_react.default.createElement(_hotspotPalette.default, {
247
- hotspotColor: model.hotspotColor,
248
- hotspotList: model.hotspotList,
249
- outlineColor: model.outlineColor,
250
- outlineList: model.outlineList,
251
- onHotspotColorChange: color => this.handleColorChange('hotspot', color),
252
- onOutlineColorChange: color => this.handleColorChange('outline', color)
253
- }), /*#__PURE__*/_react.default.createElement(_hotspotContainer.default, {
254
- dimensions: model.dimensions,
255
- imageUrl: model.imageUrl,
256
- multipleCorrect: model.multipleCorrect,
257
- hasErrors: !!shapesError || !!selectionsError,
258
- hotspotColor: model.hotspotColor,
259
- outlineColor: model.outlineColor,
260
- selectedHotspotColor: model.selectedHotspotColor,
261
- hoverOutlineColor: model.hoverOutlineColor,
262
- onUpdateImageDimension: onUpdateImageDimension,
263
- onUpdateShapes: onUpdateShapes,
264
- onImageUpload: onImageUpload,
265
- shapes: model.shapes,
266
- strokeWidth: model.strokeWidth,
267
- preserveAspectRatioEnabled: preserveAspectRatio.enabled,
268
- insertImage: imageSupport && imageSupport.add
269
- }), shapesError && /*#__PURE__*/_react.default.createElement(ErrorText, null, shapesError), selectionsError && /*#__PURE__*/_react.default.createElement(ErrorText, null, selectionsError), model.imageUrl && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
270
- variant: "h6"
271
- }, "Image Dimensions"), /*#__PURE__*/_react.default.createElement(DimensionsContainer, null, /*#__PURE__*/_react.default.createElement(FieldContainer, null, /*#__PURE__*/_react.default.createElement(_configUi.NumberTextField, {
272
- key: "hotspot-manual-width",
273
- label: "Width",
274
- value: model.dimensions.width,
275
- min: 0,
276
- onChange: (e, value) => this.handleOnUpdateImageDimensions(value, 'width'),
277
- showErrorWhenOutsideRange: true
278
- })), /*#__PURE__*/_react.default.createElement(FieldContainer, null, /*#__PURE__*/_react.default.createElement(_configUi.NumberTextField, {
279
- key: "hotspot-manual-height",
280
- label: "Height",
281
- value: model.dimensions.height,
282
- min: 0,
283
- onChange: (e, value) => this.handleOnUpdateImageDimensions(value, 'height'),
284
- showErrorWhenOutsideRange: true
285
- })))), rationaleEnabled && /*#__PURE__*/_react.default.createElement(PromptContainer, {
286
- label: rationale.label
287
- }, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
288
- markup: model.rationale || '',
289
- onChange: onRationaleChanged,
290
- imageSupport: imageSupport,
291
- error: rationaleError,
292
- toolbarOpts: toolbarOpts,
293
- pluginProps: getPluginProps(rationale?.inputConfiguration),
294
- spellCheck: spellCheckEnabled,
295
- maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
296
- maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
297
- uploadSoundSupport: uploadSoundSupport,
298
- languageCharactersProps: [{
299
- language: 'spanish'
300
- }, {
301
- language: 'special'
302
- }],
303
- mathMlOptions: mathMlOptions
304
- }), rationaleError && /*#__PURE__*/_react.default.createElement(ErrorText, null, rationaleError)));
305
- }
306
- }
307
- exports.Root = Root;
308
- Root.propTypes = {
309
- configuration: _propTypes.default.object,
310
- model: _propTypes.default.object.isRequired,
311
- imageSupport: _propTypes.default.shape({
312
- add: _propTypes.default.func,
313
- delete: _propTypes.default.func
314
- }),
315
- uploadSoundSupport: _propTypes.default.shape({
316
- add: _propTypes.default.func,
317
- delete: _propTypes.default.func
318
- }),
319
- onImageUpload: _propTypes.default.func.isRequired,
320
- onColorChanged: _propTypes.default.func.isRequired,
321
- onPromptChanged: _propTypes.default.func.isRequired,
322
- onUpdateImageDimension: _propTypes.default.func.isRequired,
323
- onUpdateShapes: _propTypes.default.func.isRequired,
324
- onModelChangedByConfig: _propTypes.default.func.isRequired,
325
- onRationaleChanged: _propTypes.default.func.isRequired,
326
- onConfigurationChanged: _propTypes.default.func.isRequired,
327
- onTeacherInstructionsChanged: _propTypes.default.func.isRequired
328
- };
329
- var _default = exports.default = Root;
330
- //# sourceMappingURL=root.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"root.js","names":["_react","_interopRequireDefault","require","_configUi","_propTypes","_editableHtmlTipTap","_styles","_Typography","_Info","_Tooltip","_hotspotPalette","_hotspotContainer","_utils","Panel","toggle","dropdown","settings","DimensionsContainer","styled","theme","display","marginBottom","spacing","FieldContainer","flex","width","PromptContainer","InputContainer","paddingTop","marginTop","SubHeading","Typography","marginRight","FlexContainer","alignItems","StyledTooltip","Tooltip","fontSize","typography","whiteSpace","maxWidth","ErrorText","color","palette","error","main","Root","React","Component","constructor","args","_defineProperty2","default","fieldType","onColorChanged","props","cType","value","resizeType","model","dimensions","shapes","configuration","preserveAspectRatio","onUpdateImageDimension","onUpdateShapes","nextImageDimensions","updatedDimensions","updateImageDimensions","enabled","shapesArray","getAllShapes","updatedShapes","getUpdatedShapes","groupShapes","render","imageSupport","uploadSoundSupport","onConfigurationChanged","onImageUpload","onModelChangedByConfig","onPromptChanged","onRationaleChanged","onTeacherInstructionsChanged","baseInputConfiguration","contentDimensions","maxImageWidth","maxImageHeight","multipleCorrect","partialScoring","prompt","rationale","settingsPanelDisabled","spellCheck","teacherInstructions","withRubric","mathMlOptions","language","languageChoices","errors","extraCSSRules","promptEnabled","rationaleEnabled","spellCheckEnabled","teacherInstructionsEnabled","toolbarEditorPosition","promptError","rationaleError","shapesError","selections","selectionsError","teacherInstructionsError","validationMessage","generateValidationMessage","defaultImageMaxWidth","defaultImageMaxHeight","toolbarOpts","position","panelSettings","label","options","panelProperties","rubricEnabled","getPluginProps","createElement","layout","ConfigLayout","hideSettings","onChangeModel","onChangeConfiguration","groups","Settings","Properties","markup","onChange","nonEmpty","pluginProps","inputConfiguration","languageCharactersProps","variant","disableFocusListener","disableTouchListener","placement","title","style","float","hotspotColor","hotspotList","outlineColor","outlineList","onHotspotColorChange","handleColorChange","onOutlineColorChange","imageUrl","hasErrors","selectedHotspotColor","hoverOutlineColor","strokeWidth","preserveAspectRatioEnabled","insertImage","add","Fragment","NumberTextField","key","min","e","handleOnUpdateImageDimensions","showErrorWhenOutsideRange","height","exports","propTypes","PropTypes","object","isRequired","shape","func","delete","_default"],"sources":["../src/root.jsx"],"sourcesContent":["import React from 'react';\nimport { settings, layout, InputContainer, NumberTextField } from '@pie-lib/config-ui';\nimport PropTypes from 'prop-types';\nimport EditableHtml from '@pie-lib/editable-html-tip-tap';\nimport { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\nimport Info from '@mui/icons-material/Info';\nimport Tooltip from '@mui/material/Tooltip';\nimport HotspotPalette from './hotspot-palette';\nimport HotspotContainer from './hotspot-container';\nimport { updateImageDimensions, generateValidationMessage, getUpdatedShapes, getAllShapes, groupShapes } from './utils';\n\nconst { Panel, toggle, dropdown } = settings;\n\nconst DimensionsContainer = styled('div')(({ theme }) => ({\n display: 'flex',\n marginBottom: theme.spacing(1.5),\n}));\n\nconst FieldContainer = styled('div')({\n flex: 1,\n width: '90%',\n});\n\nconst PromptContainer = styled(InputContainer)(({ theme }) => ({\n paddingTop: theme.spacing(1),\n marginTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n width: '100%',\n}));\n\nconst SubHeading = styled(Typography)(({ theme }) => ({\n marginRight: theme.spacing(1),\n}));\n\nconst FlexContainer = styled('div')({\n display: 'flex',\n alignItems: 'center',\n});\n\nconst StyledTooltip = styled(Tooltip)(({ theme }) => ({\n '& .MuiTooltip-tooltip': {\n fontSize: theme.typography.fontSize - 2,\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n}));\n\nconst ErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing(1),\n}));\n\nexport class Root extends React.Component {\n handleColorChange = (fieldType, color) => {\n const { onColorChanged } = this.props;\n const cType = `${fieldType}Color`;\n\n onColorChanged(cType, color);\n };\n\n handleOnUpdateImageDimensions = (value, resizeType) => {\n const {\n model: { dimensions, shapes },\n configuration: { preserveAspectRatio = {} },\n onUpdateImageDimension,\n onUpdateShapes,\n } = this.props;\n\n const nextImageDimensions = { ...dimensions, [resizeType]: value };\n\n // if preserveAspectRatio.enabled, updateImageDimensions function makes sure aspect ratio is kept\n const updatedDimensions = updateImageDimensions(\n dimensions,\n nextImageDimensions,\n preserveAspectRatio.enabled,\n resizeType,\n );\n // transform shapes map into shapes array\n const shapesArray = getAllShapes(shapes);\n // transform all the shapes to fit the re-sized image\n const updatedShapes = getUpdatedShapes(dimensions, updatedDimensions, shapesArray);\n // transform shapes array back into shapes map\n\n onUpdateShapes(groupShapes(updatedShapes));\n onUpdateImageDimension(updatedDimensions);\n };\n\n render() {\n const {\n configuration,\n model,\n imageSupport,\n uploadSoundSupport,\n onConfigurationChanged,\n onImageUpload,\n onModelChangedByConfig,\n onPromptChanged,\n onRationaleChanged,\n onUpdateImageDimension,\n onTeacherInstructionsChanged,\n onUpdateShapes,\n } = this.props;\n const {\n baseInputConfiguration = {},\n contentDimensions = {},\n maxImageWidth = {},\n maxImageHeight = {},\n multipleCorrect = {},\n partialScoring = {},\n preserveAspectRatio = {},\n prompt = {},\n rationale = {},\n settingsPanelDisabled,\n spellCheck = {},\n teacherInstructions = {},\n withRubric = {},\n mathMlOptions = {},\n language = {},\n languageChoices = {},\n } = configuration || {};\n const {\n errors,\n extraCSSRules,\n promptEnabled,\n rationaleEnabled,\n spellCheckEnabled,\n teacherInstructionsEnabled,\n toolbarEditorPosition,\n } = model || {};\n const {\n prompt: promptError,\n rationale: rationaleError,\n shapes: shapesError,\n selections: selectionsError,\n teacherInstructions: teacherInstructionsError,\n } = errors || {};\n const validationMessage = generateValidationMessage(configuration);\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n\n const toolbarOpts = {\n position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',\n };\n\n const panelSettings = {\n multipleCorrect: multipleCorrect.settings && toggle(multipleCorrect.label),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n 'language.enabled': language.settings && toggle(language.label, true),\n language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),\n };\n const panelProperties = {\n teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),\n rubricEnabled: withRubric?.settings && toggle(withRubric?.label),\n };\n\n const getPluginProps = (props = {}) => ({\n ...baseInputConfiguration,\n ...props,\n });\n\n return (\n <layout.ConfigLayout\n extraCSSRules={extraCSSRules}\n dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n onChangeModel={onModelChangedByConfig}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: panelSettings,\n Properties: panelProperties,\n }}\n />\n }\n >\n {teacherInstructionsEnabled && (\n <PromptContainer label={teacherInstructions.label}>\n <EditableHtml\n markup={model.teacherInstructions || ''}\n onChange={onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n error={teacherInstructionsError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(teacherInstructions?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {teacherInstructionsError && <ErrorText>{teacherInstructionsError}</ErrorText>}\n </PromptContainer>\n )}\n\n {promptEnabled && (\n <PromptContainer label={prompt.label}>\n <EditableHtml\n markup={model.prompt || ''}\n onChange={onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n error={promptError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(prompt?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={defaultImageMaxWidth}\n maxImageHeight={defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {promptError && <ErrorText>{promptError}</ErrorText>}\n </PromptContainer>\n )}\n\n <FlexContainer>\n <SubHeading variant=\"h6\">\n Define Hotspot\n </SubHeading>\n <StyledTooltip\n disableFocusListener\n disableTouchListener\n placement={'left'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} style={{ float: 'right' }} />\n </StyledTooltip>\n </FlexContainer>\n\n <HotspotPalette\n hotspotColor={model.hotspotColor}\n hotspotList={model.hotspotList}\n outlineColor={model.outlineColor}\n outlineList={model.outlineList}\n onHotspotColorChange={(color) => this.handleColorChange('hotspot', color)}\n onOutlineColorChange={(color) => this.handleColorChange('outline', color)}\n />\n\n <HotspotContainer\n dimensions={model.dimensions}\n imageUrl={model.imageUrl}\n multipleCorrect={model.multipleCorrect}\n hasErrors={!!shapesError || !!selectionsError}\n hotspotColor={model.hotspotColor}\n outlineColor={model.outlineColor}\n selectedHotspotColor={model.selectedHotspotColor}\n hoverOutlineColor={model.hoverOutlineColor}\n onUpdateImageDimension={onUpdateImageDimension}\n onUpdateShapes={onUpdateShapes}\n onImageUpload={onImageUpload}\n shapes={model.shapes}\n strokeWidth={model.strokeWidth}\n preserveAspectRatioEnabled={preserveAspectRatio.enabled}\n insertImage={imageSupport && imageSupport.add}\n />\n {shapesError && <ErrorText>{shapesError}</ErrorText>}\n {selectionsError && <ErrorText>{selectionsError}</ErrorText>}\n\n {model.imageUrl && (\n <React.Fragment>\n <Typography variant=\"h6\">Image Dimensions</Typography>\n\n <DimensionsContainer>\n <FieldContainer>\n <NumberTextField\n key=\"hotspot-manual-width\"\n label=\"Width\"\n value={model.dimensions.width}\n min={0}\n onChange={(e, value) => this.handleOnUpdateImageDimensions(value, 'width')}\n showErrorWhenOutsideRange\n />\n </FieldContainer>\n\n <FieldContainer>\n <NumberTextField\n key=\"hotspot-manual-height\"\n label=\"Height\"\n value={model.dimensions.height}\n min={0}\n onChange={(e, value) => this.handleOnUpdateImageDimensions(value, 'height')}\n showErrorWhenOutsideRange\n />\n </FieldContainer>\n </DimensionsContainer>\n </React.Fragment>\n )}\n\n {rationaleEnabled && (\n <PromptContainer label={rationale.label}>\n <EditableHtml\n markup={model.rationale || ''}\n onChange={onRationaleChanged}\n imageSupport={imageSupport}\n error={rationaleError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(rationale?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {rationaleError && <ErrorText>{rationaleError}</ErrorText>}\n </PromptContainer>\n )}\n </layout.ConfigLayout>\n );\n }\n}\n\nRoot.propTypes = {\n configuration: PropTypes.object,\n model: PropTypes.object.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func,\n delete: PropTypes.func,\n }),\n uploadSoundSupport: PropTypes.shape({\n add: PropTypes.func,\n delete: PropTypes.func,\n }),\n onImageUpload: PropTypes.func.isRequired,\n onColorChanged: PropTypes.func.isRequired,\n onPromptChanged: PropTypes.func.isRequired,\n onUpdateImageDimension: PropTypes.func.isRequired,\n onUpdateShapes: PropTypes.func.isRequired,\n onModelChangedByConfig: PropTypes.func.isRequired,\n onRationaleChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n onTeacherInstructionsChanged: PropTypes.func.isRequired,\n};\n\nexport default Root;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,KAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,QAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,eAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,iBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAEA,MAAM;EAAEW,KAAK;EAAEC,MAAM;EAAEC;AAAS,CAAC,GAAGC,kBAAQ;AAE5C,MAAMC,mBAAmB,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC;EAAEC;AAAM,CAAC,MAAM;EACxDC,OAAO,EAAE,MAAM;EACfC,YAAY,EAAEF,KAAK,CAACG,OAAO,CAAC,GAAG;AACjC,CAAC,CAAC,CAAC;AAEH,MAAMC,cAAc,GAAG,IAAAL,cAAM,EAAC,KAAK,CAAC,CAAC;EACnCM,IAAI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C;IAC5Bd,GAAG,EAAEW,kBAAS,CAACI,IAAI;IACnBC,MAAM,EAAEL,kBAAS,CAACI;EACpB,CAAC,CAAC;EACFlG,kBAAkB,EAAE8F,kBAAS,CAACG,KAAK,CAAC;IAClCd,GAAG,EAAEW,kBAAS,CAACI,IAAI;IACnBC,MAAM,EAAEL,kBAAS,CAACI;EACpB,CAAC,CAAC;EACFhG,aAAa,EAAE4F,kBAAS,CAACI,IAAI,CAACF,UAAU;EACxCvH,cAAc,EAAEqH,kBAAS,CAACI,IAAI,CAACF,UAAU;EACzC5F,eAAe,EAAE0F,kBAAS,CAACI,IAAI,CAACF,UAAU;EAC1C7G,sBAAsB,EAAE2G,kBAAS,CAACI,IAAI,CAACF,UAAU;EACjD5G,cAAc,EAAE0G,kBAAS,CAACI,IAAI,CAACF,UAAU;EACzC7F,sBAAsB,EAAE2F,kBAAS,CAACI,IAAI,CAACF,UAAU;EACjD3F,kBAAkB,EAAEyF,kBAAS,CAACI,IAAI,CAACF,UAAU;EAC7C/F,sBAAsB,EAAE6F,kBAAS,CAACI,IAAI,CAACF,UAAU;EACjD1F,4BAA4B,EAAEwF,kBAAS,CAACI,IAAI,CAACF;AAC/C,CAAC;AAAC,IAAAI,QAAA,GAAAR,OAAA,CAAArH,OAAA,GAEaN,IAAI","ignoreList":[]}
@@ -1,84 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.CircleShape = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- class CircleShape {
10
- static create(shapes, e) {
11
- const newShapes = [...shapes];
12
- const highestId = Math.max(...newShapes.map(shape => parseInt(shape.id)), 0);
13
- const newCircle = {
14
- id: `${highestId + 1}`,
15
- radius: 0,
16
- x: e.evt.layerX,
17
- y: e.evt.layerY,
18
- group: 'circles',
19
- index: newShapes.length
20
- };
21
- newShapes.push(newCircle);
22
- return {
23
- shapes: newShapes,
24
- isDrawing: true,
25
- isDrawingShapeId: newCircle.id
26
- };
27
- }
28
- static finalizeCreation(state, props) {
29
- const currentShapeIndex = state.shapes.findIndex(shape => shape.id === state.isDrawingShapeId);
30
- if (currentShapeIndex !== -1) {
31
- const currentShape = state.shapes[currentShapeIndex];
32
-
33
- // Check if the shape is a valid circle (has more than 0 radius) before finalizing
34
- if (currentShape.radius > 0) {
35
- return {
36
- ...state,
37
- isDrawing: false,
38
- stateShapes: false,
39
- isDrawingShapeId: undefined
40
- };
41
- } else {
42
- return {
43
- ...state,
44
- isDrawing: false,
45
- stateShapes: false,
46
- isDrawingShapeId: undefined,
47
- shapes: state.shapes.filter(shape => shape.id !== state.isDrawingShapeId)
48
- };
49
- }
50
- }
51
- return {
52
- ...state,
53
- isDrawing: false,
54
- stateShapes: false,
55
- isDrawingShapeId: undefined
56
- };
57
- }
58
- static handleMouseMove(state, e) {
59
- const {
60
- isDrawing,
61
- isDrawingShapeId,
62
- shapes
63
- } = state;
64
- if (isDrawing) {
65
- const tempShapes = [...shapes];
66
- const resizingShapeIndex = tempShapes.findIndex(shape => shape.id === isDrawingShapeId);
67
- if (resizingShapeIndex !== -1) {
68
- const resizingShape = tempShapes[resizingShapeIndex];
69
-
70
- // Calculate radius based on mouse position
71
- const dx = e.evt.layerX - resizingShape.x;
72
- const dy = e.evt.layerY - resizingShape.y;
73
- resizingShape.radius = Math.sqrt(dx * dx + dy * dy);
74
- return {
75
- shapes: tempShapes
76
- };
77
- }
78
- }
79
- return state;
80
- }
81
- }
82
- exports.CircleShape = CircleShape;
83
- (0, _defineProperty2.default)(CircleShape, "name", 'circle');
84
- //# sourceMappingURL=circle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"circle.js","names":["CircleShape","create","shapes","e","newShapes","highestId","Math","max","map","shape","parseInt","id","newCircle","radius","x","evt","layerX","y","layerY","group","index","length","push","isDrawing","isDrawingShapeId","finalizeCreation","state","props","currentShapeIndex","findIndex","currentShape","stateShapes","undefined","filter","handleMouseMove","tempShapes","resizingShapeIndex","resizingShape","dx","dy","sqrt","exports","_defineProperty2","default"],"sources":["../../src/shapes/circle.js"],"sourcesContent":["export class CircleShape {\n static name = 'circle'\n\n static create(shapes, e) {\n const newShapes = [...shapes];\n const highestId = Math.max(...newShapes.map((shape) => parseInt(shape.id)), 0);\n const newCircle = {\n id: `${highestId + 1}`,\n radius: 0,\n x: e.evt.layerX,\n y: e.evt.layerY,\n group: 'circles',\n index: newShapes.length,\n };\n\n newShapes.push(newCircle);\n\n return {\n shapes: newShapes,\n isDrawing: true,\n isDrawingShapeId: newCircle.id,\n };\n }\n\n static finalizeCreation(state, props) {\n const currentShapeIndex = state.shapes.findIndex((shape) => shape.id === state.isDrawingShapeId);\n\n if (currentShapeIndex !== -1) {\n const currentShape = state.shapes[currentShapeIndex];\n\n // Check if the shape is a valid circle (has more than 0 radius) before finalizing\n if (currentShape.radius > 0) {\n return {\n ...state,\n isDrawing: false,\n stateShapes: false,\n isDrawingShapeId: undefined,\n };\n } else {\n return {\n ...state,\n isDrawing: false,\n stateShapes: false,\n isDrawingShapeId: undefined,\n shapes: state.shapes.filter((shape) => shape.id !== state.isDrawingShapeId),\n };\n }\n }\n\n return {\n ...state,\n isDrawing: false,\n stateShapes: false,\n isDrawingShapeId: undefined,\n };\n }\n\n static handleMouseMove(state, e) {\n const { isDrawing, isDrawingShapeId, shapes } = state;\n\n if (isDrawing) {\n const tempShapes = [...shapes];\n const resizingShapeIndex = tempShapes.findIndex((shape) => shape.id === isDrawingShapeId);\n\n if (resizingShapeIndex !== -1) {\n const resizingShape = tempShapes[resizingShapeIndex];\n\n // Calculate radius based on mouse position\n const dx = e.evt.layerX - resizingShape.x;\n const dy = e.evt.layerY - resizingShape.y;\n resizingShape.radius = Math.sqrt(dx * dx + dy * dy);\n\n return {\n shapes: tempShapes,\n };\n }\n }\n\n return state;\n }\n}\n"],"mappings":";;;;;;;;AAAO,MAAMA,WAA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W,UACR,QAAQ","ignoreList":[]}
@@ -1,50 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _circle = require("./circle");
7
- Object.keys(_circle).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _circle[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _circle[key];
14
- }
15
- });
16
- });
17
- var _rectagle = require("./rectagle");
18
- Object.keys(_rectagle).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _rectagle[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _rectagle[key];
25
- }
26
- });
27
- });
28
- var _polygon = require("./polygon");
29
- Object.keys(_polygon).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _polygon[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function () {
35
- return _polygon[key];
36
- }
37
- });
38
- });
39
- var _utils = require("./utils");
40
- Object.keys(_utils).forEach(function (key) {
41
- if (key === "default" || key === "__esModule") return;
42
- if (key in exports && exports[key] === _utils[key]) return;
43
- Object.defineProperty(exports, key, {
44
- enumerable: true,
45
- get: function () {
46
- return _utils[key];
47
- }
48
- });
49
- });
50
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["_circle","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_rectagle","_polygon","_utils"],"sources":["../../src/shapes/index.js"],"sourcesContent":["export * from './circle';\nexport * from './rectagle';\nexport * from './polygon';\nexport * from './utils';\n"],"mappings":";;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,OAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OA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AA,OAAAG,MAAA,CAAAP,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1,82 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.PolygonShape = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- class PolygonShape {
10
- static create(shapes, e) {
11
- const newShapes = [...shapes];
12
- const newPolygon = {
13
- id: 'newPolygon',
14
- points: [{
15
- x: e.evt.layerX,
16
- y: e.evt.layerY
17
- }],
18
- group: 'polygons',
19
- index: newShapes.length
20
- };
21
- newShapes.push(newPolygon);
22
- return {
23
- shapes: newShapes,
24
- isDrawing: true,
25
- isDrawingShapeId: newPolygon.id
26
- };
27
- }
28
- static addPoint(state, e, onPolygonComplete) {
29
- // Number of pixels allowed to determine if the first point was clicked
30
- const clickDelta = 5;
31
- const shapesCopy = JSON.parse(JSON.stringify(state.shapes));
32
- const currentShapeIndex = shapesCopy.findIndex(shape => shape.id === state.isDrawingShapeId);
33
- if (currentShapeIndex !== -1) {
34
- const currentShape = shapesCopy[currentShapeIndex];
35
- if (currentShape.points && Array.isArray(currentShape.points)) {
36
- const firstPoint = currentShape.points[0];
37
-
38
- // If click is close enough to the first point (within clickDelta pixels), close the polygon
39
- if (Math.abs(firstPoint.x - e.evt.layerX) <= clickDelta && Math.abs(firstPoint.y - e.evt.layerY) <= clickDelta) {
40
- return PolygonShape.finalizeCreation(state, onPolygonComplete);
41
- }
42
- currentShape.points.push({
43
- x: e.evt.layerX,
44
- y: e.evt.layerY
45
- });
46
- shapesCopy[currentShapeIndex] = currentShape;
47
- return {
48
- shapes: shapesCopy
49
- };
50
- }
51
- }
52
- return state;
53
- }
54
- static finalizeCreation(state, onPolygonComplete) {
55
- const {
56
- shapes
57
- } = state;
58
- const tempShapes = [...shapes];
59
- const highestId = Math.max(...state.shapes.map(shape => parseInt(shape.id) || 0), 0);
60
- const polygonIndex = tempShapes.findIndex(shape => shape.id === state.isDrawingShapeId);
61
- if (polygonIndex !== -1 && tempShapes[polygonIndex].points.length > 2) {
62
- const completedPolygon = tempShapes[polygonIndex];
63
- completedPolygon.id = `${highestId + 1}`;
64
- onPolygonComplete(tempShapes);
65
- return {
66
- isDrawing: false,
67
- shapes: tempShapes,
68
- isDrawingShapeId: undefined
69
- };
70
- }
71
- return state;
72
- }
73
-
74
- // No need to update anything on mouse move,
75
- // but it's here if we need to add any logic later.
76
- static handleMouseMove(state, e) {
77
- return state;
78
- }
79
- }
80
- exports.PolygonShape = PolygonShape;
81
- (0, _defineProperty2.default)(PolygonShape, "name", 'polygon');
82
- //# sourceMappingURL=polygon.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"polygon.js","names":["PolygonShape","create","shapes","e","newShapes","newPolygon","id","points","x","evt","layerX","y","layerY","group","index","length","push","isDrawing","isDrawingShapeId","addPoint","state","onPolygonComplete","clickDelta","shapesCopy","JSON","parse","stringify","currentShapeIndex","findIndex","shape","currentShape","Array","isArray","firstPoint","Math","abs","finalizeCreation","tempShapes","highestId","max","map","parseInt","polygonIndex","completedPolygon","undefined","handleMouseMove","exports","_defineProperty2","default"],"sources":["../../src/shapes/polygon.js"],"sourcesContent":["export class PolygonShape {\n static name = 'polygon'\n\n static create(shapes, e) {\n const newShapes = [...shapes];\n const newPolygon = {\n id: 'newPolygon',\n points: [{ x: e.evt.layerX, y: e.evt.layerY }],\n group: 'polygons',\n index: newShapes.length,\n };\n\n newShapes.push(newPolygon);\n\n return {\n shapes: newShapes,\n isDrawing: true,\n isDrawingShapeId: newPolygon.id,\n };\n }\n\n static addPoint(state, e, onPolygonComplete) {\n // Number of pixels allowed to determine if the first point was clicked\n const clickDelta = 5;\n\n const shapesCopy = JSON.parse(JSON.stringify(state.shapes));\n const currentShapeIndex = shapesCopy.findIndex((shape) => shape.id === state.isDrawingShapeId);\n\n if (currentShapeIndex !== -1) {\n const currentShape = shapesCopy[currentShapeIndex];\n if (currentShape.points && Array.isArray(currentShape.points)) {\n const firstPoint = currentShape.points[0];\n\n // If click is close enough to the first point (within clickDelta pixels), close the polygon\n if (\n Math.abs(firstPoint.x - e.evt.layerX) <= clickDelta &&\n Math.abs(firstPoint.y - e.evt.layerY) <= clickDelta\n ) {\n return PolygonShape.finalizeCreation(state, onPolygonComplete);\n }\n\n currentShape.points.push({ x: e.evt.layerX, y: e.evt.layerY });\n shapesCopy[currentShapeIndex] = currentShape;\n\n return {\n shapes: shapesCopy,\n };\n }\n }\n return state;\n }\n\n static finalizeCreation(state, onPolygonComplete) {\n const { shapes } = state;\n const tempShapes = [...shapes];\n const highestId = Math.max(...state.shapes.map((shape) => parseInt(shape.id) || 0), 0);\n\n const polygonIndex = tempShapes.findIndex((shape) => shape.id === state.isDrawingShapeId);\n\n if (polygonIndex !== -1 && tempShapes[polygonIndex].points.length > 2) {\n const completedPolygon = tempShapes[polygonIndex];\n\n completedPolygon.id = `${highestId + 1}`;\n onPolygonComplete(tempShapes);\n\n return {\n isDrawing: false,\n shapes: tempShapes,\n isDrawingShapeId: undefined,\n };\n }\n\n return state;\n }\n\n // No need to update anything on mouse move,\n // but it's here if we need to add any logic later.\n static handleMouseMove(state, e) {\n return state;\n }\n}\n"],"mappings":";;;;;;;;AAAO,MAAMA,YAAY,CAAC;EAGxB,OAAOC,MAAMA,CAACC,MAAM,EAAEC,CAAC,EAAE;IACvB,MAAMC,SAAS,GAAG,CAAC,GAAGF,MAAM,CAAC;IAC7B,MAAMG,UAAU,GAAG;MACjBC,EAAE,EAAE,YAAY;MAChBC,MAAM,EAAE,CAAC;QAAEC,CAAC,EAAEL,CAAC,CAACM,GAAG,CAACC,MAAM;QAAEC,CAAC,EAAER,CAAC,CAACM,GAAG,CAACG;MAAO,CAAC,CAAC;MAC9CC,KAAK,EAAE,UAAU;MACjBC,KAAK,EAAEV,SAAS,CAACW;IACnB,CAAC;IAEDX,SAAS,CAACY,IAAI,CAACX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