@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.
- package/configure.js +2 -0
- package/controller.js +1 -0
- package/dist/author/DeleteWidget.d.ts +38 -0
- package/dist/author/DeleteWidget.js +46 -0
- package/dist/author/button.d.ts +31 -0
- package/dist/author/button.js +27 -0
- package/dist/author/buttons/circle.d.ts +18 -0
- package/dist/author/buttons/circle.js +25 -0
- package/dist/author/buttons/polygon.d.ts +18 -0
- package/dist/author/buttons/polygon.js +36 -0
- package/dist/author/buttons/rectangle.d.ts +18 -0
- package/dist/author/buttons/rectangle.js +36 -0
- package/dist/author/defaults.d.ts +157 -0
- package/dist/author/defaults.js +119 -0
- package/dist/author/hotspot-circle.d.ts +21 -0
- package/dist/author/hotspot-circle.js +124 -0
- package/dist/author/hotspot-container.d.ts +29 -0
- package/dist/author/hotspot-container.js +210 -0
- package/dist/author/hotspot-drawable.d.ts +31 -0
- package/dist/author/hotspot-drawable.js +312 -0
- package/dist/author/hotspot-palette.d.ts +14 -0
- package/dist/author/hotspot-palette.js +72 -0
- package/dist/author/hotspot-polygon.d.ts +38 -0
- package/dist/author/hotspot-polygon.js +200 -0
- package/dist/author/hotspot-rectangle.d.ts +20 -0
- package/dist/author/hotspot-rectangle.js +119 -0
- package/dist/author/icons.d.ts +9 -0
- package/dist/author/icons.js +4 -0
- package/dist/author/image-konva.d.ts +19 -0
- package/dist/author/image-konva.js +49 -0
- package/dist/author/index.d.ts +52 -0
- package/dist/author/index.js +143 -0
- package/dist/author/root.d.ts +15 -0
- package/dist/author/root.js +215 -0
- package/dist/author/shapes/circle.d.ts +18 -0
- package/dist/author/shapes/circle.js +47 -0
- package/dist/author/shapes/index.d.ts +12 -0
- package/dist/author/shapes/polygon.d.ts +19 -0
- package/dist/author/shapes/polygon.js +51 -0
- package/dist/author/shapes/rectagle.d.ts +18 -0
- package/dist/author/shapes/rectagle.js +57 -0
- package/dist/author/shapes/utils.d.ts +19 -0
- package/dist/author/shapes/utils.js +16 -0
- package/dist/author/upload-control.d.ts +29 -0
- package/dist/author/upload-control.js +28 -0
- package/dist/author/utils.d.ts +24 -0
- package/dist/author/utils.js +83 -0
- package/dist/browser/ReactKonva-Z9-1H-UZ.js +19329 -0
- package/dist/browser/ReactKonva-Z9-1H-UZ.js.map +1 -0
- package/dist/browser/author/index.js +42297 -0
- package/dist/browser/author/index.js.map +1 -0
- package/dist/browser/browser-CfnAFove.js +210 -0
- package/dist/browser/browser-CfnAFove.js.map +1 -0
- package/dist/browser/controller/index.js +198 -0
- package/dist/browser/controller/index.js.map +1 -0
- package/dist/browser/delivery/index.js +2460 -0
- package/dist/browser/delivery/index.js.map +1 -0
- package/dist/browser/hotspot.css +2 -0
- package/dist/browser/isEqual-D3CTSc6W.js +601 -0
- package/dist/browser/isEqual-D3CTSc6W.js.map +1 -0
- package/dist/controller/defaults.d.ts +35 -0
- package/dist/controller/defaults.js +29 -0
- package/dist/controller/index.d.ts +22 -0
- package/dist/controller/index.js +154 -0
- package/dist/controller/utils.d.ts +10 -0
- package/dist/controller/utils.js +13 -0
- package/dist/delivery/hotspot/circle.d.ts +19 -0
- package/dist/delivery/hotspot/circle.js +100 -0
- package/dist/delivery/hotspot/container.d.ts +16 -0
- package/dist/delivery/hotspot/container.js +150 -0
- package/dist/delivery/hotspot/icons.d.ts +10 -0
- package/dist/delivery/hotspot/icons.js +4 -0
- package/dist/delivery/hotspot/image-konva-tooltip.d.ts +19 -0
- package/dist/delivery/hotspot/image-konva-tooltip.js +66 -0
- package/dist/delivery/hotspot/index.d.ts +17 -0
- package/dist/delivery/hotspot/index.js +114 -0
- package/dist/delivery/hotspot/polygon.d.ts +21 -0
- package/dist/delivery/hotspot/polygon.js +108 -0
- package/dist/delivery/hotspot/rectangle.d.ts +19 -0
- package/dist/delivery/hotspot/rectangle.js +104 -0
- package/dist/delivery/index.d.ts +20 -0
- package/dist/delivery/index.js +107 -0
- package/dist/delivery/session-updater.d.ts +10 -0
- package/dist/delivery/session-updater.js +14 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.iife.d.ts +8 -0
- package/dist/index.iife.js +169 -0
- package/dist/index.js +2 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +57 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js +30 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js +35 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js +35 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js +32 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +23 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +33 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +21 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEqual.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +6 -0
- package/package.json +78 -16
- package/CHANGELOG.json +0 -997
- package/CHANGELOG.md +0 -2214
- package/LICENSE.md +0 -5
- package/README.md +0 -1
- package/configure/CHANGELOG.json +0 -682
- package/configure/CHANGELOG.md +0 -1951
- package/configure/lib/DeleteWidget.js +0 -64
- package/configure/lib/DeleteWidget.js.map +0 -1
- package/configure/lib/button.js +0 -42
- package/configure/lib/button.js.map +0 -1
- package/configure/lib/buttons/circle.js +0 -33
- package/configure/lib/buttons/circle.js.map +0 -1
- package/configure/lib/buttons/polygon.js +0 -39
- package/configure/lib/buttons/polygon.js.map +0 -1
- package/configure/lib/buttons/rectangle.js +0 -39
- package/configure/lib/buttons/rectangle.js.map +0 -1
- package/configure/lib/defaults.js +0 -155
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/hotspot-circle.js +0 -192
- package/configure/lib/hotspot-circle.js.map +0 -1
- package/configure/lib/hotspot-container.js +0 -320
- package/configure/lib/hotspot-container.js.map +0 -1
- package/configure/lib/hotspot-drawable.js +0 -519
- package/configure/lib/hotspot-drawable.js.map +0 -1
- package/configure/lib/hotspot-palette.js +0 -107
- package/configure/lib/hotspot-palette.js.map +0 -1
- package/configure/lib/hotspot-polygon.js +0 -293
- package/configure/lib/hotspot-polygon.js.map +0 -1
- package/configure/lib/hotspot-rectangle.js +0 -190
- package/configure/lib/hotspot-rectangle.js.map +0 -1
- package/configure/lib/icons.js +0 -7
- package/configure/lib/icons.js.map +0 -1
- package/configure/lib/image-konva.js +0 -66
- package/configure/lib/image-konva.js.map +0 -1
- package/configure/lib/index.js +0 -194
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/root.js +0 -330
- package/configure/lib/root.js.map +0 -1
- package/configure/lib/shapes/circle.js +0 -84
- package/configure/lib/shapes/circle.js.map +0 -1
- package/configure/lib/shapes/index.js +0 -50
- package/configure/lib/shapes/index.js.map +0 -1
- package/configure/lib/shapes/polygon.js +0 -82
- package/configure/lib/shapes/polygon.js.map +0 -1
- package/configure/lib/shapes/rectagle.js +0 -84
- package/configure/lib/shapes/rectagle.js.map +0 -1
- package/configure/lib/shapes/utils.js +0 -21
- package/configure/lib/shapes/utils.js.map +0 -1
- package/configure/lib/upload-control.js +0 -41
- package/configure/lib/upload-control.js.map +0 -1
- package/configure/lib/utils.js +0 -185
- package/configure/lib/utils.js.map +0 -1
- package/configure/package.json +0 -26
- package/configure/src/DeleteWidget.jsx +0 -51
- package/configure/src/__tests__/DeleteWidget.test.jsx +0 -366
- package/configure/src/__tests__/button.test.jsx +0 -198
- package/configure/src/__tests__/hotspot-circle.test.jsx +0 -259
- package/configure/src/__tests__/hotspot-container.test.js +0 -366
- package/configure/src/__tests__/hotspot-drawable.test.js +0 -271
- package/configure/src/__tests__/hotspot-palette.test.jsx +0 -71
- package/configure/src/__tests__/image-konva.test.jsx +0 -226
- package/configure/src/__tests__/index.test.js +0 -329
- package/configure/src/__tests__/root.test.js +0 -400
- package/configure/src/__tests__/utils.test.js +0 -241
- package/configure/src/button.jsx +0 -35
- package/configure/src/buttons/circle.jsx +0 -18
- package/configure/src/buttons/polygon.jsx +0 -29
- package/configure/src/buttons/rectangle.jsx +0 -29
- package/configure/src/defaults.js +0 -109
- package/configure/src/hotspot-circle.jsx +0 -183
- package/configure/src/hotspot-container.jsx +0 -330
- package/configure/src/hotspot-drawable.jsx +0 -527
- package/configure/src/hotspot-palette.jsx +0 -90
- package/configure/src/hotspot-polygon.jsx +0 -294
- package/configure/src/hotspot-rectangle.jsx +0 -169
- package/configure/src/icons.js +0 -5
- package/configure/src/image-konva.jsx +0 -63
- package/configure/src/index.js +0 -208
- package/configure/src/root.jsx +0 -346
- package/configure/src/shapes/circle.js +0 -81
- package/configure/src/shapes/index.js +0 -4
- package/configure/src/shapes/polygon.js +0 -81
- package/configure/src/shapes/rectagle.js +0 -82
- package/configure/src/shapes/utils.js +0 -16
- package/configure/src/upload-control.jsx +0 -33
- package/configure/src/utils.js +0 -210
- package/controller/CHANGELOG.json +0 -362
- package/controller/CHANGELOG.md +0 -1304
- package/controller/lib/defaults.js +0 -33
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -341
- package/controller/lib/index.js.map +0 -1
- package/controller/lib/utils.js +0 -32
- package/controller/lib/utils.js.map +0 -1
- package/controller/package.json +0 -18
- package/controller/src/__tests__/index.test.js +0 -419
- package/controller/src/__tests__/utils.test.js +0 -5
- package/controller/src/defaults.js +0 -19
- package/controller/src/index.js +0 -328
- package/controller/src/utils.js +0 -29
- package/docs/config-schema.json +0 -2023
- package/docs/config-schema.json.md +0 -1495
- package/docs/demo/config.js +0 -8
- package/docs/demo/generate.js +0 -118
- package/docs/demo/index.html +0 -1
- package/docs/demo/session.js +0 -11
- package/docs/pie-schema.json +0 -1204
- package/docs/pie-schema.json.md +0 -851
- package/lib/hotspot/circle.js +0 -156
- package/lib/hotspot/circle.js.map +0 -1
- package/lib/hotspot/container.js +0 -206
- package/lib/hotspot/container.js.map +0 -1
- package/lib/hotspot/icons.js +0 -8
- package/lib/hotspot/icons.js.map +0 -1
- package/lib/hotspot/image-konva-tooltip.js +0 -86
- package/lib/hotspot/image-konva-tooltip.js.map +0 -1
- package/lib/hotspot/index.js +0 -163
- package/lib/hotspot/index.js.map +0 -1
- package/lib/hotspot/polygon.js +0 -203
- package/lib/hotspot/polygon.js.map +0 -1
- package/lib/hotspot/rectangle.js +0 -175
- package/lib/hotspot/rectangle.js.map +0 -1
- package/lib/index.js +0 -213
- package/lib/index.js.map +0 -1
- package/lib/session-updater.js +0 -42
- package/lib/session-updater.js.map +0 -1
- package/src/__tests__/container.test.jsx +0 -58
- package/src/__tests__/index.test.js +0 -123
- package/src/__tests__/session-updater.test.jsx +0 -69
- package/src/hotspot/__tests__/circle.test.jsx +0 -464
- package/src/hotspot/__tests__/container.test.jsx +0 -546
- package/src/hotspot/__tests__/image-konva-tooltip.test.jsx +0 -510
- package/src/hotspot/__tests__/polygon.test.jsx +0 -502
- package/src/hotspot/__tests__/rectangle.test.jsx +0 -418
- package/src/hotspot/circle.jsx +0 -152
- package/src/hotspot/container.jsx +0 -217
- package/src/hotspot/icons.js +0 -7
- package/src/hotspot/image-konva-tooltip.jsx +0 -76
- package/src/hotspot/index.jsx +0 -165
- package/src/hotspot/polygon.jsx +0 -195
- package/src/hotspot/rectangle.jsx +0 -171
- package/src/index.js +0 -226
- package/src/session-updater.js +0 -29
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
export const PolygonButton = ({ isActive = false }) => (
|
|
5
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="32" viewBox="112 0 48 32" fill="none">
|
|
6
|
-
<path
|
|
7
|
-
fillRule="evenodd"
|
|
8
|
-
clipRule="evenodd"
|
|
9
|
-
d="M112 4C112 1.79086 113.791 0 116 0H155C157.209 0 159 1.79086 159 4V28.0001C159 30.2093 157.209 32.0001 155 32.0001H116C113.791 32.0001 112 30.2093 112 28.0001V4Z"
|
|
10
|
-
fill={isActive ? '#D3D4D9' : '#ECEDF1'}
|
|
11
|
-
/>
|
|
12
|
-
<mask id="path-6-inside-1_2196_700" fill="white">
|
|
13
|
-
<path
|
|
14
|
-
fillRule="evenodd"
|
|
15
|
-
clipRule="evenodd"
|
|
16
|
-
d="M130 8H126V12H127.5V20H126V24H130V22.7145H141V24H145V20H141.737L139.998 18H140V14.4265L142.11 12H145V8H141V9.71451H130V8ZM139.046 14L141 11.7525V10.7145H130V12H128.5V20H130V21.7145H141V20.6765L138.673 18H136V14H139.046Z"
|
|
17
|
-
/>
|
|
18
|
-
</mask>
|
|
19
|
-
<path
|
|
20
|
-
d="M126 8V7H125V8H126ZM130 8H131V7H130V8ZM126 12H125V13H126V12ZM127.5 12H128.5V11H127.5V12ZM127.5 20V21H128.5V20H127.5ZM126 20V19H125V20H126ZM126 24H125V25H126V24ZM130 24V25H131V24H130ZM130 22.7145V21.7145H129V22.7145H130ZM141 22.7145H142V21.7145H141V22.7145ZM141 24H140V25H141V24ZM145 24V25H146V24H145ZM145 20H146V19H145V20ZM141.737 20L140.982 20.6562L141.281 21H141.737V20ZM139.998 18V17H137.803L139.243 18.6562L139.998 18ZM140 18V19H141V18H140ZM140 14.4265L139.245 13.7703L139 14.0525V14.4265H140ZM142.11 12V11H141.654L141.355 11.3438L142.11 12ZM145 12V13H146V12H145ZM145 8H146V7H145V8ZM141 8V7H140V8H141ZM141 9.71451V10.7145H142V9.71451H141ZM130 9.71451H129V10.7145H130V9.71451ZM141 11.7525L141.755 12.4087L142 12.1265V11.7525H141ZM139.046 14V15H139.501L139.8 14.6562L139.046 14ZM141 10.7145H142V9.71451H141V10.7145ZM130 10.7145V9.71451H129V10.7145H130ZM130 12V13H131V12H130ZM128.5 12V11H127.5V12H128.5ZM128.5 20H127.5V21H128.5V20ZM130 20H131V19H130V20ZM130 21.7145H129V22.7145H130V21.7145ZM141 21.7145V22.7145H142V21.7145H141ZM141 20.6765H142V20.3025L141.755 20.0203L141 20.6765ZM138.673 18L139.427 17.3438L139.128 17H138.673V18ZM136 18H135V19H136V18ZM136 14V13H135V14H136ZM126 9H130V7H126V9ZM127 12V8H125V12H127ZM127.5 11H126V13H127.5V11ZM128.5 20V12H126.5V20H128.5ZM126 21H127.5V19H126V21ZM127 24V20H125V24H127ZM130 23H126V25H130V23ZM129 22.7145V24H131V22.7145H129ZM141 21.7145H130V23.7145H141V21.7145ZM142 24V22.7145H140V24H142ZM145 23H141V25H145V23ZM144 20V24H146V20H144ZM141.737 21H145V19H141.737V21ZM139.243 18.6562L140.982 20.6562L142.492 19.3438L140.752 17.3438L139.243 18.6562ZM140 17H139.998V19H140V17ZM139 14.4265V18H141V14.4265H139ZM141.355 11.3438L139.245 13.7703L140.755 15.0827L142.865 12.6562L141.355 11.3438ZM145 11H142.11V13H145V11ZM144 8V12H146V8H144ZM141 9H145V7H141V9ZM142 9.71451V8H140V9.71451H142ZM130 10.7145H141V8.71451H130V10.7145ZM129 8V9.71451H131V8H129ZM140.245 11.0963L138.291 13.3438L139.8 14.6562L141.755 12.4087L140.245 11.0963ZM140 10.7145V11.7525H142V10.7145H140ZM130 11.7145H141V9.71451H130V11.7145ZM131 12V10.7145H129V12H131ZM128.5 13H130V11H128.5V13ZM129.5 20V12H127.5V20H129.5ZM130 19H128.5V21H130V19ZM131 21.7145V20H129V21.7145H131ZM141 20.7145H130V22.7145H141V20.7145ZM140 20.6765V21.7145H142V20.6765H140ZM137.918 18.6562L140.245 21.3327L141.755 20.0203L139.427 17.3438L137.918 18.6562ZM138.673 17H136V19H138.673V17ZM137 18V14H135V18H137ZM136 15H139.046V13H136V15Z"
|
|
21
|
-
fill="black"
|
|
22
|
-
mask="url(#path-6-inside-1_2196_700)"
|
|
23
|
-
/>
|
|
24
|
-
</svg>
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
PolygonButton.propTypes = {
|
|
28
|
-
isActive: PropTypes.bool,
|
|
29
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
export const RectangleButton = ({ isActive = false }) => (
|
|
5
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="32" viewBox="0 0 48 32" fill="none">
|
|
6
|
-
<path
|
|
7
|
-
fillRule="evenodd"
|
|
8
|
-
clipRule="evenodd"
|
|
9
|
-
d="M0 4C0 1.79086 1.79086 0 4 0H43C45.2091 0 47 1.79086 47 4V28.0001C47 30.2093 45.2091 32.0001 43 32.0001H4C1.79086 32.0001 0 30.2093 0 28.0001V4Z"
|
|
10
|
-
fill={isActive ? '#D3D4D9' : '#ECEDF1'}
|
|
11
|
-
/>
|
|
12
|
-
<mask id="path-8-inside-2_2196_700" fill="white">
|
|
13
|
-
<path
|
|
14
|
-
fillRule="evenodd"
|
|
15
|
-
clipRule="evenodd"
|
|
16
|
-
d="M13 8H17V9.5H29V8H33V12H31.5V20H33V24H29V22.5H17V24H13V20H14.5V12H13V8ZM17 21.5V20H15.5V12H17V10.5H29V12H30.5V20H29V21.5H17Z"
|
|
17
|
-
/>
|
|
18
|
-
</mask>
|
|
19
|
-
<path
|
|
20
|
-
d="M17 8H18V7H17V8ZM13 8V7H12V8H13ZM17 9.5H16V10.5H17V9.5ZM29 9.5V10.5H30V9.5H29ZM29 8V7H28V8H29ZM33 8H34V7H33V8ZM33 12V13H34V12H33ZM31.5 12V11H30.5V12H31.5ZM31.5 20H30.5V21H31.5V20ZM33 20H34V19H33V20ZM33 24V25H34V24H33ZM29 24H28V25H29V24ZM29 22.5H30V21.5H29V22.5ZM17 22.5V21.5H16V22.5H17ZM17 24V25H18V24H17ZM13 24H12V25H13V24ZM13 20V19H12V20H13ZM14.5 20V21H15.5V20H14.5ZM14.5 12H15.5V11H14.5V12ZM13 12H12V13H13V12ZM17 20H18V19H17V20ZM17 21.5H16V22.5H17V21.5ZM15.5 20H14.5V21H15.5V20ZM15.5 12V11H14.5V12H15.5ZM17 12V13H18V12H17ZM17 10.5V9.5H16V10.5H17ZM29 10.5H30V9.5H29V10.5ZM29 12H28V13H29V12ZM30.5 12H31.5V11H30.5V12ZM30.5 20V21H31.5V20H30.5ZM29 20V19H28V20H29ZM29 21.5V22.5H30V21.5H29ZM17 7H13V9H17V7ZM18 9.5V8H16V9.5H18ZM29 8.5H17V10.5H29V8.5ZM28 8V9.5H30V8H28ZM33 7H29V9H33V7ZM34 12V8H32V12H34ZM31.5 13H33V11H31.5V13ZM32.5 20V12H30.5V20H32.5ZM33 19H31.5V21H33V19ZM34 24V20H32V24H34ZM29 25H33V23H29V25ZM28 22.5V24H30V22.5H28ZM17 23.5H29V21.5H17V23.5ZM16 22.5V24H18V22.5H16ZM17 23H13V25H17V23ZM14 24V20H12V24H14ZM13 21H14.5V19H13V21ZM13.5 12V20H15.5V12H13.5ZM13 13H14.5V11H13V13ZM12 8V12H14V8H12ZM16 20V21.5H18V20H16ZM15.5 21H17V19H15.5V21ZM16.5 20V12H14.5V20H16.5ZM15.5 13H17V11H15.5V13ZM18 12V10.5H16V12H18ZM17 11.5H29V9.5H17V11.5ZM28 10.5V12H30V10.5H28ZM29 13H30.5V11H29V13ZM29.5 12V20H31.5V12H29.5ZM30.5 19H29V21H30.5V19ZM28 20V21.5H30V20H28ZM29 20.5H17V22.5H29V20.5Z"
|
|
21
|
-
fill="black"
|
|
22
|
-
mask="url(#path-8-inside-2_2196_700)"
|
|
23
|
-
/>
|
|
24
|
-
</svg>
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
RectangleButton.propTypes = {
|
|
28
|
-
isActive: PropTypes.bool,
|
|
29
|
-
};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
model: {
|
|
3
|
-
dimensions: { height: 0, width: 0 },
|
|
4
|
-
hotspotColor: 'rgba(137, 183, 244, 0.25)',
|
|
5
|
-
hotspotList: ['rgba(137, 183, 244, 0.25)'],
|
|
6
|
-
imageUrl: '',
|
|
7
|
-
multipleCorrect: true,
|
|
8
|
-
outlineColor: 'blue',
|
|
9
|
-
outlineList: ['blue'],
|
|
10
|
-
partialScoring: false,
|
|
11
|
-
prompt: '',
|
|
12
|
-
promptEnabled: true,
|
|
13
|
-
rationaleEnabled: true,
|
|
14
|
-
shapes: { rectangles: [], polygons: [], circles: [] },
|
|
15
|
-
strokeWidth: 5,
|
|
16
|
-
studentInstructionsEnabled: true,
|
|
17
|
-
teacherInstructions: '',
|
|
18
|
-
teacherInstructionsEnabled: true,
|
|
19
|
-
toolbarEditorPosition: 'bottom',
|
|
20
|
-
},
|
|
21
|
-
configuration: {
|
|
22
|
-
baseInputConfiguration: {
|
|
23
|
-
h3: { disabled: true },
|
|
24
|
-
audio: { disabled: false },
|
|
25
|
-
video: { disabled: false },
|
|
26
|
-
image: { disabled: false },
|
|
27
|
-
textAlign: { disabled: true },
|
|
28
|
-
showParagraphs: { disabled: false },
|
|
29
|
-
separateParagraphs: { disabled: true },
|
|
30
|
-
},
|
|
31
|
-
multipleCorrect: {
|
|
32
|
-
settings: true,
|
|
33
|
-
label: 'Multiple Correct Responses',
|
|
34
|
-
},
|
|
35
|
-
partialScoring: {
|
|
36
|
-
settings: false,
|
|
37
|
-
label: 'Allow Partial Scoring',
|
|
38
|
-
},
|
|
39
|
-
rationale: {
|
|
40
|
-
settings: true,
|
|
41
|
-
label: 'Rationale',
|
|
42
|
-
inputConfiguration: {
|
|
43
|
-
audio: { disabled: false },
|
|
44
|
-
video: { disabled: false },
|
|
45
|
-
image: { disabled: false },
|
|
46
|
-
},
|
|
47
|
-
required: false,
|
|
48
|
-
},
|
|
49
|
-
prompt: {
|
|
50
|
-
settings: true,
|
|
51
|
-
label: 'Prompt',
|
|
52
|
-
inputConfiguration: {
|
|
53
|
-
audio: { disabled: false },
|
|
54
|
-
video: { disabled: false },
|
|
55
|
-
image: { disabled: false },
|
|
56
|
-
},
|
|
57
|
-
required: false,
|
|
58
|
-
},
|
|
59
|
-
settingsPanelDisabled: false,
|
|
60
|
-
spellCheck: {
|
|
61
|
-
label: 'Spellcheck',
|
|
62
|
-
settings: false,
|
|
63
|
-
enabled: true,
|
|
64
|
-
},
|
|
65
|
-
teacherInstructions: {
|
|
66
|
-
settings: true,
|
|
67
|
-
label: 'Teacher Instructions',
|
|
68
|
-
inputConfiguration: {
|
|
69
|
-
audio: { disabled: false },
|
|
70
|
-
video: { disabled: false },
|
|
71
|
-
image: { disabled: false },
|
|
72
|
-
},
|
|
73
|
-
required: false,
|
|
74
|
-
},
|
|
75
|
-
preserveAspectRatio: {
|
|
76
|
-
settings: false,
|
|
77
|
-
enabled: true,
|
|
78
|
-
label: 'Preserve aspect ratio',
|
|
79
|
-
},
|
|
80
|
-
minShapes: 2,
|
|
81
|
-
maxImageWidth: {
|
|
82
|
-
teacherInstructions: 300,
|
|
83
|
-
prompt: 300,
|
|
84
|
-
rationale: 300,
|
|
85
|
-
},
|
|
86
|
-
maxImageHeight: {
|
|
87
|
-
teacherInstructions: 300,
|
|
88
|
-
prompt: 300,
|
|
89
|
-
rationale: 300,
|
|
90
|
-
},
|
|
91
|
-
withRubric: {
|
|
92
|
-
settings: false,
|
|
93
|
-
label: 'Add Rubric',
|
|
94
|
-
},
|
|
95
|
-
mathMlOptions: {
|
|
96
|
-
mmlOutput: false,
|
|
97
|
-
mmlEditing: false,
|
|
98
|
-
},
|
|
99
|
-
language: {
|
|
100
|
-
settings: false,
|
|
101
|
-
label: 'Specify Language',
|
|
102
|
-
enabled: false,
|
|
103
|
-
},
|
|
104
|
-
languageChoices: {
|
|
105
|
-
label: 'Language Choices',
|
|
106
|
-
options: [],
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
};
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Circle, Group, Transformer } from 'react-konva';
|
|
4
|
-
import DeleteWidget from './DeleteWidget';
|
|
5
|
-
|
|
6
|
-
class CircleComponent extends React.Component {
|
|
7
|
-
constructor(props) {
|
|
8
|
-
super(props);
|
|
9
|
-
this.state = {
|
|
10
|
-
hovered: false,
|
|
11
|
-
isDragging: false,
|
|
12
|
-
};
|
|
13
|
-
this.shapeRef = React.createRef();
|
|
14
|
-
this.trRef = React.createRef();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
handleClick = (e) => {
|
|
18
|
-
const { radius, isDrawing, onClick, id } = this.props;
|
|
19
|
-
if (radius <= 0 && isDrawing) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
e.cancelBubble = true;
|
|
23
|
-
onClick(id);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
handleMouseEnter = () => {
|
|
27
|
-
document.body.style.cursor = 'pointer';
|
|
28
|
-
this.setState({ hovered: true });
|
|
29
|
-
this.trRef.current.setNode(this.shapeRef.current);
|
|
30
|
-
this.trRef.current.getLayer().batchDraw();
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
handleMouseLeave = () => {
|
|
34
|
-
// Don't hide transformer if user is actively dragging/resizing
|
|
35
|
-
if (!this.state.isDragging) {
|
|
36
|
-
this.setState({ hovered: false });
|
|
37
|
-
}
|
|
38
|
-
document.body.style.cursor = 'default';
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
handleOnDragEnd = (e) => {
|
|
42
|
-
const { onDragEnd, id } = this.props;
|
|
43
|
-
this.setState({ isDragging: false });
|
|
44
|
-
onDragEnd(id, {
|
|
45
|
-
x: e.target.x(),
|
|
46
|
-
y: e.target.y(),
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
onResizeEnd = () => {
|
|
51
|
-
const { onDragEnd, id } = this.props;
|
|
52
|
-
const node = this.shapeRef.current;
|
|
53
|
-
|
|
54
|
-
const scale = node.scaleX() !== 1 ? node.scaleX() : node.scaleY();
|
|
55
|
-
const newRadius = Math.max(node.radius() * scale, 5);
|
|
56
|
-
|
|
57
|
-
this.setState({ isDragging: false });
|
|
58
|
-
onDragEnd(id, {
|
|
59
|
-
x: node.x(),
|
|
60
|
-
y: node.y(),
|
|
61
|
-
radius: newRadius,
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
node.scaleX(1);
|
|
65
|
-
node.scaleY(1);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
handleDelete = (id) => {
|
|
69
|
-
const { onDeleteShape } = this.props;
|
|
70
|
-
onDeleteShape(id);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
onTransform = () => {
|
|
74
|
-
const node = this.shapeRef.current;
|
|
75
|
-
const avgScale = (node.scaleX() + node.scaleY()) / 2;
|
|
76
|
-
node.scaleX(avgScale);
|
|
77
|
-
node.scaleY(avgScale);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
render() {
|
|
81
|
-
const {
|
|
82
|
-
correct,
|
|
83
|
-
radius,
|
|
84
|
-
hotspotColor,
|
|
85
|
-
id,
|
|
86
|
-
outlineColor,
|
|
87
|
-
x,
|
|
88
|
-
y,
|
|
89
|
-
strokeWidth = 5,
|
|
90
|
-
selectedHotspotColor,
|
|
91
|
-
hoverOutlineColor,
|
|
92
|
-
} = this.props;
|
|
93
|
-
|
|
94
|
-
const { hovered, isDragging } = this.state;
|
|
95
|
-
// Ensure radius is valid
|
|
96
|
-
const validRadius = isNaN(radius) || radius <= 0 ? 5 : radius;
|
|
97
|
-
|
|
98
|
-
return (
|
|
99
|
-
<Group onMouseLeave={this.handleMouseLeave} onMouseEnter={this.handleMouseEnter} padding={12}>
|
|
100
|
-
<Circle
|
|
101
|
-
ref={this.shapeRef}
|
|
102
|
-
radius={validRadius}
|
|
103
|
-
fill={correct && selectedHotspotColor ? selectedHotspotColor : hotspotColor}
|
|
104
|
-
onClick={this.handleClick}
|
|
105
|
-
onTap={this.handleClick}
|
|
106
|
-
draggable
|
|
107
|
-
stroke={outlineColor}
|
|
108
|
-
strokeWidth={correct ? strokeWidth : 0}
|
|
109
|
-
onDragStart={() => this.setState({ isDragging: true })}
|
|
110
|
-
onDragEnd={this.handleOnDragEnd}
|
|
111
|
-
onTransformStart={() => this.setState({ isDragging: true })}
|
|
112
|
-
onTransformEnd={this.onResizeEnd}
|
|
113
|
-
x={x}
|
|
114
|
-
y={y}
|
|
115
|
-
cursor="pointer"
|
|
116
|
-
/>
|
|
117
|
-
|
|
118
|
-
{!isDragging && hovered && (
|
|
119
|
-
<DeleteWidget
|
|
120
|
-
id={id}
|
|
121
|
-
radius={validRadius}
|
|
122
|
-
x={x}
|
|
123
|
-
y={y}
|
|
124
|
-
handleWidgetClick={this.handleDelete}
|
|
125
|
-
isCircle={true}
|
|
126
|
-
/>
|
|
127
|
-
)}
|
|
128
|
-
{this.state.hovered && (
|
|
129
|
-
<Transformer
|
|
130
|
-
borderStroke={hoverOutlineColor || null}
|
|
131
|
-
ref={this.trRef}
|
|
132
|
-
rotateEnabled={false}
|
|
133
|
-
keepRatio={true}
|
|
134
|
-
onTransform={this.onTransform}
|
|
135
|
-
enabledAnchors={['middle-left', 'middle-right', 'top-center', 'bottom-center']}
|
|
136
|
-
boundBoxFunc={(oldBox, newBox) => {
|
|
137
|
-
// Constraint to prevent resizing too small
|
|
138
|
-
if (newBox.width < 10 || newBox.height < 10) {
|
|
139
|
-
return oldBox;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const oldCenterX = oldBox.x + oldBox.width / 2;
|
|
143
|
-
const oldCenterY = oldBox.y + oldBox.height / 2;
|
|
144
|
-
const newCenterX = newBox.x + newBox.width / 2;
|
|
145
|
-
const newCenterY = newBox.y + newBox.height / 2;
|
|
146
|
-
|
|
147
|
-
const offsetX = oldCenterX - newCenterX;
|
|
148
|
-
const offsetY = oldCenterY - newCenterY;
|
|
149
|
-
|
|
150
|
-
newBox.x += offsetX;
|
|
151
|
-
newBox.y += offsetY;
|
|
152
|
-
|
|
153
|
-
return newBox;
|
|
154
|
-
}}
|
|
155
|
-
/>
|
|
156
|
-
)}
|
|
157
|
-
</Group>
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
CircleComponent.propTypes = {
|
|
163
|
-
correct: PropTypes.bool,
|
|
164
|
-
isDrawing: PropTypes.bool.isRequired,
|
|
165
|
-
id: PropTypes.string.isRequired,
|
|
166
|
-
radius: PropTypes.number.isRequired,
|
|
167
|
-
hotspotColor: PropTypes.string.isRequired,
|
|
168
|
-
selectedHotspotColor: PropTypes.string,
|
|
169
|
-
hoverOutlineColor: PropTypes.string,
|
|
170
|
-
onClick: PropTypes.func.isRequired,
|
|
171
|
-
onDeleteShape: PropTypes.func.isRequired,
|
|
172
|
-
onDragEnd: PropTypes.func.isRequired,
|
|
173
|
-
outlineColor: PropTypes.string.isRequired,
|
|
174
|
-
x: PropTypes.number.isRequired,
|
|
175
|
-
y: PropTypes.number.isRequired,
|
|
176
|
-
strokeWidth: PropTypes.number,
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
CircleComponent.defaultProps = {
|
|
180
|
-
correct: false,
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
export default CircleComponent;
|
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import { styled } from '@mui/material/styles';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import Button from './button';
|
|
5
|
-
import { CircleButton } from './buttons/circle';
|
|
6
|
-
import { PolygonButton } from './buttons/polygon';
|
|
7
|
-
import { RectangleButton } from './buttons/rectangle';
|
|
8
|
-
import { SUPPORTED_SHAPES } from './shapes';
|
|
9
|
-
import Drawable from './hotspot-drawable';
|
|
10
|
-
import UploadControl from './upload-control';
|
|
11
|
-
import { getAllShapes, groupShapes } from './utils';
|
|
12
|
-
|
|
13
|
-
const BaseContainer = styled('div')(({ theme }) => ({
|
|
14
|
-
marginTop: theme.spacing(1.5),
|
|
15
|
-
marginBottom: theme.spacing(2.5),
|
|
16
|
-
}));
|
|
17
|
-
|
|
18
|
-
const BoxContainer = styled('div')(({ theme, hasErrors, dropzoneActive }) => ({
|
|
19
|
-
border: '1px solid #E0E1E6',
|
|
20
|
-
borderRadius: '5px',
|
|
21
|
-
...(dropzoneActive && {
|
|
22
|
-
border: '1px solid #0032C2',
|
|
23
|
-
}),
|
|
24
|
-
...(hasErrors && !dropzoneActive && {
|
|
25
|
-
border: `1px solid ${theme.palette.error.main}`,
|
|
26
|
-
}),
|
|
27
|
-
}));
|
|
28
|
-
|
|
29
|
-
const ButtonShape = styled('div')({
|
|
30
|
-
marginRight: '5px',
|
|
31
|
-
'&:hover': {
|
|
32
|
-
cursor: 'pointer',
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const CenteredContainer = styled('div')({
|
|
37
|
-
alignItems: 'center',
|
|
38
|
-
display: 'flex',
|
|
39
|
-
flexDirection: 'column',
|
|
40
|
-
justifyContent: 'center',
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
const DrawableHeight = styled('div')(({ theme }) => ({
|
|
44
|
-
minHeight: 350,
|
|
45
|
-
paddingBottom: theme.spacing(5),
|
|
46
|
-
paddingRight: theme.spacing(5),
|
|
47
|
-
}));
|
|
48
|
-
|
|
49
|
-
const Toolbar = styled('div')(({ theme }) => ({
|
|
50
|
-
backgroundColor: '#FFF',
|
|
51
|
-
borderBottom: '1px solid #E0E1E6',
|
|
52
|
-
borderTopLeftRadius: '5px',
|
|
53
|
-
borderTopRightRadius: '5px',
|
|
54
|
-
display: 'flex',
|
|
55
|
-
justifyContent: 'flex-end',
|
|
56
|
-
padding: theme.spacing(1),
|
|
57
|
-
}));
|
|
58
|
-
|
|
59
|
-
const ReplaceSection = styled('div')({
|
|
60
|
-
marginRight: 'auto',
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
const isImage = (file) => {
|
|
64
|
-
const imageType = /image.*/;
|
|
65
|
-
|
|
66
|
-
return file.type.match(imageType);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export class Container extends Component {
|
|
70
|
-
static getDerivedStateFromProps(nextProps, prevState) {
|
|
71
|
-
// always transform shapes map into shapes array at this level
|
|
72
|
-
return {
|
|
73
|
-
...prevState,
|
|
74
|
-
shapes: getAllShapes(nextProps.shapes),
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
constructor(props) {
|
|
79
|
-
super(props);
|
|
80
|
-
|
|
81
|
-
this.state = {
|
|
82
|
-
dragEnabled: true,
|
|
83
|
-
// always transform shapes map into shapes array at this level
|
|
84
|
-
shapes: getAllShapes(props.shapes),
|
|
85
|
-
selectedShape: SUPPORTED_SHAPES.NONE,
|
|
86
|
-
};
|
|
87
|
-
this.fakeImageHandler = {
|
|
88
|
-
cancel: () => {},
|
|
89
|
-
done: (a, url) => this.props.onImageUpload(url),
|
|
90
|
-
fileChosen: () => {},
|
|
91
|
-
progress: () => {},
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
handleFileRead = (file) => {
|
|
96
|
-
if (file instanceof Blob) {
|
|
97
|
-
const { onImageUpload, insertImage } = this.props;
|
|
98
|
-
const reader = new FileReader();
|
|
99
|
-
|
|
100
|
-
reader.onloadend = () => onImageUpload(reader.result);
|
|
101
|
-
reader.readAsDataURL(file);
|
|
102
|
-
|
|
103
|
-
if (insertImage) {
|
|
104
|
-
insertImage({
|
|
105
|
-
...this.fakeImageHandler,
|
|
106
|
-
getChosenFile: () => file,
|
|
107
|
-
isPasted: true,
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
enableDropzone = () => this.setState({ dropzoneActive: true });
|
|
113
|
-
|
|
114
|
-
disableDropzone = () => this.setState({ dropzoneActive: false });
|
|
115
|
-
|
|
116
|
-
handleOnPaste = (e) => {
|
|
117
|
-
const { files } = e.clipboardData;
|
|
118
|
-
|
|
119
|
-
if (files && isImage(files[0])) {
|
|
120
|
-
this.handleFileRead(files[0]);
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
handleOnDrop = (e) => {
|
|
125
|
-
e.preventDefault();
|
|
126
|
-
|
|
127
|
-
const { items, files } = e.dataTransfer;
|
|
128
|
-
|
|
129
|
-
if (items && items[0].kind === 'file') {
|
|
130
|
-
const file = items[0].getAsFile();
|
|
131
|
-
|
|
132
|
-
if (isImage(file)) {
|
|
133
|
-
this.handleFileRead(file);
|
|
134
|
-
}
|
|
135
|
-
} else if (isImage(files[0])) {
|
|
136
|
-
this.handleFileRead(files[0]);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
this.disableDropzone();
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
handleOnDragOver = (e) => {
|
|
143
|
-
e.preventDefault();
|
|
144
|
-
|
|
145
|
-
const { dropzoneActive } = this.state;
|
|
146
|
-
|
|
147
|
-
if (!dropzoneActive) {
|
|
148
|
-
this.enableDropzone();
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
handleOnDragExit = (e) => {
|
|
153
|
-
e.preventDefault();
|
|
154
|
-
|
|
155
|
-
this.disableDropzone();
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
onUpdateShapes = (newShapes) => {
|
|
159
|
-
const { onUpdateShapes } = this.props;
|
|
160
|
-
this.setState(
|
|
161
|
-
{ shapes: newShapes },
|
|
162
|
-
// always transform shapes array back into shapes map when saving changes
|
|
163
|
-
() => onUpdateShapes(groupShapes(newShapes)),
|
|
164
|
-
);
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
onDeleteShape = (id) => {
|
|
168
|
-
const { shapes } = this.state;
|
|
169
|
-
if (shapes && shapes.length) {
|
|
170
|
-
// filter the deleted shape out
|
|
171
|
-
let newShapes = shapes.filter((shape) => shape.id !== id);
|
|
172
|
-
this.onUpdateShapes(newShapes);
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
handleClearAll = () => this.onUpdateShapes([]);
|
|
177
|
-
|
|
178
|
-
handleEnableDrag = () => this.setState({ dragEnabled: true });
|
|
179
|
-
|
|
180
|
-
handleDisableDrag = () => this.setState({ dragEnabled: false });
|
|
181
|
-
|
|
182
|
-
handleInputClick = () => {
|
|
183
|
-
const { insertImage } = this.props;
|
|
184
|
-
|
|
185
|
-
if (insertImage) {
|
|
186
|
-
insertImage(this.fakeImageHandler);
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
handleFinishDrawing = () => {
|
|
191
|
-
// Explicitly end the current shape drawing session
|
|
192
|
-
// This would cause the finalizeCreation method to be called in the HotspotDrawable component
|
|
193
|
-
this.setState({ selectedShape: SUPPORTED_SHAPES.NONE });
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
render() {
|
|
197
|
-
const {
|
|
198
|
-
dimensions,
|
|
199
|
-
hasErrors,
|
|
200
|
-
hotspotColor,
|
|
201
|
-
imageUrl,
|
|
202
|
-
multipleCorrect,
|
|
203
|
-
onUpdateImageDimension,
|
|
204
|
-
outlineColor,
|
|
205
|
-
strokeWidth,
|
|
206
|
-
preserveAspectRatioEnabled,
|
|
207
|
-
hoverOutlineColor,
|
|
208
|
-
selectedHotspotColor,
|
|
209
|
-
} = this.props;
|
|
210
|
-
|
|
211
|
-
const { dropzoneActive, dragEnabled } = this.state;
|
|
212
|
-
const { shapes, selectedShape } = this.state;
|
|
213
|
-
|
|
214
|
-
return (
|
|
215
|
-
<BaseContainer>
|
|
216
|
-
<BoxContainer
|
|
217
|
-
hasErrors={hasErrors}
|
|
218
|
-
dropzoneActive={dropzoneActive}
|
|
219
|
-
{...(dragEnabled
|
|
220
|
-
? {
|
|
221
|
-
onDragExit: this.handleOnDragExit,
|
|
222
|
-
onDragLeave: this.handleOnDragExit,
|
|
223
|
-
onDragOver: this.handleOnDragOver,
|
|
224
|
-
onDrop: this.handleOnDrop,
|
|
225
|
-
onPaste: this.handleOnPaste,
|
|
226
|
-
}
|
|
227
|
-
: {})}
|
|
228
|
-
>
|
|
229
|
-
<Toolbar>
|
|
230
|
-
<ButtonShape
|
|
231
|
-
onClick={() => this.setState({ selectedShape: selectedShape === SUPPORTED_SHAPES.RECTANGLE ? SUPPORTED_SHAPES.NONE : SUPPORTED_SHAPES.RECTANGLE })}
|
|
232
|
-
>
|
|
233
|
-
<RectangleButton isActive={selectedShape === SUPPORTED_SHAPES.RECTANGLE} />
|
|
234
|
-
</ButtonShape>
|
|
235
|
-
<ButtonShape
|
|
236
|
-
onClick={() => this.setState({ selectedShape: selectedShape === SUPPORTED_SHAPES.POLYGON ? SUPPORTED_SHAPES.NONE : SUPPORTED_SHAPES.POLYGON })}
|
|
237
|
-
>
|
|
238
|
-
<PolygonButton isActive={selectedShape === SUPPORTED_SHAPES.POLYGON} />
|
|
239
|
-
</ButtonShape>
|
|
240
|
-
<ButtonShape
|
|
241
|
-
onClick={() => this.setState({ selectedShape: selectedShape === SUPPORTED_SHAPES.CIRCLE ? SUPPORTED_SHAPES.NONE : SUPPORTED_SHAPES.CIRCLE })}
|
|
242
|
-
>
|
|
243
|
-
<CircleButton isActive={selectedShape === SUPPORTED_SHAPES.CIRCLE} />
|
|
244
|
-
</ButtonShape>
|
|
245
|
-
|
|
246
|
-
{imageUrl && (
|
|
247
|
-
<ReplaceSection>
|
|
248
|
-
<UploadControl
|
|
249
|
-
label="Replace Image"
|
|
250
|
-
onInputClick={this.handleInputClick}
|
|
251
|
-
setRef={(ref) => {
|
|
252
|
-
this.input = ref;
|
|
253
|
-
}}
|
|
254
|
-
/>
|
|
255
|
-
</ReplaceSection>
|
|
256
|
-
)}
|
|
257
|
-
<Button disabled={!(shapes && shapes.length)} onClick={this.handleClearAll} label="Clear all" />
|
|
258
|
-
</Toolbar>
|
|
259
|
-
|
|
260
|
-
<DrawableHeight
|
|
261
|
-
ref={(ref) => {
|
|
262
|
-
this.imageSection = ref;
|
|
263
|
-
}}
|
|
264
|
-
>
|
|
265
|
-
{imageUrl ? (
|
|
266
|
-
<Drawable
|
|
267
|
-
dimensions={dimensions}
|
|
268
|
-
disableDrag={this.handleDisableDrag}
|
|
269
|
-
enableDrag={this.handleEnableDrag}
|
|
270
|
-
shapeType={this.state.selectedShape}
|
|
271
|
-
handleFinishDrawing={this.handleFinishDrawing}
|
|
272
|
-
imageUrl={imageUrl}
|
|
273
|
-
hotspotColor={hotspotColor}
|
|
274
|
-
selectedHotspotColor={selectedHotspotColor}
|
|
275
|
-
hoverOutlineColor={hoverOutlineColor}
|
|
276
|
-
multipleCorrect={multipleCorrect}
|
|
277
|
-
onUpdateImageDimension={onUpdateImageDimension}
|
|
278
|
-
onUpdateShapes={this.onUpdateShapes}
|
|
279
|
-
onDeleteShape={this.onDeleteShape}
|
|
280
|
-
outlineColor={outlineColor}
|
|
281
|
-
shapes={shapes}
|
|
282
|
-
strokeWidth={strokeWidth}
|
|
283
|
-
preserveAspectRatioEnabled={preserveAspectRatioEnabled}
|
|
284
|
-
/>
|
|
285
|
-
) : (
|
|
286
|
-
<CenteredContainer>
|
|
287
|
-
<label>Drag and drop or upload image from computer</label>
|
|
288
|
-
<br />
|
|
289
|
-
<UploadControl
|
|
290
|
-
label="Upload Image"
|
|
291
|
-
onInputClick={this.handleInputClick}
|
|
292
|
-
setRef={(ref) => {
|
|
293
|
-
this.input = ref;
|
|
294
|
-
}}
|
|
295
|
-
/>
|
|
296
|
-
</CenteredContainer>
|
|
297
|
-
)}
|
|
298
|
-
</DrawableHeight>
|
|
299
|
-
</BoxContainer>
|
|
300
|
-
</BaseContainer>
|
|
301
|
-
);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
Container.propTypes = {
|
|
306
|
-
dimensions: PropTypes.object.isRequired,
|
|
307
|
-
imageUrl: PropTypes.string.isRequired,
|
|
308
|
-
hotspotColor: PropTypes.string.isRequired,
|
|
309
|
-
selectedHotspotColor: PropTypes.string,
|
|
310
|
-
hoverOutlineColor: PropTypes.string,
|
|
311
|
-
multipleCorrect: PropTypes.bool.isRequired,
|
|
312
|
-
onImageUpload: PropTypes.func.isRequired,
|
|
313
|
-
onUpdateImageDimension: PropTypes.func.isRequired,
|
|
314
|
-
insertImage: PropTypes.func,
|
|
315
|
-
onUpdateShapes: PropTypes.func.isRequired,
|
|
316
|
-
outlineColor: PropTypes.string.isRequired,
|
|
317
|
-
shapes: PropTypes.shape({
|
|
318
|
-
rectangles: PropTypes.array,
|
|
319
|
-
polygons: PropTypes.array,
|
|
320
|
-
}).isRequired,
|
|
321
|
-
strokeWidth: PropTypes.number,
|
|
322
|
-
preserveAspectRatioEnabled: PropTypes.bool,
|
|
323
|
-
hasErrors: PropTypes.bool,
|
|
324
|
-
};
|
|
325
|
-
|
|
326
|
-
Container.defaultProps = {
|
|
327
|
-
strokeWidth: 5,
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
export default Container;
|