@pie-element/hotspot 4.8.4-next.135 → 4.8.4-next.1357
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 +263 -0
- package/configure/CHANGELOG.md +233 -0
- package/configure/lib/defaults.js +20 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/hotspot-container.js +26 -12
- 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 +17 -3
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/root.js +107 -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 +4 -4
- package/configure/src/__tests__/__snapshots__/hotspot-container.test.js.snap +1 -0
- package/configure/src/__tests__/__snapshots__/root.test.js.snap +53 -4
- package/configure/src/defaults.js +20 -0
- package/configure/src/hotspot-container.jsx +16 -5
- package/configure/src/hotspot-drawable.jsx +8 -2
- package/configure/src/index.js +14 -0
- package/configure/src/root.jsx +87 -9
- package/configure/src/utils.js +23 -1
- package/controller/CHANGELOG.md +50 -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 +212 -0
- package/docs/config-schema.json.md +165 -0
- package/docs/demo/generate.js +1 -0
- package/docs/pie-schema.json +49 -0
- package/docs/pie-schema.json.md +36 -0
- package/lib/hotspot/container.js +25 -7
- 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 +72 -18
- package/lib/hotspot/index.js.map +1 -1
- package/lib/hotspot/polygon.js +46 -20
- package/lib/hotspot/polygon.js.map +1 -1
- package/lib/hotspot/rectangle.js +46 -20
- 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 +6 -4
- package/src/__tests__/__snapshots__/{container-test.jsx.snap → container.test.jsx.snap} +8 -0
- package/src/__tests__/__snapshots__/image.test.jsx.snap +43 -0
- package/src/__tests__/__snapshots__/{polygon-test.jsx.snap → polygon.test.jsx.snap} +11 -0
- package/src/__tests__/__snapshots__/{rectangle-test.jsx.snap → rectangle.test.jsx.snap} +11 -0
- package/src/__tests__/{container-test.jsx → container.test.jsx} +57 -0
- package/src/__tests__/{image-test.jsx → image.test.jsx} +0 -0
- package/src/__tests__/polygon.test.jsx +224 -0
- package/src/__tests__/rectangle.test.jsx +233 -0
- package/src/__tests__/{session-updater-test.jsx → session-updater.test.jsx} +0 -0
- package/src/hotspot/container.jsx +23 -3
- package/src/hotspot/index.jsx +68 -8
- package/src/hotspot/polygon.jsx +40 -17
- package/src/hotspot/rectangle.jsx +40 -17
- package/src/index.js +5 -0
- package/src/__tests__/__snapshots__/image-test.jsx.snap +0 -21
- package/src/__tests__/polygon-test.jsx +0 -77
- package/src/__tests__/rectangle-test.jsx +0 -78
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Config Object for @pie-elements/hotspot",
|
|
3
|
+
"additionalProperties": false,
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"multipleCorrect": {
|
|
7
|
+
"title": "ConfigureProp",
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"settings": {
|
|
11
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
12
|
+
"type": "boolean",
|
|
13
|
+
"title": "settings"
|
|
14
|
+
},
|
|
15
|
+
"label": {
|
|
16
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
17
|
+
"type": "string",
|
|
18
|
+
"title": "label"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"partialScoring": {
|
|
23
|
+
"title": "ConfigureProp",
|
|
24
|
+
"type": "object",
|
|
25
|
+
"properties": {
|
|
26
|
+
"settings": {
|
|
27
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
28
|
+
"type": "boolean",
|
|
29
|
+
"title": "settings"
|
|
30
|
+
},
|
|
31
|
+
"label": {
|
|
32
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
33
|
+
"type": "string",
|
|
34
|
+
"title": "label"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"rationale": {
|
|
39
|
+
"title": "ConfigureProp",
|
|
40
|
+
"type": "object",
|
|
41
|
+
"properties": {
|
|
42
|
+
"settings": {
|
|
43
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
44
|
+
"type": "boolean",
|
|
45
|
+
"title": "settings"
|
|
46
|
+
},
|
|
47
|
+
"label": {
|
|
48
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
49
|
+
"type": "string",
|
|
50
|
+
"title": "label"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"spellCheck": {
|
|
55
|
+
"title": "ConfigureProp",
|
|
56
|
+
"type": "object",
|
|
57
|
+
"properties": {
|
|
58
|
+
"settings": {
|
|
59
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
60
|
+
"type": "boolean",
|
|
61
|
+
"title": "settings"
|
|
62
|
+
},
|
|
63
|
+
"label": {
|
|
64
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
65
|
+
"type": "string",
|
|
66
|
+
"title": "label"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"preserveAspectRatio": {
|
|
71
|
+
"title": "ConfigureProp",
|
|
72
|
+
"type": "object",
|
|
73
|
+
"properties": {
|
|
74
|
+
"settings": {
|
|
75
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
76
|
+
"type": "boolean",
|
|
77
|
+
"title": "settings"
|
|
78
|
+
},
|
|
79
|
+
"label": {
|
|
80
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
81
|
+
"type": "string",
|
|
82
|
+
"title": "label"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"minShapes": {
|
|
87
|
+
"description": "Minimum number of shapes",
|
|
88
|
+
"type": "number",
|
|
89
|
+
"title": "minShapes"
|
|
90
|
+
},
|
|
91
|
+
"maxShapes": {
|
|
92
|
+
"description": "Maximum number of shapes",
|
|
93
|
+
"type": "number",
|
|
94
|
+
"title": "maxShapes"
|
|
95
|
+
},
|
|
96
|
+
"maxSelections": {
|
|
97
|
+
"description": "Maximum number of selected shapes in correct answer",
|
|
98
|
+
"type": "number",
|
|
99
|
+
"title": "maxSelections"
|
|
100
|
+
},
|
|
101
|
+
"maxImageWidth": {
|
|
102
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
103
|
+
"type": "object",
|
|
104
|
+
"properties": {
|
|
105
|
+
"teacherInstructions": {
|
|
106
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
107
|
+
"type": "number",
|
|
108
|
+
"title": "teacherInstructions"
|
|
109
|
+
},
|
|
110
|
+
"prompt": {
|
|
111
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
112
|
+
"type": "number",
|
|
113
|
+
"title": "prompt"
|
|
114
|
+
},
|
|
115
|
+
"rationale": {
|
|
116
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
117
|
+
"type": "number",
|
|
118
|
+
"title": "rationale"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"maxImageHeight": {
|
|
123
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
124
|
+
"type": "object",
|
|
125
|
+
"properties": {
|
|
126
|
+
"teacherInstructions": {
|
|
127
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
128
|
+
"type": "number",
|
|
129
|
+
"title": "teacherInstructions"
|
|
130
|
+
},
|
|
131
|
+
"prompt": {
|
|
132
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
133
|
+
"type": "number",
|
|
134
|
+
"title": "prompt"
|
|
135
|
+
},
|
|
136
|
+
"rationale": {
|
|
137
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
138
|
+
"type": "number",
|
|
139
|
+
"title": "rationale"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"withRubric": {
|
|
144
|
+
"title": "ConfigureProp",
|
|
145
|
+
"type": "object",
|
|
146
|
+
"properties": {
|
|
147
|
+
"settings": {
|
|
148
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
149
|
+
"type": "boolean",
|
|
150
|
+
"title": "settings"
|
|
151
|
+
},
|
|
152
|
+
"label": {
|
|
153
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
154
|
+
"type": "string",
|
|
155
|
+
"title": "label"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"showPrompt": {
|
|
160
|
+
"description": "Determines whether prompt field will be displayed or not",
|
|
161
|
+
"default": true,
|
|
162
|
+
"type": "boolean",
|
|
163
|
+
"title": "showPrompt"
|
|
164
|
+
},
|
|
165
|
+
"promptLabel": {
|
|
166
|
+
"description": "The label for the item stem/prompt field",
|
|
167
|
+
"default": "Item Stemm",
|
|
168
|
+
"type": "string",
|
|
169
|
+
"title": "promptLabel"
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
"definitions": {
|
|
173
|
+
"ConfigureProp": {
|
|
174
|
+
"title": "ConfigureProp",
|
|
175
|
+
"type": "object",
|
|
176
|
+
"properties": {
|
|
177
|
+
"settings": {
|
|
178
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
179
|
+
"type": "boolean",
|
|
180
|
+
"title": "settings"
|
|
181
|
+
},
|
|
182
|
+
"label": {
|
|
183
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
184
|
+
"type": "string",
|
|
185
|
+
"title": "label"
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
190
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
191
|
+
"type": "object",
|
|
192
|
+
"properties": {
|
|
193
|
+
"teacherInstructions": {
|
|
194
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
195
|
+
"type": "number",
|
|
196
|
+
"title": "teacherInstructions"
|
|
197
|
+
},
|
|
198
|
+
"prompt": {
|
|
199
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
200
|
+
"type": "number",
|
|
201
|
+
"title": "prompt"
|
|
202
|
+
},
|
|
203
|
+
"rationale": {
|
|
204
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
205
|
+
"type": "number",
|
|
206
|
+
"title": "rationale"
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
212
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
Config Object for @pie-elements/hotspot
|
|
2
|
+
|
|
3
|
+
The schema defines the following properties:
|
|
4
|
+
|
|
5
|
+
# `multipleCorrect` (object)
|
|
6
|
+
|
|
7
|
+
Properties of the `multipleCorrect` object:
|
|
8
|
+
|
|
9
|
+
## `settings` (boolean)
|
|
10
|
+
|
|
11
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
12
|
+
|
|
13
|
+
## `label` (string)
|
|
14
|
+
|
|
15
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
16
|
+
|
|
17
|
+
# `partialScoring` (object)
|
|
18
|
+
|
|
19
|
+
Properties of the `partialScoring` object:
|
|
20
|
+
|
|
21
|
+
## `settings` (boolean)
|
|
22
|
+
|
|
23
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
24
|
+
|
|
25
|
+
## `label` (string)
|
|
26
|
+
|
|
27
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
28
|
+
|
|
29
|
+
# `rationale` (object)
|
|
30
|
+
|
|
31
|
+
Properties of the `rationale` object:
|
|
32
|
+
|
|
33
|
+
## `settings` (boolean)
|
|
34
|
+
|
|
35
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
36
|
+
|
|
37
|
+
## `label` (string)
|
|
38
|
+
|
|
39
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
40
|
+
|
|
41
|
+
# `spellCheck` (object)
|
|
42
|
+
|
|
43
|
+
Properties of the `spellCheck` object:
|
|
44
|
+
|
|
45
|
+
## `settings` (boolean)
|
|
46
|
+
|
|
47
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
48
|
+
|
|
49
|
+
## `label` (string)
|
|
50
|
+
|
|
51
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
52
|
+
|
|
53
|
+
# `preserveAspectRatio` (object)
|
|
54
|
+
|
|
55
|
+
Properties of the `preserveAspectRatio` object:
|
|
56
|
+
|
|
57
|
+
## `settings` (boolean)
|
|
58
|
+
|
|
59
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
60
|
+
|
|
61
|
+
## `label` (string)
|
|
62
|
+
|
|
63
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
64
|
+
|
|
65
|
+
# `minShapes` (number)
|
|
66
|
+
|
|
67
|
+
Minimum number of shapes
|
|
68
|
+
|
|
69
|
+
# `maxShapes` (number)
|
|
70
|
+
|
|
71
|
+
Maximum number of shapes
|
|
72
|
+
|
|
73
|
+
# `maxSelections` (number)
|
|
74
|
+
|
|
75
|
+
Maximum number of selected shapes in correct answer
|
|
76
|
+
|
|
77
|
+
# `maxImageWidth` (object)
|
|
78
|
+
|
|
79
|
+
Properties of the `maxImageWidth` object:
|
|
80
|
+
|
|
81
|
+
## `teacherInstructions` (number)
|
|
82
|
+
|
|
83
|
+
Indicates the max dimension for images in teacher instructions
|
|
84
|
+
|
|
85
|
+
## `prompt` (number)
|
|
86
|
+
|
|
87
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
88
|
+
|
|
89
|
+
## `rationale` (number)
|
|
90
|
+
|
|
91
|
+
Indicates the max dimension for images in rationale
|
|
92
|
+
|
|
93
|
+
# `maxImageHeight` (object)
|
|
94
|
+
|
|
95
|
+
Properties of the `maxImageHeight` object:
|
|
96
|
+
|
|
97
|
+
## `teacherInstructions` (number)
|
|
98
|
+
|
|
99
|
+
Indicates the max dimension for images in teacher instructions
|
|
100
|
+
|
|
101
|
+
## `prompt` (number)
|
|
102
|
+
|
|
103
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
104
|
+
|
|
105
|
+
## `rationale` (number)
|
|
106
|
+
|
|
107
|
+
Indicates the max dimension for images in rationale
|
|
108
|
+
|
|
109
|
+
# `withRubric` (object)
|
|
110
|
+
|
|
111
|
+
Properties of the `withRubric` object:
|
|
112
|
+
|
|
113
|
+
## `settings` (boolean)
|
|
114
|
+
|
|
115
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
116
|
+
|
|
117
|
+
## `label` (string)
|
|
118
|
+
|
|
119
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
120
|
+
|
|
121
|
+
# `showPrompt` (boolean)
|
|
122
|
+
|
|
123
|
+
Determines whether prompt field will be displayed or not
|
|
124
|
+
|
|
125
|
+
Default: `true`
|
|
126
|
+
|
|
127
|
+
# `promptLabel` (string)
|
|
128
|
+
|
|
129
|
+
The label for the item stem/prompt field
|
|
130
|
+
|
|
131
|
+
Default: `"Item Stemm"`
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
# Sub Schemas
|
|
136
|
+
|
|
137
|
+
The schema defines the following additional types:
|
|
138
|
+
|
|
139
|
+
## `ConfigureProp` (object)
|
|
140
|
+
|
|
141
|
+
Properties of the `ConfigureProp` object:
|
|
142
|
+
|
|
143
|
+
### `settings` (boolean)
|
|
144
|
+
|
|
145
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
146
|
+
|
|
147
|
+
### `label` (string)
|
|
148
|
+
|
|
149
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
150
|
+
|
|
151
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
152
|
+
|
|
153
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
154
|
+
|
|
155
|
+
### `teacherInstructions` (number)
|
|
156
|
+
|
|
157
|
+
Indicates the max dimension for images in teacher instructions
|
|
158
|
+
|
|
159
|
+
### `prompt` (number)
|
|
160
|
+
|
|
161
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
162
|
+
|
|
163
|
+
### `rationale` (number)
|
|
164
|
+
|
|
165
|
+
Indicates the max dimension for images in rationale
|
package/docs/demo/generate.js
CHANGED
|
@@ -65,4 +65,5 @@ exports.model = (id, element) => ({
|
|
|
65
65
|
teacherInstructions: null,
|
|
66
66
|
toolbarEditorPosition: 'bottom',
|
|
67
67
|
prompt: '<div><audio controls="controls" src="https://storage.googleapis.com/pie-prod-221718-assets/audio/77f3f61e-5f2d-425f-80a5-fb814dfa5e4c"></audio><br><br>Choose ALL of the words with the long /o/ sound.</div>',
|
|
68
|
+
rubricEnabled: false
|
|
68
69
|
});
|
package/docs/pie-schema.json
CHANGED
|
@@ -200,6 +200,11 @@
|
|
|
200
200
|
"type": "boolean",
|
|
201
201
|
"title": "studentInstructionsEnabled"
|
|
202
202
|
},
|
|
203
|
+
"spellCheckEnabled": {
|
|
204
|
+
"description": "Indicates if spellcheck is enabled for the author. Default value is true",
|
|
205
|
+
"type": "boolean",
|
|
206
|
+
"title": "spellCheckEnabled"
|
|
207
|
+
},
|
|
203
208
|
"strokeWidth": {
|
|
204
209
|
"description": "Indicates the width of the outline for a selection",
|
|
205
210
|
"type": "number",
|
|
@@ -220,6 +225,11 @@
|
|
|
220
225
|
"type": "string",
|
|
221
226
|
"title": "toolbarEditorPosition"
|
|
222
227
|
},
|
|
228
|
+
"rubricEnabled": {
|
|
229
|
+
"description": "Indicates if Rubric is enabled",
|
|
230
|
+
"type": "boolean",
|
|
231
|
+
"title": "rubricEnabled"
|
|
232
|
+
},
|
|
223
233
|
"id": {
|
|
224
234
|
"description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
|
|
225
235
|
"type": "string",
|
|
@@ -238,12 +248,51 @@
|
|
|
238
248
|
"multipleCorrect",
|
|
239
249
|
"partialScoring",
|
|
240
250
|
"rationaleEnabled",
|
|
251
|
+
"rubricEnabled",
|
|
241
252
|
"shapes",
|
|
253
|
+
"spellCheckEnabled",
|
|
242
254
|
"strokeWidth",
|
|
243
255
|
"studentInstructionsEnabled",
|
|
244
256
|
"teacherInstructionsEnabled"
|
|
245
257
|
],
|
|
246
258
|
"definitions": {
|
|
259
|
+
"ConfigureProp": {
|
|
260
|
+
"title": "ConfigureProp",
|
|
261
|
+
"type": "object",
|
|
262
|
+
"properties": {
|
|
263
|
+
"settings": {
|
|
264
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
265
|
+
"type": "boolean",
|
|
266
|
+
"title": "settings"
|
|
267
|
+
},
|
|
268
|
+
"label": {
|
|
269
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
270
|
+
"type": "string",
|
|
271
|
+
"title": "label"
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
276
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
277
|
+
"type": "object",
|
|
278
|
+
"properties": {
|
|
279
|
+
"teacherInstructions": {
|
|
280
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
281
|
+
"type": "number",
|
|
282
|
+
"title": "teacherInstructions"
|
|
283
|
+
},
|
|
284
|
+
"prompt": {
|
|
285
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
286
|
+
"type": "number",
|
|
287
|
+
"title": "prompt"
|
|
288
|
+
},
|
|
289
|
+
"rationale": {
|
|
290
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
291
|
+
"type": "number",
|
|
292
|
+
"title": "rationale"
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
},
|
|
247
296
|
"Shape": {
|
|
248
297
|
"title": "Shape",
|
|
249
298
|
"type": "object",
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -138,6 +138,10 @@ Indicates if Rationale are enabled
|
|
|
138
138
|
|
|
139
139
|
Indicates if Student Instructions are enabled
|
|
140
140
|
|
|
141
|
+
# `spellCheckEnabled` (boolean, required)
|
|
142
|
+
|
|
143
|
+
Indicates if spellcheck is enabled for the author. Default value is true
|
|
144
|
+
|
|
141
145
|
# `strokeWidth` (number, required)
|
|
142
146
|
|
|
143
147
|
Indicates the width of the outline for a selection
|
|
@@ -157,6 +161,10 @@ This element must be one of the following enum values:
|
|
|
157
161
|
|
|
158
162
|
Default: `": 'bottom'"`
|
|
159
163
|
|
|
164
|
+
# `rubricEnabled` (boolean, required)
|
|
165
|
+
|
|
166
|
+
Indicates if Rubric is enabled
|
|
167
|
+
|
|
160
168
|
# `id` (string, required)
|
|
161
169
|
|
|
162
170
|
Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
|
|
@@ -171,6 +179,34 @@ The html Element tag name
|
|
|
171
179
|
|
|
172
180
|
The schema defines the following additional types:
|
|
173
181
|
|
|
182
|
+
## `ConfigureProp` (object)
|
|
183
|
+
|
|
184
|
+
Properties of the `ConfigureProp` object:
|
|
185
|
+
|
|
186
|
+
### `settings` (boolean)
|
|
187
|
+
|
|
188
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
189
|
+
|
|
190
|
+
### `label` (string)
|
|
191
|
+
|
|
192
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
193
|
+
|
|
194
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
195
|
+
|
|
196
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
197
|
+
|
|
198
|
+
### `teacherInstructions` (number)
|
|
199
|
+
|
|
200
|
+
Indicates the max dimension for images in teacher instructions
|
|
201
|
+
|
|
202
|
+
### `prompt` (number)
|
|
203
|
+
|
|
204
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
205
|
+
|
|
206
|
+
### `rationale` (number)
|
|
207
|
+
|
|
208
|
+
Indicates the max dimension for images in rationale
|
|
209
|
+
|
|
174
210
|
## `Shape` (object)
|
|
175
211
|
|
|
176
212
|
Properties of the `Shape` object:
|
package/lib/hotspot/container.js
CHANGED
|
@@ -37,7 +37,7 @@ var _polygon = _interopRequireDefault(require("./polygon"));
|
|
|
37
37
|
|
|
38
38
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
39
39
|
|
|
40
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
40
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
41
41
|
|
|
42
42
|
var Container = /*#__PURE__*/function (_React$Component) {
|
|
43
43
|
(0, _inherits2["default"])(Container, _React$Component);
|
|
@@ -91,8 +91,8 @@ var Container = /*#__PURE__*/function (_React$Component) {
|
|
|
91
91
|
var _this$props = this.props,
|
|
92
92
|
classes = _this$props.classes,
|
|
93
93
|
_this$props$dimension = _this$props.dimensions,
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
withProp = _this$props$dimension.width,
|
|
95
|
+
heightProp = _this$props$dimension.height,
|
|
96
96
|
disabled = _this$props.disabled,
|
|
97
97
|
hotspotColor = _this$props.hotspotColor,
|
|
98
98
|
imageUrl = _this$props.imageUrl,
|
|
@@ -102,7 +102,11 @@ var Container = /*#__PURE__*/function (_React$Component) {
|
|
|
102
102
|
_this$props$shapes = _this$props.shapes,
|
|
103
103
|
rectangles = _this$props$shapes.rectangles,
|
|
104
104
|
polygons = _this$props$shapes.polygons,
|
|
105
|
-
|
|
105
|
+
SCALE = _this$props.scale,
|
|
106
|
+
strokeWidth = _this$props.strokeWidth,
|
|
107
|
+
showCorrect = _this$props.showCorrect;
|
|
108
|
+
var width = withProp * SCALE;
|
|
109
|
+
var height = heightProp * SCALE;
|
|
106
110
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
107
111
|
className: classes.base,
|
|
108
112
|
style: {
|
|
@@ -111,6 +115,7 @@ var Container = /*#__PURE__*/function (_React$Component) {
|
|
|
111
115
|
}, imageUrl ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
112
116
|
className: classes.imageContainer
|
|
113
117
|
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
118
|
+
alt: "hotspot-image",
|
|
114
119
|
className: classes.image,
|
|
115
120
|
height: "auto",
|
|
116
121
|
src: imageUrl,
|
|
@@ -131,7 +136,9 @@ var Container = /*#__PURE__*/function (_React$Component) {
|
|
|
131
136
|
|
|
132
137
|
var isCorrect = isEvaluateMode ? _this2.correctness(shape.correct, selected) : undefined;
|
|
133
138
|
var evaluateText = isEvaluateMode ? _this2.getEvaluateText(shape.correct, selected) : null;
|
|
139
|
+
var markAsCorrect = !!(isEvaluateMode && showCorrect && shape.correct);
|
|
134
140
|
return /*#__PURE__*/_react["default"].createElement(_rectangle["default"], {
|
|
141
|
+
scale: SCALE,
|
|
135
142
|
isEvaluateMode: isEvaluateMode,
|
|
136
143
|
isCorrect: isCorrect,
|
|
137
144
|
evaluateText: evaluateText,
|
|
@@ -146,14 +153,18 @@ var Container = /*#__PURE__*/function (_React$Component) {
|
|
|
146
153
|
width: shape.width,
|
|
147
154
|
x: shape.x,
|
|
148
155
|
y: shape.y,
|
|
149
|
-
strokeWidth: strokeWidth
|
|
156
|
+
strokeWidth: strokeWidth,
|
|
157
|
+
markAsCorrect: markAsCorrect,
|
|
158
|
+
showCorrectEnabled: showCorrect
|
|
150
159
|
});
|
|
151
160
|
}), polygons.map(function (polygon) {
|
|
152
161
|
var selected = _this2.isSelected(polygon);
|
|
153
162
|
|
|
154
163
|
var isCorrect = isEvaluateMode ? _this2.correctness(polygon.correct, selected) : undefined;
|
|
155
164
|
var evaluateText = isEvaluateMode ? _this2.getEvaluateText(polygon.correct, selected) : null;
|
|
165
|
+
var markAsCorrect = !!(isEvaluateMode && showCorrect && polygon.correct);
|
|
156
166
|
return /*#__PURE__*/_react["default"].createElement(_polygon["default"], {
|
|
167
|
+
scale: SCALE,
|
|
157
168
|
isEvaluateMode: isEvaluateMode,
|
|
158
169
|
isCorrect: !!isCorrect,
|
|
159
170
|
evaluateText: evaluateText,
|
|
@@ -165,7 +176,9 @@ var Container = /*#__PURE__*/function (_React$Component) {
|
|
|
165
176
|
onClick: onSelectChoice,
|
|
166
177
|
outlineColor: outlineColor,
|
|
167
178
|
points: polygon.points,
|
|
168
|
-
strokeWidth: strokeWidth
|
|
179
|
+
strokeWidth: strokeWidth,
|
|
180
|
+
markAsCorrect: markAsCorrect,
|
|
181
|
+
showCorrectEnabled: showCorrect
|
|
169
182
|
});
|
|
170
183
|
}))));
|
|
171
184
|
}
|
|
@@ -219,7 +232,12 @@ Container.propTypes = {
|
|
|
219
232
|
outlineColor: _propTypes["default"].string.isRequired,
|
|
220
233
|
session: _propTypes["default"].object.isRequired,
|
|
221
234
|
shapes: _propTypes["default"].object.isRequired,
|
|
222
|
-
strokeWidth: _propTypes["default"].number
|
|
235
|
+
strokeWidth: _propTypes["default"].number,
|
|
236
|
+
scale: _propTypes["default"].number,
|
|
237
|
+
showCorrect: _propTypes["default"].bool
|
|
238
|
+
};
|
|
239
|
+
Container.defaultProps = {
|
|
240
|
+
scale: 1
|
|
223
241
|
};
|
|
224
242
|
|
|
225
243
|
var _default = (0, _styles.withStyles)(styles)(Container);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hotspot/container.jsx"],"names":["Container","isCorrect","isChecked","selected","shape","selectedShape","props","session","answers","filter","answer","id","classes","dimensions","width","height","disabled","hotspotColor","imageUrl","isEvaluateMode","outlineColor","onSelectChoice","shapes","rectangles","polygons","strokeWidth","base","padding","imageContainer","image","maxWidth","maxHeight","stage","map","isSelected","correctness","correct","undefined","evaluateText","getEvaluateText","x","y","polygon","points","React","Component","styles","theme","marginTop","spacing","unit","position","alignItems","display","justifyContent","left","top","resize","borderBottom","color","borderRight","bottom","cursor","right","propTypes","PropTypes","object","isRequired","bool","string","func","number"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;IAEaA,S;;;;;;;;;;;;;;;oGAMG,UAACC,SAAD,EAAYC,SAAZ;AAAA,aAA0BD,SAAS,GAAGC,SAAH,GAAe,CAACA,SAAnD;AAAA,K;wGAEI,UAACD,SAAD,EAAYE,QAAZ,EAAyB;AACzC,UAAIA,QAAQ,IAAIF,SAAhB,EAA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A,cAAc,EAAC4C,sBAAUK,IAAV,CAAeH,UAPV;AAQpB/C,EAAAA,YAAY,EAAC6C,sBAAUI,MAAV,CAAiBF,UARV;AASpB5D,EAAAA,OAAO,EAAC0D,sBAAUC,MAAV,CAAiBC,UATL;AAUpB7C,EAAAA,MAAM,EAAC2C,sBAAUC,MAAV,CAAiBC,UAVJ;AAWpB1C,EAAAA,WAAW,EAAEwC,sBAAUM;AAXH,CAAtB;;eAce,wBAAWzB,MAAX,EAAmB9C,SAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Layer, Stage } from 'react-konva';\nimport { withStyles } from '@material-ui/core/styles';\nimport { color } from '@pie-lib/render-ui';\n\nimport Rectangle from './rectangle';\nimport Polygon from './polygon';\n\nexport class Container extends React.Component {\n isSelected(shape) {\n const selectedShape = this.props.session.answers.filter(answer => answer.id === shape.id)[0];\n return !!selectedShape;\n }\n\n correctness = (isCorrect, isChecked) => isCorrect ? isChecked : !isChecked;\n\n getEvaluateText = (isCorrect, selected) => {\n if (selected && isCorrect) {\n return 'Correctly\\nselected';\n }\n\n if (selected && !isCorrect) {\n return 'Should not have\\nbeen selected';\n }\n\n if (!selected && isCorrect) {\n return 'Should have\\nbeen selected';\n }\n\n return null;\n };\n\n render() {\n const {\n classes,\n dimensions: { width, height },\n disabled,\n hotspotColor,\n imageUrl,\n isEvaluateMode,\n outlineColor,\n onSelectChoice,\n shapes: { rectangles, polygons },\n strokeWidth\n } = this.props;\n\n return (\n <div\n className={classes.base}\n style={{ padding: strokeWidth / 2 }}\n >\n {imageUrl ? (\n <div className={classes.imageContainer}>\n <img\n className={classes.image}\n height=\"auto\"\n src={imageUrl}\n style={{ width, height, maxWidth: width, maxHeight: height }}\n />\n </div>\n ) : null}\n\n <Stage\n className={classes.stage}\n height={height + strokeWidth}\n width={width + strokeWidth}\n x={strokeWidth / 2}\n y={strokeWidth / 2}\n >\n <Layer>\n {rectangles.map((shape) => {\n const selected = this.isSelected(shape);\n const isCorrect = isEvaluateMode ? this.correctness(shape.correct, selected) : undefined;\n const evaluateText = isEvaluateMode ? this.getEvaluateText(shape.correct, selected) : null;\n\n return (\n <Rectangle\n isEvaluateMode={isEvaluateMode}\n isCorrect={isCorrect}\n evaluateText={evaluateText}\n disabled={disabled}\n selected={selected}\n height={shape.height}\n hotspotColor={hotspotColor}\n id={shape.id}\n key={shape.id}\n onClick={onSelectChoice}\n outlineColor={outlineColor}\n width={shape.width}\n x={shape.x}\n y={shape.y}\n strokeWidth={strokeWidth}\n />\n )\n })}\n {polygons.map((polygon) => {\n const selected = this.isSelected(polygon);\n const isCorrect = isEvaluateMode ? this.correctness(polygon.correct, selected) : undefined;\n const evaluateText = isEvaluateMode ? this.getEvaluateText(polygon.correct, selected) : null;\n\n return (\n <Polygon\n isEvaluateMode={isEvaluateMode}\n isCorrect={!!isCorrect}\n evaluateText={evaluateText}\n disabled={disabled}\n selected={selected}\n hotspotColor={hotspotColor}\n id={polygon.id}\n key={polygon.id}\n onClick={onSelectChoice}\n outlineColor={outlineColor}\n points={polygon.points}\n strokeWidth={strokeWidth}\n />\n )\n })}\n </Layer>\n </Stage>\n </div>\n );\n }\n}\n\nconst styles = theme => ({\n base: {\n marginTop: theme.spacing.unit * 3,\n position: 'relative'\n },\n image: {\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'center',\n },\n imageContainer: {\n position: 'relative',\n width: 'fit-content'\n },\n stage: {\n left: 0,\n top: 0,\n position: 'absolute'\n },\n resize: {\n borderBottom: `1px solid ${color.disabled()}`,\n borderRight: `1px solid ${color.disabled()}`,\n bottom: '-10px',\n cursor: 'se-resize',\n height: '10px',\n position: 'absolute',\n right: '-10px',\n width: '10px',\n }\n});\n\nContainer.propTypes = {\n classes: PropTypes.object.isRequired,\n dimensions: PropTypes.object.isRequired,\n disabled: PropTypes.bool.isRequired,\n hotspotColor:PropTypes.string.isRequired,\n imageUrl:PropTypes.string.isRequired,\n isEvaluateMode:PropTypes.bool.isRequired,\n onSelectChoice:PropTypes.func.isRequired,\n outlineColor:PropTypes.string.isRequired,\n session:PropTypes.object.isRequired,\n shapes:PropTypes.object.isRequired,\n strokeWidth: PropTypes.number\n};\n\nexport default withStyles(styles)(Container);\n"],"file":"container.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/hotspot/container.jsx"],"names":["Container","isCorrect","isChecked","selected","shape","selectedShape","props","session","answers","filter","answer","id","classes","dimensions","withProp","width","heightProp","height","disabled","hotspotColor","imageUrl","isEvaluateMode","outlineColor","onSelectChoice","shapes","rectangles","polygons","SCALE","scale","strokeWidth","showCorrect","base","padding","imageContainer","image","maxWidth","maxHeight","stage","map","isSelected","correctness","correct","undefined","evaluateText","getEvaluateText","markAsCorrect","x","y","polygon","points","React","Component","styles","theme","marginTop","spacing","unit","position","alignItems","display","justifyContent","left","top","resize","borderBottom","color","borderRight","bottom","cursor","right","propTypes","PropTypes","object","isRequired","bool","string","func","number","defaultProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;IAEaA,S;;;;;;;;;;;;;;;oGAMG,UAACC,SAAD,EAAYC,SAAZ;AAAA,aAA0BD,SAAS,GAAGC,SAAH,GAAe,CAACA,SAAnD;AAAA,K;wGAEI,UAACD,SAAD,EAAYE,QAAZ,EAAyB;AACzC,UAAIA,QAAQ,IAAIF,SAAhB,EAA2B;AACzB,eAAO,qBAAP;AACD;;AAED,UAAIE,QAAQ,IAAI,CAACF,SAAjB,EAA4B;AAC1B,eAAO,gCAAP;AACD;;AAED,UAAI,CAACE,QAAD,IAAaF,SAAjB,EAA4B;AAC1B,eAAO,4BAAP;AACD;;AAED,aAAO,IAAP;AACD,K;;;;;;WArBD,oBAAWG,KAAX,EAAkB;AAChB,UAAMC,aAAa,GAAG,KAAKC,KAAL,CAAWC,OAAX,CAAmBC,OAAnB,CAA2BC,MAA3B,CAAkC,UAAAC,MAAM;AAAA,eAAIA,MAAM,CAACC,EAAP,KAA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sBAAUG,IAAV,CAAeD,UAHL;AAIpBtD,EAAAA,YAAY,EAACoD,sBAAUI,MAAV,CAAiBF,UAJV;AAKpBrD,EAAAA,QAAQ,EAACmD,sBAAUI,MAAV,CAAiBF,UALN;AAMpBpD,EAAAA,cAAc,EAACkD,sBAAUG,IAAV,CAAeD,UANV;AAOpBlD,EAAAA,cAAc,EAACgD,sBAAUK,IAAV,CAAeH,UAPV;AAQpBnD,EAAAA,YAAY,EAACiD,sBAAUI,MAAV,CAAiBF,UARV;AASpBlE,EAAAA,OAAO,EAACgE,sBAAUC,MAAV,CAAiBC,UATL;AAUpBjD,EAAAA,MAAM,EAAC+C,sBAAUC,MAAV,CAAiBC,UAVJ;AAWpB5C,EAAAA,WAAW,EAAE0C,sBAAUM,MAXH;AAYpBjD,EAAAA,KAAK,EAAE2C,sBAAUM,MAZG;AAapB/C,EAAAA,WAAW,EAAEyC,sBAAUG;AAbH,CAAtB;AAgBA1E,SAAS,CAAC8E,YAAV,GAAyB;AACvBlD,EAAAA,KAAK,EAAE;AADgB,CAAzB;;eAIe,wBAAWwB,MAAX,EAAmBpD,SAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Layer, Stage } from 'react-konva';\nimport { withStyles } from '@material-ui/core/styles';\nimport { color } from '@pie-lib/render-ui';\n\nimport Rectangle from './rectangle';\nimport Polygon from './polygon';\n\nexport class Container extends React.Component {\n isSelected(shape) {\n const selectedShape = this.props.session.answers.filter(answer => answer.id === shape.id)[0];\n return !!selectedShape;\n }\n\n correctness = (isCorrect, isChecked) => isCorrect ? isChecked : !isChecked;\n\n getEvaluateText = (isCorrect, selected) => {\n if (selected && isCorrect) {\n return 'Correctly\\nselected';\n }\n\n if (selected && !isCorrect) {\n return 'Should not have\\nbeen selected';\n }\n\n if (!selected && isCorrect) {\n return 'Should have\\nbeen selected';\n }\n\n return null;\n };\n\n render() {\n const {\n classes,\n dimensions: { width: withProp, height: heightProp },\n disabled,\n hotspotColor,\n imageUrl,\n isEvaluateMode,\n outlineColor,\n onSelectChoice,\n shapes: { rectangles, polygons },\n scale: SCALE,\n strokeWidth,\n showCorrect\n } = this.props;\n\n const width = withProp * SCALE;\n const height = heightProp * SCALE;\n\n return (\n <div\n className={classes.base}\n style={{ padding: strokeWidth / 2 }}\n >\n {imageUrl ? (\n <div className={classes.imageContainer}>\n <img\n alt=\"hotspot-image\"\n className={classes.image}\n height=\"auto\"\n src={imageUrl}\n style={{ width, height, maxWidth: width, maxHeight: height }}\n />\n </div>\n ) : null}\n\n <Stage\n className={classes.stage}\n height={height + strokeWidth}\n width={width + strokeWidth}\n x={strokeWidth / 2}\n y={strokeWidth / 2}\n >\n <Layer>\n {rectangles.map((shape) => {\n const selected = this.isSelected(shape);\n const isCorrect = isEvaluateMode ? this.correctness(shape.correct, selected) : undefined;\n const evaluateText = isEvaluateMode ? this.getEvaluateText(shape.correct, selected) : null;\n const markAsCorrect = !!(isEvaluateMode && showCorrect && shape.correct);\n\n return (\n <Rectangle\n scale={SCALE}\n isEvaluateMode={isEvaluateMode}\n isCorrect={isCorrect}\n evaluateText={evaluateText}\n disabled={disabled}\n selected={selected}\n height={shape.height}\n hotspotColor={hotspotColor}\n id={shape.id}\n key={shape.id}\n onClick={onSelectChoice}\n outlineColor={outlineColor}\n width={shape.width}\n x={shape.x}\n y={shape.y}\n strokeWidth={strokeWidth}\n markAsCorrect={markAsCorrect}\n showCorrectEnabled={showCorrect}\n />\n )\n })}\n {polygons.map((polygon) => {\n const selected = this.isSelected(polygon);\n const isCorrect = isEvaluateMode ? this.correctness(polygon.correct, selected) : undefined;\n const evaluateText = isEvaluateMode ? this.getEvaluateText(polygon.correct, selected) : null;\n const markAsCorrect = !!(isEvaluateMode && showCorrect && polygon.correct);\n\n return (\n <Polygon\n scale={SCALE}\n isEvaluateMode={isEvaluateMode}\n isCorrect={!!isCorrect}\n evaluateText={evaluateText}\n disabled={disabled}\n selected={selected}\n hotspotColor={hotspotColor}\n id={polygon.id}\n key={polygon.id}\n onClick={onSelectChoice}\n outlineColor={outlineColor}\n points={polygon.points}\n strokeWidth={strokeWidth}\n markAsCorrect={markAsCorrect}\n showCorrectEnabled={showCorrect}\n />\n )\n })}\n </Layer>\n </Stage>\n </div>\n );\n }\n}\n\nconst styles = theme => ({\n base: {\n marginTop: theme.spacing.unit * 3,\n position: 'relative'\n },\n image: {\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'center',\n },\n imageContainer: {\n position: 'relative',\n width: 'fit-content'\n },\n stage: {\n left: 0,\n top: 0,\n position: 'absolute'\n },\n resize: {\n borderBottom: `1px solid ${color.disabled()}`,\n borderRight: `1px solid ${color.disabled()}`,\n bottom: '-10px',\n cursor: 'se-resize',\n height: '10px',\n position: 'absolute',\n right: '-10px',\n width: '10px',\n }\n});\n\nContainer.propTypes = {\n classes: PropTypes.object.isRequired,\n dimensions: PropTypes.object.isRequired,\n disabled: PropTypes.bool.isRequired,\n hotspotColor:PropTypes.string.isRequired,\n imageUrl:PropTypes.string.isRequired,\n isEvaluateMode:PropTypes.bool.isRequired,\n onSelectChoice:PropTypes.func.isRequired,\n outlineColor:PropTypes.string.isRequired,\n session:PropTypes.object.isRequired,\n shapes:PropTypes.object.isRequired,\n strokeWidth: PropTypes.number,\n scale: PropTypes.number,\n showCorrect: PropTypes.bool\n};\n\nContainer.defaultProps = {\n scale: 1\n};\n\nexport default withStyles(styles)(Container);\n"],"file":"container.js"}
|
package/lib/hotspot/image.js
CHANGED
|
@@ -29,7 +29,7 @@ var _reactKonva = require("react-konva");
|
|
|
29
29
|
|
|
30
30
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
31
31
|
|
|
32
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
32
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
33
33
|
|
|
34
34
|
var ImageComponent = /*#__PURE__*/function (_React$Component) {
|
|
35
35
|
(0, _inherits2["default"])(ImageComponent, _React$Component);
|