@pie-element/hotspot 11.1.2-next.0 → 11.1.2-next.10
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/dist/author/hotspot-container.js +2 -2
- package/dist/author/hotspot-drawable.js +120 -120
- package/dist/author/hotspot-polygon.js +2 -2
- package/dist/author/index.d.ts +1 -0
- package/dist/author/index.js +5 -2
- package/dist/author/root.js +52 -52
- package/dist/author/utils.js +10 -10
- package/dist/browser/{ReactKonva-Z9-1H-UZ.js → ReactKonva-Cj44B3Ds.js} +3504 -3535
- package/dist/browser/ReactKonva-Cj44B3Ds.js.map +1 -0
- package/dist/browser/author/index.js +24223 -22027
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/{browser-CfnAFove.js → browser-D4gLESxz.js} +22 -6
- package/dist/browser/{browser-CfnAFove.js.map → browser-D4gLESxz.js.map} +1 -1
- package/dist/browser/controller/index.js +32 -32
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/delivery/index.js +628 -519
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/dist-CJeYAWp3.js +100 -0
- package/dist/browser/dist-CJeYAWp3.js.map +1 -0
- package/dist/controller/index.js +51 -51
- package/dist/controller/utils.d.ts +1 -1
- package/dist/controller/utils.js +2 -3
- package/dist/delivery/hotspot/circle.d.ts +3 -0
- package/dist/delivery/hotspot/circle.js +40 -27
- package/dist/delivery/hotspot/container.d.ts +5 -0
- package/dist/delivery/hotspot/container.js +163 -96
- package/dist/delivery/hotspot/index.d.ts +1 -0
- package/dist/delivery/hotspot/index.js +41 -36
- package/dist/delivery/hotspot/polygon.d.ts +3 -0
- package/dist/delivery/hotspot/polygon.js +39 -26
- package/dist/delivery/hotspot/rectangle.d.ts +3 -0
- package/dist/delivery/hotspot/rectangle.js +40 -28
- package/dist/delivery/index.js +3 -3
- package/dist/index.iife.js +40 -40
- package/dist/runtime-support.d.ts +12 -0
- package/dist/runtime-support.js +12 -0
- package/package.json +20 -17
- package/dist/browser/ReactKonva-Z9-1H-UZ.js.map +0 -1
- package/dist/browser/isEqual-D3CTSc6W.js +0 -601
- package/dist/browser/isEqual-D3CTSc6W.js.map +0 -1
- 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
|
@@ -19,118 +19,185 @@ var f = d(l, "Stage"), p = d(c, "Layer"), m = s("div")(({ theme: e }) => ({
|
|
|
19
19
|
position: "relative",
|
|
20
20
|
background: e.palette.common.white,
|
|
21
21
|
border: `${e.spacing(1)} solid ${e.palette.common.white}`,
|
|
22
|
-
width: "fit-content"
|
|
23
|
-
|
|
22
|
+
width: "fit-content",
|
|
23
|
+
maxWidth: "100%",
|
|
24
|
+
overflowX: "auto"
|
|
25
|
+
})), h = s("span")({
|
|
26
|
+
position: "absolute",
|
|
27
|
+
width: 1,
|
|
28
|
+
height: 1,
|
|
29
|
+
overflow: "hidden",
|
|
30
|
+
clip: "rect(0, 0, 0, 0)",
|
|
31
|
+
whiteSpace: "nowrap"
|
|
32
|
+
}), g = s("div")({
|
|
24
33
|
position: "relative",
|
|
25
34
|
width: "fit-content"
|
|
26
|
-
}),
|
|
35
|
+
}), _ = s("img")({
|
|
27
36
|
alignItems: "center",
|
|
28
37
|
display: "flex",
|
|
29
38
|
justifyContent: "center"
|
|
30
|
-
}),
|
|
39
|
+
}), v = s(f)({
|
|
31
40
|
left: 0,
|
|
32
41
|
top: 0,
|
|
33
42
|
position: "absolute"
|
|
34
|
-
}),
|
|
43
|
+
}), y = class extends r.Component {
|
|
44
|
+
constructor(e) {
|
|
45
|
+
super(e), this.state = { focusedShapeId: null };
|
|
46
|
+
}
|
|
35
47
|
isSelected(e) {
|
|
36
48
|
return !!this.props.session.answers.filter((t) => t.id === e.id)[0];
|
|
37
49
|
}
|
|
38
50
|
correctness = (e, t) => e ? t : !t;
|
|
39
51
|
getEvaluateText = (e, t) => t && e ? "Correctly\nselected" : t && !e ? "Should not have\nbeen selected" : !t && e ? "Should have\nbeen selected" : null;
|
|
52
|
+
getAllShapesSorted = () => {
|
|
53
|
+
let { shapes: { rectangles: e = [], polygons: t = [], circles: n = [] } } = this.props, r = [
|
|
54
|
+
...e.map((e) => ({
|
|
55
|
+
...e,
|
|
56
|
+
type: "rectangle"
|
|
57
|
+
})),
|
|
58
|
+
...t.map((e) => ({
|
|
59
|
+
...e,
|
|
60
|
+
type: "polygon"
|
|
61
|
+
})),
|
|
62
|
+
...n.map((e) => ({
|
|
63
|
+
...e,
|
|
64
|
+
type: "circle"
|
|
65
|
+
}))
|
|
66
|
+
];
|
|
67
|
+
return r.sort((e, t) => String(e.id).localeCompare(String(t.id), void 0, { numeric: !0 })), r;
|
|
68
|
+
};
|
|
69
|
+
handleShapeFocus = (e) => {
|
|
70
|
+
this.setState({ focusedShapeId: e });
|
|
71
|
+
};
|
|
72
|
+
handleShapeBlur = () => {
|
|
73
|
+
this.setState({ focusedShapeId: null });
|
|
74
|
+
};
|
|
75
|
+
handleShapeKeyDown = (e, t) => {
|
|
76
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
let { onSelectChoice: n, disabled: r } = this.props;
|
|
79
|
+
if (!r) {
|
|
80
|
+
let e = this.getAllShapesSorted().find((e) => e.id === t);
|
|
81
|
+
e && n({
|
|
82
|
+
id: t,
|
|
83
|
+
selected: !this.isSelected(e),
|
|
84
|
+
selector: "Keyboard"
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
40
89
|
render() {
|
|
41
|
-
let { dimensions: { width: r, height: i }, disabled: s, hotspotColor: c, hoverOutlineColor: l, selectedHotspotColor: u, imageUrl: d, isEvaluateMode: f, outlineColor:
|
|
90
|
+
let { dimensions: { width: r, height: i }, disabled: s, hotspotColor: c, hoverOutlineColor: l, selectedHotspotColor: u, imageUrl: d, isEvaluateMode: f, outlineColor: y, onSelectChoice: b, shapes: { rectangles: x = [], polygons: S = [], circles: C = [] }, scale: w, strokeWidth: T, showCorrect: E } = this.props, { focusedShapeId: D } = this.state, O = r * w, k = i * w, A = this.getAllShapesSorted();
|
|
42
91
|
return /* @__PURE__ */ o(m, {
|
|
43
|
-
style: { padding:
|
|
44
|
-
children: [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
92
|
+
style: { padding: T / 2 },
|
|
93
|
+
children: [
|
|
94
|
+
d ? /* @__PURE__ */ a(g, { children: /* @__PURE__ */ a(_, {
|
|
95
|
+
alt: "hotspot-image",
|
|
96
|
+
height: "auto",
|
|
97
|
+
src: d,
|
|
98
|
+
style: {
|
|
99
|
+
width: O,
|
|
100
|
+
height: k,
|
|
101
|
+
maxWidth: O,
|
|
102
|
+
maxHeight: k
|
|
103
|
+
}
|
|
104
|
+
}) }) : null,
|
|
105
|
+
/* @__PURE__ */ a(v, {
|
|
106
|
+
height: k + T,
|
|
107
|
+
width: O + T,
|
|
108
|
+
x: T / 2,
|
|
109
|
+
y: T / 2,
|
|
110
|
+
children: /* @__PURE__ */ o(p, { children: [
|
|
111
|
+
x.map((t) => {
|
|
112
|
+
let n = this.isSelected(t), r = f ? this.correctness(t.correct, n) : void 0, i = f ? this.getEvaluateText(t.correct, n) : null, o = !!(f && E && t.correct);
|
|
113
|
+
return /* @__PURE__ */ a(e, {
|
|
114
|
+
scale: w,
|
|
115
|
+
isEvaluateMode: f,
|
|
116
|
+
isCorrect: r,
|
|
117
|
+
evaluateText: i,
|
|
118
|
+
disabled: s,
|
|
119
|
+
selected: n,
|
|
120
|
+
height: t.height,
|
|
121
|
+
hotspotColor: c,
|
|
122
|
+
hoverOutlineColor: l,
|
|
123
|
+
selectedHotspotColor: u,
|
|
124
|
+
id: t.id,
|
|
125
|
+
onClick: b,
|
|
126
|
+
outlineColor: y,
|
|
127
|
+
width: t.width,
|
|
128
|
+
x: t.x,
|
|
129
|
+
y: t.y,
|
|
130
|
+
strokeWidth: T,
|
|
131
|
+
markAsCorrect: o,
|
|
132
|
+
showCorrectEnabled: E,
|
|
133
|
+
focused: D === t.id
|
|
134
|
+
}, t.id);
|
|
135
|
+
}),
|
|
136
|
+
S.map((e) => {
|
|
137
|
+
let n = this.isSelected(e), r = f ? this.correctness(e.correct, n) : void 0, i = f ? this.getEvaluateText(e.correct, n) : null, o = !!(f && E && e.correct);
|
|
138
|
+
return /* @__PURE__ */ a(t, {
|
|
139
|
+
scale: w,
|
|
140
|
+
isEvaluateMode: f,
|
|
141
|
+
isCorrect: !!r,
|
|
142
|
+
evaluateText: i,
|
|
143
|
+
disabled: s,
|
|
144
|
+
selected: n,
|
|
145
|
+
hotspotColor: c,
|
|
146
|
+
id: e.id,
|
|
147
|
+
onClick: b,
|
|
148
|
+
outlineColor: y,
|
|
149
|
+
points: e.points,
|
|
150
|
+
strokeWidth: T,
|
|
151
|
+
markAsCorrect: o,
|
|
152
|
+
selectedHotspotColor: u,
|
|
153
|
+
hoverOutlineColor: l,
|
|
154
|
+
showCorrectEnabled: E,
|
|
155
|
+
focused: D === e.id
|
|
156
|
+
}, e.id);
|
|
157
|
+
}),
|
|
158
|
+
C.map((e) => {
|
|
159
|
+
let t = this.isSelected(e), r = f ? this.correctness(e.correct, t) : void 0, i = f ? this.getEvaluateText(e.correct, t) : null, o = !!(f && E && e.correct);
|
|
160
|
+
return /* @__PURE__ */ a(n, {
|
|
161
|
+
scale: w,
|
|
162
|
+
isEvaluateMode: f,
|
|
163
|
+
isCorrect: r,
|
|
164
|
+
evaluateText: i,
|
|
165
|
+
disabled: s,
|
|
166
|
+
selected: t,
|
|
167
|
+
radius: e.radius,
|
|
168
|
+
hotspotColor: c,
|
|
169
|
+
id: e.id,
|
|
170
|
+
onClick: b,
|
|
171
|
+
outlineColor: y,
|
|
172
|
+
x: e.x,
|
|
173
|
+
y: e.y,
|
|
174
|
+
strokeWidth: T,
|
|
175
|
+
markAsCorrect: o,
|
|
176
|
+
selectedHotspotColor: u,
|
|
177
|
+
hoverOutlineColor: l,
|
|
178
|
+
showCorrectEnabled: E,
|
|
179
|
+
focused: D === e.id
|
|
180
|
+
}, e.id);
|
|
181
|
+
})
|
|
182
|
+
] })
|
|
183
|
+
}),
|
|
184
|
+
A.map((e) => {
|
|
185
|
+
let t = this.isSelected(e);
|
|
186
|
+
return /* @__PURE__ */ a(h, {
|
|
187
|
+
tabIndex: s ? -1 : 0,
|
|
188
|
+
role: "button",
|
|
189
|
+
"aria-label": e.ariaLabel || "",
|
|
190
|
+
"aria-pressed": t,
|
|
191
|
+
onFocus: () => this.handleShapeFocus(e.id),
|
|
192
|
+
onBlur: this.handleShapeBlur,
|
|
193
|
+
onKeyDown: (t) => this.handleShapeKeyDown(t, e.id)
|
|
194
|
+
}, `focus-${e.id}`);
|
|
195
|
+
})
|
|
196
|
+
]
|
|
130
197
|
});
|
|
131
198
|
}
|
|
132
199
|
};
|
|
133
|
-
|
|
200
|
+
y.propTypes = {
|
|
134
201
|
dimensions: i.object.isRequired,
|
|
135
202
|
disabled: i.bool.isRequired,
|
|
136
203
|
hotspotColor: i.string.isRequired,
|
|
@@ -145,6 +212,6 @@ v.propTypes = {
|
|
|
145
212
|
strokeWidth: i.number,
|
|
146
213
|
scale: i.number,
|
|
147
214
|
showCorrect: i.bool
|
|
148
|
-
},
|
|
215
|
+
}, y.defaultProps = { scale: 1 };
|
|
149
216
|
//#endregion
|
|
150
|
-
export {
|
|
217
|
+
export { y as Container, y as default };
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import e from "./container.js";
|
|
1
|
+
import { Container as e } from "./container.js";
|
|
2
2
|
import t from "react";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import l from "
|
|
6
|
-
import u from "
|
|
7
|
-
import
|
|
8
|
-
import
|
|
3
|
+
import { renderMath as n } from "@pie-element/shared-math-rendering-mathjax";
|
|
4
|
+
import * as r from "@pie-lib/render-ui";
|
|
5
|
+
import { Collapsible as i, PreviewPrompt as a, UiLayout as o, color as s, hasMedia as c, hasText as l } from "@pie-lib/render-ui";
|
|
6
|
+
import u from "react-dom";
|
|
7
|
+
import d from "prop-types";
|
|
8
|
+
import f from "@pie-lib/correct-answer-toggle";
|
|
9
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
10
|
+
import { styled as h } from "@mui/material/styles";
|
|
9
11
|
//#region src/delivery/hotspot/index.tsx
|
|
10
|
-
function
|
|
12
|
+
function g(e) {
|
|
11
13
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
12
14
|
}
|
|
13
|
-
function
|
|
14
|
-
return !e ||
|
|
15
|
+
function _(e, t) {
|
|
16
|
+
return !e || g(e) ? e : g(e.default) ? e.default : t && g(e[t]) ? e[t] : t && g(e[t]?.default) ? e[t].default : e;
|
|
15
17
|
}
|
|
16
|
-
var
|
|
17
|
-
color:
|
|
18
|
-
backgroundColor:
|
|
18
|
+
var v = _(o, "UiLayout") || _(C.UiLayout, "UiLayout"), y = _(a, "PreviewPrompt") || _(C.PreviewPrompt, "PreviewPrompt"), b = _(i, "Collapsible") || _(C.Collapsible, "Collapsible"), x = r, S = x.default, C = S && typeof S == "object" ? S : x, w = h(v)({
|
|
19
|
+
color: s.text(),
|
|
20
|
+
backgroundColor: s.background(),
|
|
19
21
|
position: "relative"
|
|
20
|
-
}),
|
|
22
|
+
}), T = h(b)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), E = class extends t.Component {
|
|
21
23
|
constructor(e) {
|
|
22
24
|
super(e), this.state = {
|
|
23
25
|
showCorrect: !1,
|
|
@@ -36,7 +38,10 @@ var g = h(a, "UiLayout") || h(x.UiLayout, "UiLayout"), _ = h(i, "PreviewPrompt")
|
|
|
36
38
|
e && this.observer.observe(e, {
|
|
37
39
|
attributes: !0,
|
|
38
40
|
attributeFilter: ["style"]
|
|
39
|
-
});
|
|
41
|
+
}), n(u.findDOMNode(this));
|
|
42
|
+
}
|
|
43
|
+
componentDidUpdate() {
|
|
44
|
+
n(u.findDOMNode(this));
|
|
40
45
|
}
|
|
41
46
|
componentWillUnmount() {
|
|
42
47
|
this.observer?.disconnect();
|
|
@@ -46,57 +51,57 @@ var g = h(a, "UiLayout") || h(x.UiLayout, "UiLayout"), _ = h(i, "PreviewPrompt")
|
|
|
46
51
|
this.setState({ showCorrect: !e });
|
|
47
52
|
};
|
|
48
53
|
render() {
|
|
49
|
-
let { session: t, model: { disabled: n, extraCSSRules: r, imageUrl: i, prompt: a, mode: o, multipleCorrect:
|
|
50
|
-
return /* @__PURE__ */
|
|
54
|
+
let { session: t, model: { disabled: n, extraCSSRules: r, imageUrl: i, prompt: a, mode: o, multipleCorrect: s, shapes: u, outlineColor: d, hotspotColor: h, hoverOutlineColor: g, selectedHotspotColor: _, dimensions: v, rationale: x, teacherInstructions: S, strokeWidth: C, responseCorrect: E, language: D, fontSizeFactor: O, autoplayAudioEnabled: k, customAudioButton: A }, onSelectChoice: j } = this.props, { showCorrect: M } = this.state, N = o === "evaluate", P = o === "gather", F = N && !E, I = x && (l(x) || c(x));
|
|
55
|
+
return /* @__PURE__ */ m(w, {
|
|
51
56
|
extraCSSRules: r,
|
|
52
57
|
id: "main-container",
|
|
53
58
|
fontSizeFactor: O,
|
|
54
59
|
children: [
|
|
55
|
-
|
|
60
|
+
S && (l(S) || c(S)) && /* @__PURE__ */ p(T, {
|
|
56
61
|
labels: {
|
|
57
62
|
hidden: "Show Teacher Instructions",
|
|
58
63
|
visible: "Hide Teacher Instructions"
|
|
59
64
|
},
|
|
60
|
-
children: /* @__PURE__ */
|
|
65
|
+
children: /* @__PURE__ */ p(y, {
|
|
61
66
|
className: "prompt",
|
|
62
|
-
prompt:
|
|
67
|
+
prompt: S
|
|
63
68
|
})
|
|
64
69
|
}),
|
|
65
|
-
a && /* @__PURE__ */
|
|
70
|
+
a && /* @__PURE__ */ p(y, {
|
|
66
71
|
className: "prompt",
|
|
67
72
|
prompt: a,
|
|
68
73
|
autoplayAudioEnabled: k,
|
|
69
74
|
customAudioButton: A
|
|
70
75
|
}),
|
|
71
|
-
F && /* @__PURE__ */
|
|
76
|
+
F && /* @__PURE__ */ p(f, {
|
|
72
77
|
show: F,
|
|
73
78
|
toggled: M,
|
|
74
79
|
onToggle: this.onToggle.bind(this),
|
|
75
80
|
language: D
|
|
76
81
|
}),
|
|
77
|
-
i ? /* @__PURE__ */
|
|
82
|
+
i ? /* @__PURE__ */ p(e, {
|
|
78
83
|
isEvaluateMode: N,
|
|
79
84
|
session: t,
|
|
80
|
-
dimensions:
|
|
85
|
+
dimensions: v,
|
|
81
86
|
imageUrl: i,
|
|
82
87
|
hotspotColor: h,
|
|
83
88
|
hoverOutlineColor: P ? g : void 0,
|
|
84
|
-
selectedHotspotColor:
|
|
85
|
-
multipleCorrect:
|
|
86
|
-
outlineColor:
|
|
89
|
+
selectedHotspotColor: _,
|
|
90
|
+
multipleCorrect: s,
|
|
91
|
+
outlineColor: d,
|
|
87
92
|
onSelectChoice: j,
|
|
88
|
-
shapes:
|
|
93
|
+
shapes: u,
|
|
89
94
|
disabled: n,
|
|
90
|
-
strokeWidth:
|
|
95
|
+
strokeWidth: C,
|
|
91
96
|
scale: this.state.scale,
|
|
92
97
|
showCorrect: M
|
|
93
98
|
}) : null,
|
|
94
|
-
I && /* @__PURE__ */
|
|
99
|
+
I && /* @__PURE__ */ p(b, {
|
|
95
100
|
labels: {
|
|
96
101
|
hidden: "Show Rationale",
|
|
97
102
|
visible: "Hide Rationale"
|
|
98
103
|
},
|
|
99
|
-
children: /* @__PURE__ */
|
|
104
|
+
children: /* @__PURE__ */ p(y, {
|
|
100
105
|
className: "prompt",
|
|
101
106
|
prompt: x
|
|
102
107
|
})
|
|
@@ -105,10 +110,10 @@ var g = h(a, "UiLayout") || h(x.UiLayout, "UiLayout"), _ = h(i, "PreviewPrompt")
|
|
|
105
110
|
});
|
|
106
111
|
}
|
|
107
112
|
};
|
|
108
|
-
|
|
109
|
-
model:
|
|
110
|
-
onSelectChoice:
|
|
111
|
-
session:
|
|
113
|
+
E.propTypes = {
|
|
114
|
+
model: d.object.isRequired,
|
|
115
|
+
onSelectChoice: d.func.isRequired,
|
|
116
|
+
session: d.object.isRequired
|
|
112
117
|
};
|
|
113
118
|
//#endregion
|
|
114
|
-
export {
|
|
119
|
+
export { E as default };
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
declare class PolygonComponent extends React.Component {
|
|
11
11
|
constructor(props: any);
|
|
12
|
+
componentDidMount(): void;
|
|
13
|
+
componentDidUpdate(prevProps: any): void;
|
|
14
|
+
moveGroupToTop: any;
|
|
12
15
|
getPolygonCenter: any;
|
|
13
16
|
parsePointsForKonva: any;
|
|
14
17
|
handleClick: any;
|
|
@@ -13,8 +13,17 @@ function d(e, t) {
|
|
|
13
13
|
}
|
|
14
14
|
var f = d(l, "Rect"), p = d(s, "Group"), m = d(c, "Line"), h = class extends r.Component {
|
|
15
15
|
constructor(e) {
|
|
16
|
-
super(e), this.state = { hovered: !1 };
|
|
16
|
+
super(e), this.state = { hovered: !1 }, this.groupRef = r.createRef();
|
|
17
17
|
}
|
|
18
|
+
componentDidMount() {
|
|
19
|
+
this.props.focused && this.moveGroupToTop();
|
|
20
|
+
}
|
|
21
|
+
componentDidUpdate(e) {
|
|
22
|
+
!e.focused && this.props.focused && this.moveGroupToTop();
|
|
23
|
+
}
|
|
24
|
+
moveGroupToTop = () => {
|
|
25
|
+
this.groupRef.current && this.groupRef.current.moveToTop();
|
|
26
|
+
};
|
|
18
27
|
getPolygonCenter = (e) => {
|
|
19
28
|
let t = e.map(({ x: e }) => e), n = e.map(({ y: e }) => e), r = Math.min.apply(null, t), i = Math.max.apply(null, t), a = Math.min.apply(null, n), o = Math.max.apply(null, n);
|
|
20
29
|
return [(r + i) / 2, (a + o) / 2];
|
|
@@ -35,7 +44,7 @@ var f = d(l, "Rect"), p = d(s, "Group"), m = d(c, "Line"), h = class extends r.C
|
|
|
35
44
|
};
|
|
36
45
|
handleMouseEnter = () => {
|
|
37
46
|
let { disabled: e } = this.props;
|
|
38
|
-
e || (document.body.style.cursor = "pointer"), this.setState({ hovered: !0 });
|
|
47
|
+
e || (document.body.style.cursor = "pointer"), this.setState({ hovered: !0 }), this.moveGroupToTop();
|
|
39
48
|
};
|
|
40
49
|
handleMouseLeave = () => {
|
|
41
50
|
document.body.style.cursor = "default", this.setState({ hovered: !1 });
|
|
@@ -43,40 +52,42 @@ var f = d(l, "Rect"), p = d(s, "Group"), m = d(c, "Line"), h = class extends r.C
|
|
|
43
52
|
getEvaluateOutlineColor = (e, t, n) => t ? "green" : e ? n : "red";
|
|
44
53
|
getOutlineWidth = (e, t, n, r) => n || !n && !e && t ? r : 0;
|
|
45
54
|
render() {
|
|
46
|
-
let { hotspotColor: r, isCorrect: i, isEvaluateMode: s, hoverOutlineColor: c, outlineColor: l, selected: u,
|
|
47
|
-
|
|
48
|
-
let
|
|
55
|
+
let { hotspotColor: r, isCorrect: i, isEvaluateMode: s, hoverOutlineColor: c, outlineColor: l, selected: u, focused: d, points: h, evaluateText: g, strokeWidth: _, scale: v, markAsCorrect: y, selectedHotspotColor: b, showCorrectEnabled: x } = this.props, { hovered: S } = this.state, C = s ? this.getEvaluateOutlineColor(i, y, l) : l, w = this.getOutlineWidth(x, u, y, _), T = this.parsePointsForKonva(h), E = this.getPolygonCenter(h), D = E[0], O = E[1], k;
|
|
56
|
+
x ? (u && i || !u && !i) && (k = t) : u ? k = i ? t : n : i || (k = n);
|
|
57
|
+
let A = (S || d) && c, j = T.filter((e, t) => t % 2 == 0), M = T.filter((e, t) => t % 2 != 0), N = Math.min(...j), P = Math.max(...j), F = Math.min(...M), I = Math.max(...M), L = N, R = F, z = P - N, B = I - F;
|
|
49
58
|
return /* @__PURE__ */ o(p, {
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
ref: this.groupRef,
|
|
60
|
+
scaleX: v,
|
|
61
|
+
scaleY: v,
|
|
62
|
+
onMouseEnter: this.handleMouseEnter,
|
|
63
|
+
onMouseLeave: this.handleMouseLeave,
|
|
52
64
|
children: [
|
|
53
|
-
k && /* @__PURE__ */ a(f, {
|
|
54
|
-
x: I,
|
|
55
|
-
y: L,
|
|
56
|
-
width: R,
|
|
57
|
-
height: z,
|
|
58
|
-
stroke: u ? "transparent" : c,
|
|
59
|
-
strokeWidth: g
|
|
60
|
-
}),
|
|
61
65
|
/* @__PURE__ */ a(m, {
|
|
62
|
-
points:
|
|
66
|
+
points: T,
|
|
63
67
|
closed: !0,
|
|
64
|
-
fill: u &&
|
|
68
|
+
fill: u && b ? b : r,
|
|
65
69
|
onClick: this.handleClick,
|
|
66
70
|
onTap: this.handleClick,
|
|
67
71
|
draggable: !1,
|
|
68
|
-
stroke:
|
|
69
|
-
strokeWidth:
|
|
70
|
-
onMouseLeave: this.handleMouseLeave,
|
|
71
|
-
onMouseEnter: this.handleMouseEnter,
|
|
72
|
+
stroke: A && !u ? "transparent" : C,
|
|
73
|
+
strokeWidth: A && !u ? 0 : w,
|
|
72
74
|
cursor: "pointer",
|
|
73
75
|
position: "relative"
|
|
74
76
|
}),
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
A && /* @__PURE__ */ a(f, {
|
|
78
|
+
x: L,
|
|
79
|
+
y: R,
|
|
80
|
+
width: z,
|
|
81
|
+
height: B,
|
|
82
|
+
stroke: c,
|
|
83
|
+
strokeWidth: _,
|
|
84
|
+
listening: !1
|
|
85
|
+
}),
|
|
86
|
+
s && k ? /* @__PURE__ */ a(e, {
|
|
87
|
+
src: k,
|
|
88
|
+
x: D,
|
|
89
|
+
y: O,
|
|
90
|
+
tooltip: g
|
|
80
91
|
}) : null
|
|
81
92
|
]
|
|
82
93
|
});
|
|
@@ -89,6 +100,7 @@ h.propTypes = {
|
|
|
89
100
|
isEvaluateMode: i.bool.isRequired,
|
|
90
101
|
hoverOutlineColor: i.string,
|
|
91
102
|
disabled: i.bool.isRequired,
|
|
103
|
+
focused: i.bool,
|
|
92
104
|
onClick: i.func.isRequired,
|
|
93
105
|
outlineColor: i.string.isRequired,
|
|
94
106
|
points: i.array.isRequired,
|
|
@@ -101,6 +113,7 @@ h.propTypes = {
|
|
|
101
113
|
showCorrectEnabled: i.bool.isRequired
|
|
102
114
|
}, h.defaultProps = {
|
|
103
115
|
evaluateText: null,
|
|
116
|
+
focused: !1,
|
|
104
117
|
strokeWidth: 5,
|
|
105
118
|
scale: 1
|
|
106
119
|
};
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
declare class RectComponent extends React.Component {
|
|
11
11
|
constructor(props: any);
|
|
12
|
+
componentDidMount(): void;
|
|
13
|
+
componentDidUpdate(prevProps: any): void;
|
|
14
|
+
moveGroupToTop: any;
|
|
12
15
|
handleClick: any;
|
|
13
16
|
handleMouseEnter: any;
|
|
14
17
|
handleMouseLeave: any;
|