@pie-element/hotspot 4.8.1-next.99 → 4.8.4-next.1008
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.md +173 -0
- package/configure/CHANGELOG.md +154 -0
- package/configure/lib/defaults.js +17 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/hotspot-container.js +18 -6
- package/configure/lib/hotspot-container.js.map +1 -1
- package/configure/lib/hotspot-drawable.js +11 -5
- package/configure/lib/hotspot-drawable.js.map +1 -1
- package/configure/lib/hotspot-palette.js +1 -1
- package/configure/lib/hotspot-palette.js.map +1 -1
- package/configure/lib/hotspot-polygon.js +1 -1
- package/configure/lib/hotspot-polygon.js.map +1 -1
- package/configure/lib/hotspot-rectangle.js +1 -1
- package/configure/lib/hotspot-rectangle.js.map +1 -1
- package/configure/lib/index.js +3 -3
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/root.js +96 -13
- package/configure/lib/root.js.map +1 -1
- package/configure/lib/utils.js +18 -4
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +3 -3
- package/configure/src/__tests__/__snapshots__/hotspot-container.test.js.snap +1 -0
- package/configure/src/__tests__/__snapshots__/root.test.js.snap +48 -4
- package/configure/src/defaults.js +17 -0
- package/configure/src/hotspot-container.jsx +10 -1
- package/configure/src/hotspot-drawable.jsx +8 -2
- package/configure/src/root.jsx +80 -9
- package/configure/src/utils.js +23 -1
- package/controller/CHANGELOG.md +38 -0
- package/controller/lib/index.js +44 -5
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/utils.js.map +1 -1
- package/controller/package.json +1 -1
- package/controller/src/index.js +26 -0
- package/docs/config-schema.json +196 -0
- package/docs/config-schema.json.md +153 -0
- package/docs/demo/generate.js +1 -0
- package/docs/pie-schema.json +53 -0
- package/docs/pie-schema.json.md +43 -0
- package/lib/hotspot/container.js +14 -4
- package/lib/hotspot/container.js.map +1 -1
- package/lib/hotspot/image.js +1 -1
- package/lib/hotspot/image.js.map +1 -1
- package/lib/hotspot/index.js +61 -17
- package/lib/hotspot/index.js.map +1 -1
- package/lib/hotspot/polygon.js +11 -5
- package/lib/hotspot/polygon.js.map +1 -1
- package/lib/hotspot/rectangle.js +11 -5
- package/lib/hotspot/rectangle.js.map +1 -1
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/lib/session-updater.js.map +1 -1
- package/package.json +4 -4
- package/src/hotspot/container.jsx +14 -2
- package/src/hotspot/index.jsx +54 -6
- package/src/hotspot/polygon.jsx +7 -4
- package/src/hotspot/rectangle.jsx +7 -4
- package/src/index.js +5 -0
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["Hotspot","m","_model","dispatchEvent","ModelSetEvent","tagName","toLowerCase","isComplete","_render","_session","Array","isArray","answers","length","s","data","SessionChangedEvent","el","React","createElement","HotspotComponent","model","session","onSelectChoice","bind","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAKA;;AACA;;;;;;IAEqBA,O;;;;;;;;;;;;SACnB,aAAUC,CAAV,EAAa;AACX,WAAKC,MAAL,GAAcD,CAAd;AAEA,WAAKE,aAAL,CACE,IAAIC,8BAAJ,CACE,KAAKC,OAAL,CAAaC,WAAb,EADF,EAEE,KAAKC,UAAL,EAFF,EAGE,CAAC,CAAC,KAAKL,MAHT,CADF;;AAOA,WAAKM,OAAL;AACD;;;WAED,sBAAa;AACX,UAAI,CAAC,KAAKC,QAAV,EAAoB;AAClB,eAAO,KAAP;AACD;;AAED,aACEC,KAAK,CAACC,OAAN,CAAc,KAAKF,QAAL,CAAcG,OAA5B,KAAwC,KAAKH,QAAL,CAAcG,OAAd,CAAsBC,MAAtB,GAA+B,CADzE;AAGD;;;
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["Hotspot","m","_model","dispatchEvent","ModelSetEvent","tagName","toLowerCase","isComplete","_render","_session","Array","isArray","answers","length","s","data","SessionChangedEvent","el","React","createElement","HotspotComponent","model","session","onSelectChoice","bind","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAKA;;AACA;;;;;;IAEqBA,O;;;;;;;;;;;;SACnB,aAAUC,CAAV,EAAa;AACX,WAAKC,MAAL,GAAcD,CAAd;AAEA,WAAKE,aAAL,CACE,IAAIC,8BAAJ,CACE,KAAKC,OAAL,CAAaC,WAAb,EADF,EAEE,KAAKC,UAAL,EAFF,EAGE,CAAC,CAAC,KAAKL,MAHT,CADF;;AAOA,WAAKM,OAAL;AACD;;;WAED,sBAAa;AACX,UAAI,CAAC,KAAKC,QAAV,EAAoB;AAClB,eAAO,KAAP;AACD;;AAED,aACEC,KAAK,CAACC,OAAN,CAAc,KAAKF,QAAL,CAAcG,OAA5B,KAAwC,KAAKH,QAAL,CAAcG,OAAd,CAAsBC,MAAtB,GAA+B,CADzE;AAGD;;;SAWD,eAAc;AACZ,aAAO,KAAKJ,QAAZ;AACD,K;SAXD,aAAYK,CAAZ,EAAe;AACb,UAAIA,CAAC,IAAI,CAACA,CAAC,CAACF,OAAZ,EAAqB;AACnBE,QAAAA,CAAC,CAACF,OAAF,GAAY,EAAZ;AACD;;AAED,WAAKH,QAAL,GAAgBK,CAAhB;;AACA,WAAKN,OAAL;AACD;;;WAMD,wBAAeO,IAAf,EAAqB;AACnB,8CAAmB,KAAKN,QAAxB,EAAkC,KAAKP,MAAvC,EAA+Ca,IAA/C;AAEA,WAAKZ,aAAL,CACE,IAAIa,oCAAJ,CAAwB,KAAKX,OAAL,CAAaC,WAAb,EAAxB,EAAoD,KAAKC,UAAL,EAApD,CADF;;AAIA,WAAKC,OAAL;AACD;;;WAED,6BAAoB;AAClB,WAAKA,OAAL;AACD;;;WAED,mBAAU;AAAA;;AACR,UAAI,KAAKN,MAAL,IAAe,KAAKO,QAAxB,EAAkC;AAChC,YAAMQ,EAAE,gBAAGC,kBAAMC,aAAN,CAAoBC,mBAApB,EAAsC;AAC/CC,UAAAA,KAAK,EAAE,KAAKnB,MADmC;AAE/CoB,UAAAA,OAAO,EAAE,KAAKb,QAFiC;AAG/Cc,UAAAA,cAAc,EAAE,KAAKA,cAAL,CAAoBC,IAApB,CAAyB,IAAzB;AAH+B,SAAtC,CAAX;;AAMAC,6BAASC,MAAT,CAAgBT,EAAhB,EAAoB,IAApB,EAA0B,YAAM;AAC9B,yCAAW,KAAX;AACD,SAFD;AAGD;AACF;;;kDA/DkCU,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport {\n SessionChangedEvent,\n ModelSetEvent\n} from '@pie-framework/pie-player-events';\n\nimport HotspotComponent from './hotspot';\nimport { updateSessionValue } from './session-updater';\n\nexport default class Hotspot extends HTMLElement {\n set model(m) {\n this._model = m;\n\n this.dispatchEvent(\n new ModelSetEvent(\n this.tagName.toLowerCase(),\n this.isComplete(),\n !!this._model\n )\n );\n this._render();\n }\n\n isComplete() {\n if (!this._session) {\n return false;\n }\n\n return (\n Array.isArray(this._session.answers) && this._session.answers.length > 0\n );\n }\n\n set session(s) {\n if (s && !s.answers) {\n s.answers = [];\n }\n\n this._session = s;\n this._render();\n }\n\n get session() {\n return this._session;\n }\n\n onSelectChoice(data) {\n updateSessionValue(this._session, this._model, data);\n\n this.dispatchEvent(\n new SessionChangedEvent(this.tagName.toLowerCase(), this.isComplete())\n );\n\n this._render();\n }\n\n connectedCallback() {\n this._render();\n }\n\n _render() {\n if (this._model && this._session) {\n const el = React.createElement(HotspotComponent, {\n model: this._model,\n session: this._session,\n onSelectChoice: this.onSelectChoice.bind(this)\n });\n\n ReactDOM.render(el, this, () => {\n renderMath(this);\n });\n }\n }\n}\n"],"file":"index.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/session-updater.js"],"names":["updateSessionValue","session","model","data","id","selected","multipleCorrect","answers","filter","answer","item","push"],"mappings":";;;;;;;AAAO,SAASA,kBAAT,CAA4BC,OAA5B,EAAqCC,KAArC,EAA4CC,IAA5C,EAAkD;
|
|
1
|
+
{"version":3,"sources":["../src/session-updater.js"],"names":["updateSessionValue","session","model","data","id","selected","multipleCorrect","answers","filter","answer","item","push"],"mappings":";;;;;;;AAAO,SAASA,kBAAT,CAA4BC,OAA5B,EAAqCC,KAArC,EAA4CC,IAA5C,EAAkD;AACvD,MAAQC,EAAR,GAAyBD,IAAzB,CAAQC,EAAR;AAAA,MAAYC,QAAZ,GAAyBF,IAAzB,CAAYE,QAAZ;AACA,MAAQC,eAAR,GAA4BJ,KAA5B,CAAQI,eAAR;AACAL,EAAAA,OAAO,CAACM,OAAR,GAAkBN,OAAO,CAACM,OAAR,IAAmB,EAArC;;AAEA,MAAI,CAACF,QAAL,EAAe;AACbJ,IAAAA,OAAO,CAACM,OAAR,GAAkBN,OAAO,CAACM,OAAR,CAAgBC,MAAhB,CAAuB,UAAAC,MAAM;AAAA,aAAIA,MAAM,CAACL,EAAP,KAAcA,EAAlB;AAAA,KAA7B,CAAlB;AACD,GAFD,MAEO;AACL,QAAMM,IAAI,GAAG;AAAEN,MAAAA,EAAE,EAAFA;AAAF,KAAb;;AACA,QAAIE,eAAJ,EAAqB;AACnBL,MAAAA,OAAO,CAACM,OAAR,CAAgBI,IAAhB,CAAqBD,IAArB;AACD,KAFD,MAEO;AACLT,MAAAA,OAAO,CAACM,OAAR,GAAkB,CAACG,IAAD,CAAlB;AACD;AACF;AACF","sourcesContent":["export function updateSessionValue(session, model, data) {\n const { id, selected } = data;\n const { multipleCorrect } = model;\n session.answers = session.answers || [];\n\n if (!selected) {\n session.answers = session.answers.filter(answer => answer.id !== id);\n } else {\n const item = { id };\n if (multipleCorrect) {\n session.answers.push(item);\n } else {\n session.answers = [item];\n }\n }\n}\n"],"file":"session-updater.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/hotspot",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.4-next.1008+7ab630754",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": "pie-framework/pie-elements",
|
|
6
6
|
"publishConfig": {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@material-ui/core": "^3.9.3",
|
|
11
11
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
12
|
-
"@pie-lib/math-rendering": "^2.3
|
|
13
|
-
"@pie-lib/render-ui": "^4.
|
|
12
|
+
"@pie-lib/math-rendering": "^2.4.3",
|
|
13
|
+
"@pie-lib/render-ui": "^4.12.9",
|
|
14
14
|
"konva": "^3.2.5",
|
|
15
15
|
"prop-types": "^15.6.1",
|
|
16
16
|
"react": "^16.8.1",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"author": "pie framework developers",
|
|
21
21
|
"license": "ISC",
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "7ab6307548d6d1387d82263513e6483fe30872fa",
|
|
23
23
|
"scripts": {
|
|
24
24
|
"postpublish": "../../scripts/postpublish"
|
|
25
25
|
},
|
|
@@ -34,7 +34,7 @@ export class Container extends React.Component {
|
|
|
34
34
|
render() {
|
|
35
35
|
const {
|
|
36
36
|
classes,
|
|
37
|
-
dimensions: { width, height },
|
|
37
|
+
dimensions: { width: withProp, height: heightProp },
|
|
38
38
|
disabled,
|
|
39
39
|
hotspotColor,
|
|
40
40
|
imageUrl,
|
|
@@ -42,9 +42,13 @@ export class Container extends React.Component {
|
|
|
42
42
|
outlineColor,
|
|
43
43
|
onSelectChoice,
|
|
44
44
|
shapes: { rectangles, polygons },
|
|
45
|
+
scale: SCALE,
|
|
45
46
|
strokeWidth
|
|
46
47
|
} = this.props;
|
|
47
48
|
|
|
49
|
+
const width = withProp * SCALE;
|
|
50
|
+
const height = heightProp * SCALE;
|
|
51
|
+
|
|
48
52
|
return (
|
|
49
53
|
<div
|
|
50
54
|
className={classes.base}
|
|
@@ -53,6 +57,7 @@ export class Container extends React.Component {
|
|
|
53
57
|
{imageUrl ? (
|
|
54
58
|
<div className={classes.imageContainer}>
|
|
55
59
|
<img
|
|
60
|
+
alt="hotspot-image"
|
|
56
61
|
className={classes.image}
|
|
57
62
|
height="auto"
|
|
58
63
|
src={imageUrl}
|
|
@@ -76,6 +81,7 @@ export class Container extends React.Component {
|
|
|
76
81
|
|
|
77
82
|
return (
|
|
78
83
|
<Rectangle
|
|
84
|
+
scale={SCALE}
|
|
79
85
|
isEvaluateMode={isEvaluateMode}
|
|
80
86
|
isCorrect={isCorrect}
|
|
81
87
|
evaluateText={evaluateText}
|
|
@@ -101,6 +107,7 @@ export class Container extends React.Component {
|
|
|
101
107
|
|
|
102
108
|
return (
|
|
103
109
|
<Polygon
|
|
110
|
+
scale={SCALE}
|
|
104
111
|
isEvaluateMode={isEvaluateMode}
|
|
105
112
|
isCorrect={!!isCorrect}
|
|
106
113
|
evaluateText={evaluateText}
|
|
@@ -165,7 +172,12 @@ Container.propTypes = {
|
|
|
165
172
|
outlineColor:PropTypes.string.isRequired,
|
|
166
173
|
session:PropTypes.object.isRequired,
|
|
167
174
|
shapes:PropTypes.object.isRequired,
|
|
168
|
-
strokeWidth: PropTypes.number
|
|
175
|
+
strokeWidth: PropTypes.number,
|
|
176
|
+
scale: PropTypes.number
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
Container.defaultProps = {
|
|
180
|
+
scale: 1
|
|
169
181
|
};
|
|
170
182
|
|
|
171
183
|
export default withStyles(styles)(Container);
|
package/src/hotspot/index.jsx
CHANGED
|
@@ -1,18 +1,56 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import Typography from '@material-ui/core/Typography';
|
|
4
|
-
import {
|
|
5
|
-
import Container from './container';
|
|
4
|
+
import {Collapsible, hasText, PreviewPrompt} from '@pie-lib/render-ui';
|
|
6
5
|
import { withStyles } from '@material-ui/core/styles';
|
|
7
6
|
|
|
7
|
+
import Container from './container';
|
|
8
|
+
|
|
8
9
|
class HotspotComponent extends React.Component {
|
|
9
10
|
constructor(props) {
|
|
10
11
|
super(props);
|
|
11
12
|
this.state = {
|
|
12
|
-
showCorrect: false
|
|
13
|
+
showCorrect: false,
|
|
14
|
+
observer: null,
|
|
15
|
+
scale: 1
|
|
13
16
|
};
|
|
14
17
|
}
|
|
15
18
|
|
|
19
|
+
componentDidMount() {
|
|
20
|
+
this.observer = new MutationObserver((mutations) => {
|
|
21
|
+
mutations.forEach(() => {
|
|
22
|
+
const target = document.getElementById('question-container')?.style?.cssText
|
|
23
|
+
const zoom = target?.substring(
|
|
24
|
+
target.indexOf('--pie-zoom') + 11,
|
|
25
|
+
target.lastIndexOf('%')
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const zoomParsed = zoom?.replace(/\s/g, '');
|
|
29
|
+
if (zoomParsed) {
|
|
30
|
+
const newScale = parseFloat(zoomParsed) / 100;
|
|
31
|
+
if (newScale !== this.state.scale) {
|
|
32
|
+
this.setState({
|
|
33
|
+
scale: parseFloat(zoomParsed) / 100,
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
} else if (!zoomParsed && this.state.scale !== 1) {
|
|
37
|
+
this.setState({
|
|
38
|
+
scale: 1,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const target = document.getElementById('question-container');
|
|
45
|
+
if (target) {
|
|
46
|
+
this.observer.observe(target, { attributes : true, attributeFilter : ['style'] })
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
componentWillUnmount() {
|
|
51
|
+
this.observer?.disconnect();
|
|
52
|
+
}
|
|
53
|
+
|
|
16
54
|
onToggle = () => {
|
|
17
55
|
const { showCorrect } = this.state;
|
|
18
56
|
this.setState({ showCorrect: !showCorrect });
|
|
@@ -49,13 +87,19 @@ class HotspotComponent extends React.Component {
|
|
|
49
87
|
labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}
|
|
50
88
|
className={classes.collapsible}
|
|
51
89
|
>
|
|
52
|
-
<
|
|
90
|
+
<PreviewPrompt
|
|
91
|
+
className="prompt"
|
|
92
|
+
prompt={teacherInstructions}
|
|
93
|
+
/>
|
|
53
94
|
</Collapsible>
|
|
54
95
|
)
|
|
55
96
|
}
|
|
56
97
|
|
|
57
98
|
<Typography className={classes.prompt}>
|
|
58
|
-
<
|
|
99
|
+
<PreviewPrompt
|
|
100
|
+
className="prompt"
|
|
101
|
+
prompt={prompt}
|
|
102
|
+
/>
|
|
59
103
|
</Typography>
|
|
60
104
|
|
|
61
105
|
{imageUrl ? (
|
|
@@ -71,6 +115,7 @@ class HotspotComponent extends React.Component {
|
|
|
71
115
|
shapes={shapes}
|
|
72
116
|
disabled={disabled}
|
|
73
117
|
strokeWidth={strokeWidth}
|
|
118
|
+
scale={this.state.scale}
|
|
74
119
|
/>
|
|
75
120
|
) : null}
|
|
76
121
|
|
|
@@ -80,7 +125,10 @@ class HotspotComponent extends React.Component {
|
|
|
80
125
|
labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}
|
|
81
126
|
className={classes.collapsible}
|
|
82
127
|
>
|
|
83
|
-
<
|
|
128
|
+
<PreviewPrompt
|
|
129
|
+
className="prompt"
|
|
130
|
+
prompt={rationale}
|
|
131
|
+
/>
|
|
84
132
|
</Collapsible>
|
|
85
133
|
)
|
|
86
134
|
}
|
package/src/hotspot/polygon.jsx
CHANGED
|
@@ -65,7 +65,8 @@ class PolygonComponent extends React.Component {
|
|
|
65
65
|
selected,
|
|
66
66
|
points,
|
|
67
67
|
evaluateText,
|
|
68
|
-
strokeWidth
|
|
68
|
+
strokeWidth,
|
|
69
|
+
scale
|
|
69
70
|
} = this.props;
|
|
70
71
|
|
|
71
72
|
const outlineColorParsed = isEvaluateMode
|
|
@@ -95,7 +96,7 @@ class PolygonComponent extends React.Component {
|
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
return (
|
|
98
|
-
<Group>
|
|
99
|
+
<Group scaleX={scale} scaleY={scale}>
|
|
99
100
|
<Line
|
|
100
101
|
points={pointsParsed}
|
|
101
102
|
closed={true}
|
|
@@ -142,12 +143,14 @@ PolygonComponent.propTypes = {
|
|
|
142
143
|
points: PropTypes.array.isRequired,
|
|
143
144
|
selected: PropTypes.bool.isRequired,
|
|
144
145
|
evaluateText: PropTypes.string,
|
|
145
|
-
strokeWidth: PropTypes.number
|
|
146
|
+
strokeWidth: PropTypes.number,
|
|
147
|
+
scale: PropTypes.number
|
|
146
148
|
};
|
|
147
149
|
|
|
148
150
|
PolygonComponent.defaultProps = {
|
|
149
151
|
evaluateText: null,
|
|
150
|
-
strokeWidth: 5
|
|
152
|
+
strokeWidth: 5,
|
|
153
|
+
scale: 1
|
|
151
154
|
};
|
|
152
155
|
|
|
153
156
|
export default withStyles(styles)(PolygonComponent);
|
|
@@ -49,7 +49,8 @@ class RectComponent extends React.Component {
|
|
|
49
49
|
x,
|
|
50
50
|
y,
|
|
51
51
|
evaluateText,
|
|
52
|
-
strokeWidth
|
|
52
|
+
strokeWidth,
|
|
53
|
+
scale
|
|
53
54
|
} = this.props;
|
|
54
55
|
|
|
55
56
|
const outlineColorParsed = isEvaluateMode
|
|
@@ -78,7 +79,7 @@ class RectComponent extends React.Component {
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
return (
|
|
81
|
-
<Group>
|
|
82
|
+
<Group scaleX={scale} scaleY={scale}>
|
|
82
83
|
<Rect
|
|
83
84
|
classes={classes.base}
|
|
84
85
|
width={width}
|
|
@@ -130,13 +131,15 @@ RectComponent.propTypes = {
|
|
|
130
131
|
x: PropTypes.number.isRequired,
|
|
131
132
|
y: PropTypes.number.isRequired,
|
|
132
133
|
evaluateText: PropTypes.string,
|
|
133
|
-
strokeWidth: PropTypes.number
|
|
134
|
+
strokeWidth: PropTypes.number,
|
|
135
|
+
scale: PropTypes.number
|
|
134
136
|
};
|
|
135
137
|
|
|
136
138
|
RectComponent.defaultProps = {
|
|
137
139
|
isCorrect: false,
|
|
138
140
|
evaluateText: null,
|
|
139
|
-
strokeWidth: 5
|
|
141
|
+
strokeWidth: 5,
|
|
142
|
+
scale: 1
|
|
140
143
|
};
|
|
141
144
|
|
|
142
145
|
export default withStyles(styles)(RectComponent);
|
package/src/index.js
CHANGED
|
@@ -42,6 +42,10 @@ export default class Hotspot extends HTMLElement {
|
|
|
42
42
|
this._render();
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
get session() {
|
|
46
|
+
return this._session;
|
|
47
|
+
}
|
|
48
|
+
|
|
45
49
|
onSelectChoice(data) {
|
|
46
50
|
updateSessionValue(this._session, this._model, data);
|
|
47
51
|
|
|
@@ -63,6 +67,7 @@ export default class Hotspot extends HTMLElement {
|
|
|
63
67
|
session: this._session,
|
|
64
68
|
onSelectChoice: this.onSelectChoice.bind(this)
|
|
65
69
|
});
|
|
70
|
+
|
|
66
71
|
ReactDOM.render(el, this, () => {
|
|
67
72
|
renderMath(this);
|
|
68
73
|
});
|