@pie-element/hotspot 11.1.1-next.0 → 11.1.1-next.101
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/CHANGELOG.json +997 -0
- package/CHANGELOG.md +2210 -0
- package/LICENSE.md +5 -0
- package/README.md +1 -0
- package/configure/CHANGELOG.json +682 -0
- package/configure/CHANGELOG.md +1947 -0
- package/configure/lib/DeleteWidget.js +64 -0
- package/configure/lib/DeleteWidget.js.map +1 -0
- package/configure/lib/button.js +42 -0
- package/configure/lib/button.js.map +1 -0
- package/configure/lib/buttons/circle.js +33 -0
- package/configure/lib/buttons/circle.js.map +1 -0
- package/configure/lib/buttons/polygon.js +39 -0
- package/configure/lib/buttons/polygon.js.map +1 -0
- package/configure/lib/buttons/rectangle.js +39 -0
- package/configure/lib/buttons/rectangle.js.map +1 -0
- package/configure/lib/defaults.js +155 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/hotspot-circle.js +192 -0
- package/configure/lib/hotspot-circle.js.map +1 -0
- package/configure/lib/hotspot-container.js +320 -0
- package/configure/lib/hotspot-container.js.map +1 -0
- package/configure/lib/hotspot-drawable.js +519 -0
- package/configure/lib/hotspot-drawable.js.map +1 -0
- package/configure/lib/hotspot-palette.js +107 -0
- package/configure/lib/hotspot-palette.js.map +1 -0
- package/configure/lib/hotspot-polygon.js +293 -0
- package/configure/lib/hotspot-polygon.js.map +1 -0
- package/configure/lib/hotspot-rectangle.js +190 -0
- package/configure/lib/hotspot-rectangle.js.map +1 -0
- package/configure/lib/icons.js +7 -0
- package/configure/lib/icons.js.map +1 -0
- package/configure/lib/image-konva.js +66 -0
- package/configure/lib/image-konva.js.map +1 -0
- package/configure/lib/index.js +198 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/root.js +331 -0
- package/configure/lib/root.js.map +1 -0
- package/configure/lib/shapes/circle.js +84 -0
- package/configure/lib/shapes/circle.js.map +1 -0
- package/configure/lib/shapes/index.js +50 -0
- package/configure/lib/shapes/index.js.map +1 -0
- package/configure/lib/shapes/polygon.js +82 -0
- package/configure/lib/shapes/polygon.js.map +1 -0
- package/configure/lib/shapes/rectagle.js +84 -0
- package/configure/lib/shapes/rectagle.js.map +1 -0
- package/configure/lib/shapes/utils.js +21 -0
- package/configure/lib/shapes/utils.js.map +1 -0
- package/configure/lib/upload-control.js +41 -0
- package/configure/lib/upload-control.js.map +1 -0
- package/configure/lib/utils.js +185 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +26 -0
- package/configure/src/DeleteWidget.jsx +51 -0
- package/configure/src/__tests__/DeleteWidget.test.jsx +366 -0
- package/configure/src/__tests__/button.test.jsx +198 -0
- package/configure/src/__tests__/hotspot-circle.test.jsx +259 -0
- package/configure/src/__tests__/hotspot-container.test.js +366 -0
- package/configure/src/__tests__/hotspot-drawable.test.js +271 -0
- package/configure/src/__tests__/hotspot-palette.test.jsx +71 -0
- package/configure/src/__tests__/image-konva.test.jsx +226 -0
- package/configure/src/__tests__/index.test.js +329 -0
- package/configure/src/__tests__/root.test.js +400 -0
- package/configure/src/__tests__/utils.test.js +241 -0
- package/configure/src/button.jsx +35 -0
- package/configure/src/buttons/circle.jsx +18 -0
- package/configure/src/buttons/polygon.jsx +29 -0
- package/configure/src/buttons/rectangle.jsx +29 -0
- package/configure/src/defaults.js +109 -0
- package/configure/src/hotspot-circle.jsx +183 -0
- package/configure/src/hotspot-container.jsx +330 -0
- package/configure/src/hotspot-drawable.jsx +527 -0
- package/configure/src/hotspot-palette.jsx +90 -0
- package/configure/src/hotspot-polygon.jsx +294 -0
- package/configure/src/hotspot-rectangle.jsx +169 -0
- package/configure/src/icons.js +5 -0
- package/configure/src/image-konva.jsx +63 -0
- package/configure/src/index.js +213 -0
- package/configure/src/root.jsx +342 -0
- package/configure/src/shapes/circle.js +81 -0
- package/configure/src/shapes/index.js +4 -0
- package/configure/src/shapes/polygon.js +81 -0
- package/configure/src/shapes/rectagle.js +82 -0
- package/configure/src/shapes/utils.js +16 -0
- package/configure/src/upload-control.jsx +33 -0
- package/configure/src/utils.js +210 -0
- package/controller/CHANGELOG.json +362 -0
- package/controller/CHANGELOG.md +1300 -0
- package/controller/lib/defaults.js +33 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +342 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/utils.js +32 -0
- package/controller/lib/utils.js.map +1 -0
- package/controller/package.json +18 -0
- package/controller/src/__tests__/index.test.js +419 -0
- package/controller/src/__tests__/utils.test.js +5 -0
- package/controller/src/defaults.js +19 -0
- package/controller/src/index.js +330 -0
- package/controller/src/utils.js +29 -0
- package/docs/config-schema.json +2023 -0
- package/docs/config-schema.json.md +1495 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +122 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +11 -0
- package/docs/pie-schema.json +1204 -0
- package/docs/pie-schema.json.md +851 -0
- package/lib/hotspot/circle.js +160 -0
- package/lib/hotspot/circle.js.map +1 -0
- package/lib/hotspot/container.js +291 -0
- package/lib/hotspot/container.js.map +1 -0
- package/lib/hotspot/icons.js +8 -0
- package/lib/hotspot/icons.js.map +1 -0
- package/lib/hotspot/image-konva-tooltip.js +86 -0
- package/lib/hotspot/image-konva-tooltip.js.map +1 -0
- package/lib/hotspot/index.js +174 -0
- package/lib/hotspot/index.js.map +1 -0
- package/lib/hotspot/polygon.js +207 -0
- package/lib/hotspot/polygon.js.map +1 -0
- package/lib/hotspot/rectangle.js +178 -0
- package/lib/hotspot/rectangle.js.map +1 -0
- package/lib/index.js +214 -0
- package/lib/index.js.map +1 -0
- package/lib/session-updater.js +42 -0
- package/lib/session-updater.js.map +1 -0
- package/package.json +20 -58
- package/src/__tests__/container.test.jsx +58 -0
- package/src/__tests__/index.test.js +123 -0
- package/src/__tests__/session-updater.test.jsx +69 -0
- package/src/hotspot/__tests__/circle.test.jsx +464 -0
- package/src/hotspot/__tests__/container.test.jsx +546 -0
- package/src/hotspot/__tests__/image-konva-tooltip.test.jsx +510 -0
- package/src/hotspot/__tests__/index.test.jsx +64 -0
- package/src/hotspot/__tests__/polygon.test.jsx +502 -0
- package/src/hotspot/__tests__/rectangle.test.jsx +418 -0
- package/src/hotspot/circle.jsx +154 -0
- package/src/hotspot/container.jsx +297 -0
- package/src/hotspot/icons.js +7 -0
- package/src/hotspot/image-konva-tooltip.jsx +76 -0
- package/src/hotspot/index.jsx +179 -0
- package/src/hotspot/polygon.jsx +197 -0
- package/src/hotspot/rectangle.jsx +172 -0
- package/src/index.js +227 -0
- package/src/session-updater.js +29 -0
- package/dist/author/DeleteWidget.d.ts +0 -38
- package/dist/author/DeleteWidget.js +0 -46
- package/dist/author/button.d.ts +0 -31
- package/dist/author/button.js +0 -27
- package/dist/author/buttons/circle.d.ts +0 -18
- package/dist/author/buttons/circle.js +0 -25
- package/dist/author/buttons/polygon.d.ts +0 -18
- package/dist/author/buttons/polygon.js +0 -36
- package/dist/author/buttons/rectangle.d.ts +0 -18
- package/dist/author/buttons/rectangle.js +0 -36
- package/dist/author/defaults.d.ts +0 -157
- package/dist/author/defaults.js +0 -119
- package/dist/author/hotspot-circle.d.ts +0 -21
- package/dist/author/hotspot-circle.js +0 -124
- package/dist/author/hotspot-container.d.ts +0 -29
- package/dist/author/hotspot-container.js +0 -210
- package/dist/author/hotspot-drawable.d.ts +0 -31
- package/dist/author/hotspot-drawable.js +0 -312
- package/dist/author/hotspot-palette.d.ts +0 -14
- package/dist/author/hotspot-palette.js +0 -72
- package/dist/author/hotspot-polygon.d.ts +0 -38
- package/dist/author/hotspot-polygon.js +0 -200
- package/dist/author/hotspot-rectangle.d.ts +0 -20
- package/dist/author/hotspot-rectangle.js +0 -119
- package/dist/author/icons.d.ts +0 -9
- package/dist/author/icons.js +0 -4
- package/dist/author/image-konva.d.ts +0 -19
- package/dist/author/image-konva.js +0 -49
- package/dist/author/index.d.ts +0 -52
- package/dist/author/index.js +0 -143
- package/dist/author/root.d.ts +0 -15
- package/dist/author/root.js +0 -215
- package/dist/author/shapes/circle.d.ts +0 -18
- package/dist/author/shapes/circle.js +0 -47
- package/dist/author/shapes/index.d.ts +0 -12
- package/dist/author/shapes/polygon.d.ts +0 -19
- package/dist/author/shapes/polygon.js +0 -51
- package/dist/author/shapes/rectagle.d.ts +0 -18
- package/dist/author/shapes/rectagle.js +0 -57
- package/dist/author/shapes/utils.d.ts +0 -19
- package/dist/author/shapes/utils.js +0 -16
- package/dist/author/upload-control.d.ts +0 -29
- package/dist/author/upload-control.js +0 -28
- package/dist/author/utils.d.ts +0 -24
- package/dist/author/utils.js +0 -83
- package/dist/controller/defaults.d.ts +0 -35
- package/dist/controller/defaults.js +0 -29
- package/dist/controller/index.d.ts +0 -22
- package/dist/controller/index.js +0 -154
- package/dist/controller/utils.d.ts +0 -10
- package/dist/controller/utils.js +0 -13
- package/dist/delivery/hotspot/circle.d.ts +0 -19
- package/dist/delivery/hotspot/circle.js +0 -100
- package/dist/delivery/hotspot/container.d.ts +0 -16
- package/dist/delivery/hotspot/container.js +0 -150
- package/dist/delivery/hotspot/icons.d.ts +0 -10
- package/dist/delivery/hotspot/icons.js +0 -4
- package/dist/delivery/hotspot/image-konva-tooltip.d.ts +0 -19
- package/dist/delivery/hotspot/image-konva-tooltip.js +0 -66
- package/dist/delivery/hotspot/index.d.ts +0 -17
- package/dist/delivery/hotspot/index.js +0 -114
- package/dist/delivery/hotspot/polygon.d.ts +0 -21
- package/dist/delivery/hotspot/polygon.js +0 -108
- package/dist/delivery/hotspot/rectangle.d.ts +0 -19
- package/dist/delivery/hotspot/rectangle.js +0 -104
- package/dist/delivery/index.d.ts +0 -20
- package/dist/delivery/index.js +0 -107
- package/dist/delivery/session-updater.d.ts +0 -10
- package/dist/delivery/session-updater.js +0 -14
- package/dist/index.d.ts +0 -1
- package/dist/index.iife.d.ts +0 -8
- package/dist/index.iife.js +0 -169
- package/dist/index.js +0 -2
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +0 -57
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js +0 -30
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js +0 -35
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js +0 -35
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js +0 -32
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +0 -23
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +0 -33
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +0 -21
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEqual.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +0 -6
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';
|
|
5
|
+
import { color, Collapsible, hasText, PreviewPrompt, UiLayout, hasMedia } from '@pie-lib/render-ui';
|
|
6
|
+
import { renderMath } from '@pie-lib/math-rendering';
|
|
7
|
+
import { styled } from '@mui/material/styles';
|
|
8
|
+
|
|
9
|
+
import Container from './container';
|
|
10
|
+
|
|
11
|
+
const StyledUiLayout = styled(UiLayout)({
|
|
12
|
+
color: color.text(),
|
|
13
|
+
backgroundColor: color.background(),
|
|
14
|
+
position: 'relative',
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const StyledCollapsible = styled(Collapsible)(({ theme }) => ({
|
|
18
|
+
marginBottom: theme.spacing(2),
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
class HotspotComponent extends React.Component {
|
|
22
|
+
constructor(props) {
|
|
23
|
+
super(props);
|
|
24
|
+
this.state = {
|
|
25
|
+
showCorrect: false,
|
|
26
|
+
observer: null,
|
|
27
|
+
scale: 1,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
componentDidMount() {
|
|
32
|
+
this.observer = new MutationObserver((mutations) => {
|
|
33
|
+
mutations.forEach(() => {
|
|
34
|
+
const target = document.getElementById('question-container')?.style?.cssText;
|
|
35
|
+
const zoom = target?.substring(target.indexOf('--pie-zoom') + 11, target.lastIndexOf('%'));
|
|
36
|
+
const zoomParsed = zoom?.replace(/\s/g, '');
|
|
37
|
+
|
|
38
|
+
if (zoomParsed) {
|
|
39
|
+
const newScale = parseFloat(zoomParsed) / 100;
|
|
40
|
+
|
|
41
|
+
if (newScale !== this.state.scale) {
|
|
42
|
+
this.setState({
|
|
43
|
+
scale: parseFloat(zoomParsed) / 100,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
} else if (!zoomParsed && this.state.scale !== 1) {
|
|
47
|
+
this.setState({
|
|
48
|
+
scale: 1,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const target = document.getElementById('question-container');
|
|
55
|
+
|
|
56
|
+
if (target) {
|
|
57
|
+
this.observer.observe(target, { attributes: true, attributeFilter: ['style'] });
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// eslint-disable-next-line react/no-find-dom-node
|
|
61
|
+
const domNode = ReactDOM.findDOMNode(this);
|
|
62
|
+
|
|
63
|
+
renderMath(domNode);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
componentDidUpdate() {
|
|
67
|
+
// eslint-disable-next-line react/no-find-dom-node
|
|
68
|
+
const domNode = ReactDOM.findDOMNode(this);
|
|
69
|
+
|
|
70
|
+
renderMath(domNode);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
componentWillUnmount() {
|
|
74
|
+
this.observer?.disconnect();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
onToggle = () => {
|
|
78
|
+
const { showCorrect } = this.state;
|
|
79
|
+
this.setState({ showCorrect: !showCorrect });
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
render() {
|
|
83
|
+
const {
|
|
84
|
+
session,
|
|
85
|
+
model: {
|
|
86
|
+
disabled,
|
|
87
|
+
extraCSSRules,
|
|
88
|
+
imageUrl,
|
|
89
|
+
prompt,
|
|
90
|
+
mode,
|
|
91
|
+
multipleCorrect,
|
|
92
|
+
shapes,
|
|
93
|
+
outlineColor,
|
|
94
|
+
hotspotColor,
|
|
95
|
+
hoverOutlineColor,
|
|
96
|
+
selectedHotspotColor,
|
|
97
|
+
dimensions,
|
|
98
|
+
rationale,
|
|
99
|
+
teacherInstructions,
|
|
100
|
+
strokeWidth,
|
|
101
|
+
responseCorrect,
|
|
102
|
+
language,
|
|
103
|
+
fontSizeFactor,
|
|
104
|
+
autoplayAudioEnabled,
|
|
105
|
+
customAudioButton,
|
|
106
|
+
},
|
|
107
|
+
onSelectChoice,
|
|
108
|
+
} = this.props;
|
|
109
|
+
const { showCorrect } = this.state;
|
|
110
|
+
const isEvaluateMode = mode === 'evaluate';
|
|
111
|
+
const isGatherMode = mode === 'gather';
|
|
112
|
+
const showCorrectAnswerToggle = isEvaluateMode && !responseCorrect;
|
|
113
|
+
const showRationale = rationale && (hasText(rationale) || hasMedia(rationale));
|
|
114
|
+
const showTeacherInstructions =
|
|
115
|
+
teacherInstructions && (hasText(teacherInstructions) || hasMedia(teacherInstructions));
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<StyledUiLayout extraCSSRules={extraCSSRules} id={'main-container'} fontSizeFactor={fontSizeFactor}>
|
|
119
|
+
{showTeacherInstructions && (
|
|
120
|
+
<StyledCollapsible labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}>
|
|
121
|
+
<PreviewPrompt className="prompt" prompt={teacherInstructions} />
|
|
122
|
+
</StyledCollapsible>
|
|
123
|
+
)}
|
|
124
|
+
|
|
125
|
+
{prompt && (
|
|
126
|
+
<PreviewPrompt
|
|
127
|
+
className="prompt"
|
|
128
|
+
prompt={prompt}
|
|
129
|
+
autoplayAudioEnabled={autoplayAudioEnabled}
|
|
130
|
+
customAudioButton={customAudioButton}
|
|
131
|
+
/>
|
|
132
|
+
)}
|
|
133
|
+
|
|
134
|
+
{showCorrectAnswerToggle && (
|
|
135
|
+
<CorrectAnswerToggle
|
|
136
|
+
show={showCorrectAnswerToggle}
|
|
137
|
+
toggled={showCorrect}
|
|
138
|
+
onToggle={this.onToggle.bind(this)}
|
|
139
|
+
language={language}
|
|
140
|
+
/>
|
|
141
|
+
)}
|
|
142
|
+
|
|
143
|
+
{imageUrl ? (
|
|
144
|
+
<Container
|
|
145
|
+
isEvaluateMode={isEvaluateMode}
|
|
146
|
+
session={session}
|
|
147
|
+
dimensions={dimensions}
|
|
148
|
+
imageUrl={imageUrl}
|
|
149
|
+
hotspotColor={hotspotColor}
|
|
150
|
+
hoverOutlineColor={isGatherMode ? hoverOutlineColor : undefined}
|
|
151
|
+
selectedHotspotColor={selectedHotspotColor}
|
|
152
|
+
multipleCorrect={multipleCorrect}
|
|
153
|
+
outlineColor={outlineColor}
|
|
154
|
+
onSelectChoice={onSelectChoice}
|
|
155
|
+
shapes={shapes}
|
|
156
|
+
disabled={disabled}
|
|
157
|
+
strokeWidth={strokeWidth}
|
|
158
|
+
scale={this.state.scale}
|
|
159
|
+
showCorrect={showCorrect}
|
|
160
|
+
/>
|
|
161
|
+
) : null}
|
|
162
|
+
|
|
163
|
+
{showRationale && (
|
|
164
|
+
<Collapsible labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}>
|
|
165
|
+
<PreviewPrompt className="prompt" prompt={rationale} />
|
|
166
|
+
</Collapsible>
|
|
167
|
+
)}
|
|
168
|
+
</StyledUiLayout>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
HotspotComponent.propTypes = {
|
|
174
|
+
model: PropTypes.object.isRequired,
|
|
175
|
+
onSelectChoice: PropTypes.func.isRequired,
|
|
176
|
+
session: PropTypes.object.isRequired,
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export default HotspotComponent;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Line, Group, Rect } from 'react-konva';
|
|
4
|
+
import ImageComponent from './image-konva-tooltip';
|
|
5
|
+
import { faCorrect, faWrong } from './icons';
|
|
6
|
+
|
|
7
|
+
class PolygonComponent extends React.Component {
|
|
8
|
+
constructor(props) {
|
|
9
|
+
super(props);
|
|
10
|
+
this.state = {
|
|
11
|
+
hovered: false,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getPolygonCenter = (points) => {
|
|
16
|
+
const x = points.map(({ x }) => x);
|
|
17
|
+
const y = points.map(({ y }) => y);
|
|
18
|
+
const minX = Math.min.apply(null, x);
|
|
19
|
+
const maxX = Math.max.apply(null, x);
|
|
20
|
+
const minY = Math.min.apply(null, y);
|
|
21
|
+
const maxY = Math.max.apply(null, y);
|
|
22
|
+
return [(minX + maxX) / 2, (minY + maxY) / 2];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
parsePointsForKonva = (points) => {
|
|
26
|
+
const parsedPoints = [];
|
|
27
|
+
points.forEach(({ x, y }) => {
|
|
28
|
+
parsedPoints.push(x);
|
|
29
|
+
parsedPoints.push(y);
|
|
30
|
+
});
|
|
31
|
+
return parsedPoints;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
handleClick = (e) => {
|
|
35
|
+
const { onClick, id, selected, disabled } = this.props;
|
|
36
|
+
|
|
37
|
+
if (!disabled) {
|
|
38
|
+
e.cancelBubble = true;
|
|
39
|
+
onClick({ id, selected: !selected, selector: 'Mouse' });
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
handleMouseEnter = () => {
|
|
44
|
+
const { disabled } = this.props;
|
|
45
|
+
|
|
46
|
+
if (!disabled) {
|
|
47
|
+
document.body.style.cursor = 'pointer';
|
|
48
|
+
}
|
|
49
|
+
this.setState({ hovered: true });
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
handleMouseLeave = () => {
|
|
53
|
+
document.body.style.cursor = 'default';
|
|
54
|
+
this.setState({ hovered: false });
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
getEvaluateOutlineColor = (isCorrect, markAsCorrect, outlineColor) =>
|
|
58
|
+
markAsCorrect ? 'green' : isCorrect ? outlineColor : 'red';
|
|
59
|
+
|
|
60
|
+
getOutlineWidth = (showCorrectEnabled, selected, markAsCorrect, strokeWidth) =>
|
|
61
|
+
markAsCorrect || (!markAsCorrect && !showCorrectEnabled && selected) ? strokeWidth : 0;
|
|
62
|
+
|
|
63
|
+
render() {
|
|
64
|
+
const {
|
|
65
|
+
hotspotColor,
|
|
66
|
+
isCorrect,
|
|
67
|
+
isEvaluateMode,
|
|
68
|
+
hoverOutlineColor,
|
|
69
|
+
outlineColor,
|
|
70
|
+
selected,
|
|
71
|
+
focused,
|
|
72
|
+
points,
|
|
73
|
+
evaluateText,
|
|
74
|
+
strokeWidth,
|
|
75
|
+
scale,
|
|
76
|
+
markAsCorrect,
|
|
77
|
+
selectedHotspotColor,
|
|
78
|
+
showCorrectEnabled,
|
|
79
|
+
} = this.props;
|
|
80
|
+
|
|
81
|
+
const { hovered } = this.state;
|
|
82
|
+
|
|
83
|
+
const outlineColorParsed = isEvaluateMode
|
|
84
|
+
? this.getEvaluateOutlineColor(isCorrect, markAsCorrect, outlineColor)
|
|
85
|
+
: outlineColor;
|
|
86
|
+
const outlineWidth = this.getOutlineWidth(showCorrectEnabled, selected, markAsCorrect, strokeWidth);
|
|
87
|
+
|
|
88
|
+
const pointsParsed = this.parsePointsForKonva(points);
|
|
89
|
+
const center = this.getPolygonCenter(points);
|
|
90
|
+
const iconX = center[0];
|
|
91
|
+
const iconY = center[1];
|
|
92
|
+
|
|
93
|
+
// "Show Correct Answer" Enabled:
|
|
94
|
+
// - Correctly Selected: white checkmark in green circle
|
|
95
|
+
// - Correctly Not Selected: none
|
|
96
|
+
// - Incorrectly Selected: none
|
|
97
|
+
// - Incorrectly Not Selected: white checkmark in green circle
|
|
98
|
+
// "Show Correct Answer" Disabled:
|
|
99
|
+
// - Correctly Selected:
|
|
100
|
+
// - white checkmark in green circle
|
|
101
|
+
// - heavy outline, as on “Gather”
|
|
102
|
+
// - Correctly Not Selected: none
|
|
103
|
+
// - Incorrectly Selected:
|
|
104
|
+
// - white "X" in red circle
|
|
105
|
+
// - heavy outline around the selection should appear in red
|
|
106
|
+
// - Incorrectly Not Selected: white "X" in red circle
|
|
107
|
+
let iconSrc;
|
|
108
|
+
|
|
109
|
+
if (showCorrectEnabled) {
|
|
110
|
+
if ((selected && isCorrect) || (!selected && !isCorrect)) {
|
|
111
|
+
iconSrc = faCorrect;
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
if (selected) {
|
|
115
|
+
if (isCorrect) {
|
|
116
|
+
iconSrc = faCorrect;
|
|
117
|
+
} else {
|
|
118
|
+
iconSrc = faWrong;
|
|
119
|
+
}
|
|
120
|
+
} else if (!isCorrect) {
|
|
121
|
+
iconSrc = faWrong;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const useHoveredStyle = (hovered || focused) && hoverOutlineColor;
|
|
125
|
+
|
|
126
|
+
const xValues = pointsParsed.filter((_, index) => index % 2 === 0); // Even indices are x-coordinates
|
|
127
|
+
const yValues = pointsParsed.filter((_, index) => index % 2 !== 0); // Odd indices are y-coordinates
|
|
128
|
+
|
|
129
|
+
const minX = Math.min(...xValues);
|
|
130
|
+
const maxX = Math.max(...xValues);
|
|
131
|
+
const minY = Math.min(...yValues);
|
|
132
|
+
const maxY = Math.max(...yValues);
|
|
133
|
+
|
|
134
|
+
const rectX = minX;
|
|
135
|
+
const rectY = minY;
|
|
136
|
+
const rectWidth = maxX - minX;
|
|
137
|
+
const rectHeight = maxY - minY;
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<Group scaleX={scale} scaleY={scale} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave}>
|
|
141
|
+
<Line
|
|
142
|
+
points={pointsParsed}
|
|
143
|
+
closed={true}
|
|
144
|
+
fill={selected && selectedHotspotColor ? selectedHotspotColor : hotspotColor}
|
|
145
|
+
onClick={this.handleClick}
|
|
146
|
+
onTap={this.handleClick}
|
|
147
|
+
draggable={false}
|
|
148
|
+
stroke={useHoveredStyle && !selected ? 'transparent' : outlineColorParsed}
|
|
149
|
+
strokeWidth={useHoveredStyle && !selected ? 0 : outlineWidth}
|
|
150
|
+
cursor="pointer"
|
|
151
|
+
position="relative"
|
|
152
|
+
/>
|
|
153
|
+
{useHoveredStyle && (
|
|
154
|
+
<Rect
|
|
155
|
+
x={rectX}
|
|
156
|
+
y={rectY}
|
|
157
|
+
width={rectWidth}
|
|
158
|
+
height={rectHeight}
|
|
159
|
+
stroke={hoverOutlineColor}
|
|
160
|
+
strokeWidth={strokeWidth}
|
|
161
|
+
listening={false}
|
|
162
|
+
/>
|
|
163
|
+
)}
|
|
164
|
+
{isEvaluateMode && iconSrc ? <ImageComponent src={iconSrc} x={iconX} y={iconY} tooltip={evaluateText} /> : null}
|
|
165
|
+
</Group>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
PolygonComponent.propTypes = {
|
|
171
|
+
hotspotColor: PropTypes.string.isRequired,
|
|
172
|
+
id: PropTypes.string.isRequired,
|
|
173
|
+
isCorrect: PropTypes.bool.isRequired,
|
|
174
|
+
isEvaluateMode: PropTypes.bool.isRequired,
|
|
175
|
+
hoverOutlineColor: PropTypes.string,
|
|
176
|
+
disabled: PropTypes.bool.isRequired,
|
|
177
|
+
focused: PropTypes.bool,
|
|
178
|
+
onClick: PropTypes.func.isRequired,
|
|
179
|
+
outlineColor: PropTypes.string.isRequired,
|
|
180
|
+
points: PropTypes.array.isRequired,
|
|
181
|
+
selected: PropTypes.bool.isRequired,
|
|
182
|
+
evaluateText: PropTypes.string,
|
|
183
|
+
selectedHotspotColor: PropTypes.string,
|
|
184
|
+
strokeWidth: PropTypes.number,
|
|
185
|
+
scale: PropTypes.number,
|
|
186
|
+
markAsCorrect: PropTypes.bool.isRequired,
|
|
187
|
+
showCorrectEnabled: PropTypes.bool.isRequired,
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
PolygonComponent.defaultProps = {
|
|
191
|
+
evaluateText: null,
|
|
192
|
+
focused: false,
|
|
193
|
+
strokeWidth: 5,
|
|
194
|
+
scale: 1,
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export default PolygonComponent;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Rect, Group } from 'react-konva';
|
|
4
|
+
import ImageComponent from './image-konva-tooltip';
|
|
5
|
+
import { faCorrect, faWrong } from './icons';
|
|
6
|
+
|
|
7
|
+
class RectComponent extends React.Component {
|
|
8
|
+
constructor(props) {
|
|
9
|
+
super(props);
|
|
10
|
+
this.state = {
|
|
11
|
+
hovered: false,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
handleClick = (e) => {
|
|
16
|
+
const { onClick, id, selected, disabled } = this.props;
|
|
17
|
+
|
|
18
|
+
if (!disabled) {
|
|
19
|
+
e.cancelBubble = true;
|
|
20
|
+
onClick({ id, selected: !selected, selector: 'Mouse' });
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
handleMouseEnter = () => {
|
|
25
|
+
const { disabled } = this.props;
|
|
26
|
+
|
|
27
|
+
if (!disabled) {
|
|
28
|
+
document.body.style.cursor = 'pointer';
|
|
29
|
+
}
|
|
30
|
+
this.setState({ hovered: true });
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
handleMouseLeave = () => {
|
|
34
|
+
document.body.style.cursor = 'default';
|
|
35
|
+
this.setState({ hovered: false });
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
getEvaluateOutlineColor = (isCorrect, markAsCorrect, outlineColor) =>
|
|
39
|
+
markAsCorrect ? 'green' : isCorrect ? outlineColor : 'red';
|
|
40
|
+
|
|
41
|
+
getOutlineWidth = (showCorrectEnabled, selected, markAsCorrect, strokeWidth) =>
|
|
42
|
+
markAsCorrect || (!markAsCorrect && !showCorrectEnabled && selected) ? strokeWidth : 0;
|
|
43
|
+
|
|
44
|
+
render() {
|
|
45
|
+
const {
|
|
46
|
+
height,
|
|
47
|
+
hotspotColor,
|
|
48
|
+
hoverOutlineColor,
|
|
49
|
+
selectedHotspotColor,
|
|
50
|
+
isCorrect,
|
|
51
|
+
isEvaluateMode,
|
|
52
|
+
outlineColor,
|
|
53
|
+
selected,
|
|
54
|
+
focused,
|
|
55
|
+
width,
|
|
56
|
+
x,
|
|
57
|
+
y,
|
|
58
|
+
evaluateText,
|
|
59
|
+
strokeWidth,
|
|
60
|
+
scale,
|
|
61
|
+
markAsCorrect,
|
|
62
|
+
showCorrectEnabled,
|
|
63
|
+
} = this.props;
|
|
64
|
+
const { hovered } = this.state;
|
|
65
|
+
|
|
66
|
+
const outlineColorParsed = isEvaluateMode
|
|
67
|
+
? this.getEvaluateOutlineColor(isCorrect, markAsCorrect, outlineColor)
|
|
68
|
+
: outlineColor;
|
|
69
|
+
|
|
70
|
+
const outlineWidth = this.getOutlineWidth(showCorrectEnabled, selected, markAsCorrect, strokeWidth);
|
|
71
|
+
|
|
72
|
+
const iconX = x + width / 2 - 10;
|
|
73
|
+
const iconY = y + height / 2 - 10;
|
|
74
|
+
|
|
75
|
+
// "Show Correct Answer" Enabled:
|
|
76
|
+
// - Correctly Selected: white checkmark in green circle
|
|
77
|
+
// - Correctly Not Selected: none
|
|
78
|
+
// - Incorrectly Selected: none
|
|
79
|
+
// - Incorrectly Not Selected: white checkmark in green circle
|
|
80
|
+
// "Show Correct Answer" Disabled:
|
|
81
|
+
// - Correctly Selected:
|
|
82
|
+
// - white checkmark in green circle
|
|
83
|
+
// - heavy outline, as on “Gather”
|
|
84
|
+
// - Correctly Not Selected: none
|
|
85
|
+
// - Incorrectly Selected:
|
|
86
|
+
// - white "X" in red circle
|
|
87
|
+
// - heavy outline around the selection should appear in red
|
|
88
|
+
// - Incorrectly Not Selected: white "X" in red circle
|
|
89
|
+
let iconSrc;
|
|
90
|
+
|
|
91
|
+
if (showCorrectEnabled) {
|
|
92
|
+
if ((selected && isCorrect) || (!selected && !isCorrect)) {
|
|
93
|
+
iconSrc = faCorrect;
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
if (selected) {
|
|
97
|
+
if (isCorrect) {
|
|
98
|
+
iconSrc = faCorrect;
|
|
99
|
+
} else {
|
|
100
|
+
iconSrc = faWrong;
|
|
101
|
+
}
|
|
102
|
+
} else if (!isCorrect) {
|
|
103
|
+
iconSrc = faWrong;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const useHoveredStyle = (hovered || focused) && hoverOutlineColor;
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<Group scaleX={scale} scaleY={scale} onMouseLeave={this.handleMouseLeave} onMouseEnter={this.handleMouseEnter}>
|
|
111
|
+
<Rect
|
|
112
|
+
x={x}
|
|
113
|
+
y={y}
|
|
114
|
+
width={width}
|
|
115
|
+
height={height}
|
|
116
|
+
fill={selected && selectedHotspotColor ? selectedHotspotColor : hotspotColor}
|
|
117
|
+
onClick={this.handleClick}
|
|
118
|
+
onTap={this.handleClick}
|
|
119
|
+
draggable={false}
|
|
120
|
+
stroke={useHoveredStyle && !selected ? 'transparent' : outlineColorParsed}
|
|
121
|
+
strokeWidth={useHoveredStyle && !selected ? 0 : outlineWidth}
|
|
122
|
+
cursor="pointer"
|
|
123
|
+
/>
|
|
124
|
+
{useHoveredStyle && (
|
|
125
|
+
<Rect
|
|
126
|
+
x={x}
|
|
127
|
+
y={y}
|
|
128
|
+
width={width}
|
|
129
|
+
height={height}
|
|
130
|
+
stroke={hoverOutlineColor}
|
|
131
|
+
strokeWidth={strokeWidth}
|
|
132
|
+
listening={false}
|
|
133
|
+
/>
|
|
134
|
+
)}
|
|
135
|
+
{isEvaluateMode && iconSrc ? <ImageComponent src={iconSrc} x={iconX} y={iconY} tooltip={evaluateText} /> : null}
|
|
136
|
+
</Group>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
RectComponent.propTypes = {
|
|
142
|
+
height: PropTypes.number.isRequired,
|
|
143
|
+
hotspotColor: PropTypes.string.isRequired,
|
|
144
|
+
id: PropTypes.string.isRequired,
|
|
145
|
+
isCorrect: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
146
|
+
isEvaluateMode: PropTypes.bool.isRequired,
|
|
147
|
+
hoverOutlineColor: PropTypes.string,
|
|
148
|
+
disabled: PropTypes.bool.isRequired,
|
|
149
|
+
focused: PropTypes.bool,
|
|
150
|
+
onClick: PropTypes.func.isRequired,
|
|
151
|
+
outlineColor: PropTypes.string.isRequired,
|
|
152
|
+
selected: PropTypes.bool.isRequired,
|
|
153
|
+
width: PropTypes.number.isRequired,
|
|
154
|
+
x: PropTypes.number.isRequired,
|
|
155
|
+
y: PropTypes.number.isRequired,
|
|
156
|
+
evaluateText: PropTypes.string,
|
|
157
|
+
strokeWidth: PropTypes.number,
|
|
158
|
+
scale: PropTypes.number,
|
|
159
|
+
selectedHotspotColor: PropTypes.string,
|
|
160
|
+
markAsCorrect: PropTypes.bool.isRequired,
|
|
161
|
+
showCorrectEnabled: PropTypes.bool.isRequired,
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
RectComponent.defaultProps = {
|
|
165
|
+
isCorrect: false,
|
|
166
|
+
evaluateText: null,
|
|
167
|
+
focused: false,
|
|
168
|
+
strokeWidth: 5,
|
|
169
|
+
scale: 1,
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
export default RectComponent;
|