@pie-element/hotspot 4.8.3 → 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 +151 -0
- package/configure/CHANGELOG.md +135 -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 +16 -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 +33 -4
- package/lib/hotspot/container.js.map +1 -1
- package/lib/hotspot/image.js +35 -8
- 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 +16 -17
- package/lib/hotspot/polygon.js.map +1 -1
- package/lib/hotspot/rectangle.js +16 -17
- 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/__tests__/image-test.jsx +9 -1
- package/src/__tests__/polygon-test.jsx +2 -1
- package/src/__tests__/rectangle-test.jsx +2 -1
- package/src/hotspot/container.jsx +34 -2
- package/src/hotspot/image.jsx +29 -12
- package/src/hotspot/index.jsx +54 -6
- package/src/hotspot/polygon.jsx +11 -15
- package/src/hotspot/rectangle.jsx +11 -15
- package/src/index.js +5 -0
- package/module/configure.js +0 -2340
- package/module/controller.js +0 -19764
- package/module/demo.js +0 -94
- package/module/element.js +0 -717
- package/module/index.html +0 -16
- package/module/manifest.json +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,157 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.10.16](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@4.10.15...@pie-element/hotspot@4.10.16) (2022-03-28)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/hotspot
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [4.10.15](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@4.10.14...@pie-element/hotspot@4.10.15) (2022-03-22)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @pie-element/hotspot
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [4.10.14](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@4.10.13...@pie-element/hotspot@4.10.14) (2022-03-08)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @pie-element/hotspot
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [4.10.13](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@4.10.12...@pie-element/hotspot@4.10.13) (2022-03-08)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @pie-element/hotspot
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## [4.10.12](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@4.10.11...@pie-element/hotspot@4.10.12) (2022-02-21)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @pie-element/hotspot
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## [4.10.11](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@4.10.10...@pie-element/hotspot@4.10.11) (2022-02-04)
|
|
47
|
+
|
|
48
|
+
**Note:** Version bump only for package @pie-element/hotspot
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## [4.10.10](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@4.10.9...@pie-element/hotspot@4.10.10) (2022-01-24)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Bug Fixes
|
|
58
|
+
|
|
59
|
+
* use preview prompt for prompt, rationale and teacher instructions to fix table rendering PD-1456 ([f330601](https://github.com/pie-framework/pie-elements/commit/f3306019a2d1c8ce3e2783823dfe9ef0a0394e4f))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## [4.10.9](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@4.10.8...@pie-element/hotspot@4.10.9) (2022-01-10)
|
|
66
|
+
|
|
67
|
+
**Note:** Version bump only for package @pie-element/hotspot
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## [4.10.8](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@4.10.7...@pie-element/hotspot@4.10.8) (2021-12-23)
|
|
74
|
+
|
|
75
|
+
**Note:** Version bump only for package @pie-element/hotspot
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
## [4.10.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@4.10.5...@pie-element/hotspot@4.10.6) (2021-12-13)
|
|
82
|
+
|
|
83
|
+
**Note:** Version bump only for package @pie-element/hotspot
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## [4.10.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@4.10.2...@pie-element/hotspot@4.10.3) (2021-11-29)
|
|
90
|
+
|
|
91
|
+
**Note:** Version bump only for package @pie-element/hotspot
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
## [4.10.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@4.10.1...@pie-element/hotspot@4.10.2) (2021-11-11)
|
|
98
|
+
|
|
99
|
+
**Note:** Version bump only for package @pie-element/hotspot
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
## [4.10.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@4.10.0...@pie-element/hotspot@4.10.1) (2021-10-04)
|
|
106
|
+
|
|
107
|
+
**Note:** Version bump only for package @pie-element/hotspot
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
# [4.10.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@4.9.1...@pie-element/hotspot@4.10.0) (2021-09-20)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
### Bug Fixes
|
|
117
|
+
|
|
118
|
+
* pie-lib updates ([e521c2f](https://github.com/pie-framework/pie-elements/commit/e521c2f1a44aa7f3e14f82a1cee05ceb484ed0a6))
|
|
119
|
+
* Updated pie-lib versions ([2fe4c5d](https://github.com/pie-framework/pie-elements/commit/2fe4c5d0be2d40f5fdb34815855695a7f1087f56))
|
|
120
|
+
* Updated pie-lib versions ([1c23830](https://github.com/pie-framework/pie-elements/commit/1c23830fc75d1de5f7bb3bb16de3c665ae5fa350))
|
|
121
|
+
* **hotspot:** Added a max width when loading a new image PD-261 ([7fcbb8a](https://github.com/pie-framework/pie-elements/commit/7fcbb8a896f73024053a97075d8cb368b8bb6b71))
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
### Features
|
|
125
|
+
|
|
126
|
+
* **hotspot:** add the possibility to paste image in authoring PD-478 ([16f1198](https://github.com/pie-framework/pie-elements/commit/16f1198ea5a839759f626927f1b65b5483a9aa85))
|
|
127
|
+
* **hotspot:** Added option to set toolbar editor position ([a36faea](https://github.com/pie-framework/pie-elements/commit/a36faea1cc0cb9ed5574fcb860941eea298b1cd3))
|
|
128
|
+
* **hotspot:** Added tooltip annotations to the icons PD-625 ([354a41e](https://github.com/pie-framework/pie-elements/commit/354a41ea2738d35fc09b1d7ab4bc7f796eb31c65))
|
|
129
|
+
* **hotspot:** set toolbar editor position to bottom ([3f3db3a](https://github.com/pie-framework/pie-elements/commit/3f3db3accdb1469f8b52535081da0cc339e43a48))
|
|
130
|
+
* **hotspot:** toolbar editor position - change double quotes into single quotes ([722ec64](https://github.com/pie-framework/pie-elements/commit/722ec64c1f87f69f2c086e80923d0c137b4aad39))
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
## [4.9.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@4.9.0...@pie-element/hotspot@4.9.1) (2021-09-01)
|
|
136
|
+
|
|
137
|
+
**Note:** Version bump only for package @pie-element/hotspot
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
# [4.9.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@4.8.3...@pie-element/hotspot@4.9.0) (2021-08-05)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
### Features
|
|
147
|
+
|
|
148
|
+
* **hotspot:** Added option to set toolbar editor position ([a36faea](https://github.com/pie-framework/pie-elements/commit/a36faea1cc0cb9ed5574fcb860941eea298b1cd3))
|
|
149
|
+
* **hotspot:** Added tooltip annotations to the icons PD-625 ([354a41e](https://github.com/pie-framework/pie-elements/commit/354a41ea2738d35fc09b1d7ab4bc7f796eb31c65))
|
|
150
|
+
* **hotspot:** set toolbar editor position to bottom ([3f3db3a](https://github.com/pie-framework/pie-elements/commit/3f3db3accdb1469f8b52535081da0cc339e43a48))
|
|
151
|
+
* **hotspot:** toolbar editor position - change double quotes into single quotes ([722ec64](https://github.com/pie-framework/pie-elements/commit/722ec64c1f87f69f2c086e80923d0c137b4aad39))
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
6
157
|
## [4.8.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@4.8.1...@pie-element/hotspot@4.8.3) (2021-08-05)
|
|
7
158
|
|
|
8
159
|
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,141 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.6.15](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@4.6.14...@pie-element/hotspot-configure@4.6.15) (2022-03-28)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/hotspot-configure
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [4.6.14](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@4.6.13...@pie-element/hotspot-configure@4.6.14) (2022-03-22)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @pie-element/hotspot-configure
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [4.6.13](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@4.6.12...@pie-element/hotspot-configure@4.6.13) (2022-03-08)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @pie-element/hotspot-configure
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [4.6.12](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@4.6.11...@pie-element/hotspot-configure@4.6.12) (2022-03-08)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @pie-element/hotspot-configure
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## [4.6.11](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@4.6.10...@pie-element/hotspot-configure@4.6.11) (2022-02-21)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @pie-element/hotspot-configure
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## [4.6.10](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@4.6.9...@pie-element/hotspot-configure@4.6.10) (2022-02-04)
|
|
47
|
+
|
|
48
|
+
**Note:** Version bump only for package @pie-element/hotspot-configure
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## [4.6.9](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@4.6.8...@pie-element/hotspot-configure@4.6.9) (2022-01-24)
|
|
55
|
+
|
|
56
|
+
**Note:** Version bump only for package @pie-element/hotspot-configure
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## [4.6.8](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@4.6.7...@pie-element/hotspot-configure@4.6.8) (2022-01-10)
|
|
63
|
+
|
|
64
|
+
**Note:** Version bump only for package @pie-element/hotspot-configure
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## [4.6.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@4.6.6...@pie-element/hotspot-configure@4.6.7) (2021-12-23)
|
|
71
|
+
|
|
72
|
+
**Note:** Version bump only for package @pie-element/hotspot-configure
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## [4.6.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@4.6.4...@pie-element/hotspot-configure@4.6.5) (2021-12-13)
|
|
79
|
+
|
|
80
|
+
**Note:** Version bump only for package @pie-element/hotspot-configure
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## [4.6.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@4.6.1...@pie-element/hotspot-configure@4.6.2) (2021-11-29)
|
|
87
|
+
|
|
88
|
+
**Note:** Version bump only for package @pie-element/hotspot-configure
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## [4.6.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@4.6.0...@pie-element/hotspot-configure@4.6.1) (2021-10-04)
|
|
95
|
+
|
|
96
|
+
**Note:** Version bump only for package @pie-element/hotspot-configure
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
# [4.6.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@4.5.1...@pie-element/hotspot-configure@4.6.0) (2021-09-20)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
### Bug Fixes
|
|
106
|
+
|
|
107
|
+
* pie-lib updates ([e521c2f](https://github.com/pie-framework/pie-elements/commit/e521c2f1a44aa7f3e14f82a1cee05ceb484ed0a6))
|
|
108
|
+
* Updated pie-lib versions ([2fe4c5d](https://github.com/pie-framework/pie-elements/commit/2fe4c5d0be2d40f5fdb34815855695a7f1087f56))
|
|
109
|
+
* Updated pie-lib versions ([1c23830](https://github.com/pie-framework/pie-elements/commit/1c23830fc75d1de5f7bb3bb16de3c665ae5fa350))
|
|
110
|
+
* **hotspot:** Added a max width when loading a new image PD-261 ([7fcbb8a](https://github.com/pie-framework/pie-elements/commit/7fcbb8a896f73024053a97075d8cb368b8bb6b71))
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
### Features
|
|
114
|
+
|
|
115
|
+
* **hotspot:** add the possibility to paste image in authoring PD-478 ([16f1198](https://github.com/pie-framework/pie-elements/commit/16f1198ea5a839759f626927f1b65b5483a9aa85))
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
## [4.5.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@4.5.0...@pie-element/hotspot-configure@4.5.1) (2021-09-01)
|
|
122
|
+
|
|
123
|
+
**Note:** Version bump only for package @pie-element/hotspot-configure
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
# [4.5.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@4.4.25...@pie-element/hotspot-configure@4.5.0) (2021-08-05)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
### Features
|
|
133
|
+
|
|
134
|
+
* **hotspot:** Added option to set toolbar editor position ([a36faea](https://github.com/pie-framework/pie-elements/commit/a36faea1cc0cb9ed5574fcb860941eea298b1cd3))
|
|
135
|
+
* **hotspot:** toolbar editor position - change double quotes into single quotes ([722ec64](https://github.com/pie-framework/pie-elements/commit/722ec64c1f87f69f2c086e80923d0c137b4aad39))
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
6
141
|
## [4.4.25](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@4.4.23...@pie-element/hotspot-configure@4.4.25) (2021-08-05)
|
|
7
142
|
|
|
8
143
|
|
|
@@ -7,6 +7,7 @@ exports["default"] = void 0;
|
|
|
7
7
|
var _default = {
|
|
8
8
|
model: {
|
|
9
9
|
prompt: 'This is the question prompt',
|
|
10
|
+
toolbarEditorPosition: 'bottom',
|
|
10
11
|
promptEnabled: true,
|
|
11
12
|
imageUrl: '',
|
|
12
13
|
shapes: {
|
|
@@ -45,6 +46,11 @@ var _default = {
|
|
|
45
46
|
settings: true,
|
|
46
47
|
label: 'Prompt'
|
|
47
48
|
},
|
|
49
|
+
spellCheck: {
|
|
50
|
+
label: 'Spellcheck',
|
|
51
|
+
settings: false,
|
|
52
|
+
enabled: true
|
|
53
|
+
},
|
|
48
54
|
teacherInstructions: {
|
|
49
55
|
settings: true,
|
|
50
56
|
label: 'Teacher Instructions'
|
|
@@ -53,6 +59,17 @@ var _default = {
|
|
|
53
59
|
settings: false,
|
|
54
60
|
enabled: true,
|
|
55
61
|
label: 'Preserve aspect ratio'
|
|
62
|
+
},
|
|
63
|
+
minShapes: 2,
|
|
64
|
+
maxImageWidth: {
|
|
65
|
+
teacherInstructions: 300,
|
|
66
|
+
prompt: 300,
|
|
67
|
+
rationale: 300
|
|
68
|
+
},
|
|
69
|
+
maxImageHeight: {
|
|
70
|
+
teacherInstructions: 300,
|
|
71
|
+
prompt: 300,
|
|
72
|
+
rationale: 300
|
|
56
73
|
}
|
|
57
74
|
}
|
|
58
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defaults.js"],"names":["model","prompt","promptEnabled","imageUrl","shapes","rectangles","polygons","multipleCorrect","partialScoring","dimensions","height","width","hotspotColor","hotspotList","outlineColor","outlineList","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","strokeWidth","configuration","settings","label","rationale","teacherInstructions","preserveAspectRatio","
|
|
1
|
+
{"version":3,"sources":["../src/defaults.js"],"names":["model","prompt","toolbarEditorPosition","promptEnabled","imageUrl","shapes","rectangles","polygons","multipleCorrect","partialScoring","dimensions","height","width","hotspotColor","hotspotList","outlineColor","outlineList","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","strokeWidth","configuration","settings","label","rationale","spellCheck","enabled","teacherInstructions","preserveAspectRatio","minShapes","maxImageWidth","maxImageHeight"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,MAAM,EAAE,6BADH;AAELC,IAAAA,qBAAqB,EAAE,QAFlB;AAGLC,IAAAA,aAAa,EAAE,IAHV;AAILC,IAAAA,QAAQ,EAAE,EAJL;AAKLC,IAAAA,MAAM,EAAE;AACNC,MAAAA,UAAU,EAAE,EADN;AAENC,MAAAA,QAAQ,EAAE;AAFJ,KALH;AASLC,IAAAA,eAAe,EAAE,IATZ;AAULC,IAAAA,cAAc,EAAE,KAVX;AAWLC,IAAAA,UAAU,EAAE;AACVC,MAAAA,MAAM,EAAE,CADE;AAEVC,MAAAA,KAAK,EAAE;AAFG,KAXP;AAeLC,IAAAA,YAAY,EAAE,2BAfT;AAgBLC,IAAAA,WAAW,EAAE,CACX,2BADW,CAhBR;AAmBLC,IAAAA,YAAY,EAAE,MAnBT;AAoBLC,IAAAA,WAAW,EAAE,CACX,MADW,CApBR;AAuBLC,IAAAA,gBAAgB,EAAE,IAvBb;AAwBLC,IAAAA,0BAA0B,EAAE,IAxBvB;AAyBLC,IAAAA,0BAA0B,EAAE,IAzBvB;AA0BLC,IAAAA,WAAW,EAAE;AA1BR,GADM;AA6BbC,EAAAA,aAAa,EAAE;AACbb,IAAAA,eAAe,EAAE;AACfc,MAAAA,QAAQ,EAAE,IADK;AAEfC,MAAAA,KAAK,EAAE;AAFQ,KADJ;AAKbd,IAAAA,cAAc,EAAE;AACda,MAAAA,QAAQ,EAAE,KADI;AAEdC,MAAAA,KAAK,EAAE;AAFO,KALH;AASbC,IAAAA,SAAS,EAAE;AACTF,MAAAA,QAAQ,EAAE,IADD;AAETC,MAAAA,KAAK,EAAE;AAFE,KATE;AAabtB,IAAAA,MAAM,EAAE;AACNqB,MAAAA,QAAQ,EAAE,IADJ;AAENC,MAAAA,KAAK,EAAE;AAFD,KAbK;AAiBbE,IAAAA,UAAU,EAAE;AACVF,MAAAA,KAAK,EAAE,YADG;AAEVD,MAAAA,QAAQ,EAAC,KAFC;AAGVI,MAAAA,OAAO,EAAC;AAHE,KAjBC;AAsBbC,IAAAA,mBAAmB,EAAE;AACnBL,MAAAA,QAAQ,EAAE,IADS;AAEnBC,MAAAA,KAAK,EAAE;AAFY,KAtBR;AA0BbK,IAAAA,mBAAmB,EAAE;AACnBN,MAAAA,QAAQ,EAAE,KADS;AAEnBI,MAAAA,OAAO,EAAE,IAFU;AAGnBH,MAAAA,KAAK,EAAE;AAHY,KA1BR;AA+BbM,IAAAA,SAAS,EAAE,CA/BE;AAgCbC,IAAAA,aAAa,EAAE;AACbH,MAAAA,mBAAmB,EAAE,GADR;AAEb1B,MAAAA,MAAM,EAAE,GAFK;AAGbuB,MAAAA,SAAS,EAAE;AAHE,KAhCF;AAqCbO,IAAAA,cAAc,EAAE;AACdJ,MAAAA,mBAAmB,EAAE,GADP;AAEd1B,MAAAA,MAAM,EAAE,GAFM;AAGduB,MAAAA,SAAS,EAAE;AAHG;AArCH;AA7BF,C","sourcesContent":["export default {\n model: {\n prompt: 'This is the question prompt',\n toolbarEditorPosition: 'bottom',\n promptEnabled: true,\n imageUrl: '',\n shapes: {\n rectangles: [],\n polygons: []\n },\n multipleCorrect: true,\n partialScoring: false,\n dimensions: {\n height: 0,\n width: 0\n },\n hotspotColor: 'rgba(137, 183, 244, 0.65)',\n hotspotList: [\n 'rgba(137, 183, 244, 0.65)'\n ],\n outlineColor: 'blue',\n outlineList: [\n 'blue'\n ],\n rationaleEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n strokeWidth: 5\n },\n configuration: {\n multipleCorrect: {\n settings: true,\n label: 'Multiple Correct Responses'\n },\n partialScoring: {\n settings: false,\n label: 'Allow Partial Scoring'\n },\n rationale: {\n settings: true,\n label: 'Rationale'\n },\n prompt: {\n settings: true,\n label: 'Prompt'\n },\n spellCheck: {\n label: 'Spellcheck',\n settings:false,\n enabled:true\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions'\n },\n preserveAspectRatio: {\n settings: false,\n enabled: true,\n label: 'Preserve aspect ratio'\n },\n minShapes: 2,\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n }\n }\n};\n"],"file":"defaults.js"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
@@ -41,13 +41,17 @@ var _uploadControl = _interopRequireDefault(require("./upload-control"));
|
|
|
41
41
|
|
|
42
42
|
var _utils = require("./utils");
|
|
43
43
|
|
|
44
|
-
function
|
|
44
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
45
|
+
|
|
46
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
47
|
+
|
|
48
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
45
49
|
|
|
46
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
50
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
47
51
|
|
|
48
52
|
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); }; }
|
|
49
53
|
|
|
50
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
54
|
+
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; } }
|
|
51
55
|
|
|
52
56
|
var isImage = function isImage(file) {
|
|
53
57
|
var imageType = /image.*/;
|
|
@@ -89,6 +93,13 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
89
93
|
dropzoneActive: false
|
|
90
94
|
});
|
|
91
95
|
});
|
|
96
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleOnPaste", function (e) {
|
|
97
|
+
var files = e.clipboardData.files;
|
|
98
|
+
|
|
99
|
+
if (files && isImage(files[0])) {
|
|
100
|
+
_this.handleFileRead(files[0]);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
92
103
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleOnDrop", function (e) {
|
|
93
104
|
e.preventDefault();
|
|
94
105
|
var _e$dataTransfer = e.dataTransfer,
|
|
@@ -200,7 +211,8 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
200
211
|
onDragExit: this.handleOnDragExit,
|
|
201
212
|
onDragLeave: this.handleOnDragExit,
|
|
202
213
|
onDragOver: this.handleOnDragOver,
|
|
203
|
-
onDrop: this.handleOnDrop
|
|
214
|
+
onDrop: this.handleOnDrop,
|
|
215
|
+
onPaste: this.handleOnPaste
|
|
204
216
|
} : {}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
205
217
|
className: classes.toolbar
|
|
206
218
|
}, imageUrl && /*#__PURE__*/_react["default"].createElement(_uploadControl["default"], {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hotspot-container.jsx"],"names":["isImage","file","imageType","type","match","Container","props","onImageUpload","reader","FileReader","onloadend","result","readAsDataURL","e","preventDefault","handleFileRead","target","files","setState","dropzoneActive","dataTransfer","items","kind","getAsFile","disableDropzone","state","enableDropzone","newShapes","onUpdateShapes","shapes","length","sort","a","b","parseInt","index","slice","dragEnabled","input","click","showTooltip","classes","dimensions","hotspotColor","imageUrl","multipleCorrect","onUpdateImageDimension","outlineColor","strokeWidth","preserveAspectRatioEnabled","base","box","boxActive","onDragExit","handleOnDragExit","onDragLeave","onDragOver","handleOnDragOver","onDrop","handleOnDrop","toolbar","replaceButton","replaceSection","handleInputClick","handleUploadImage","ref","handleUndo","handleClearAll","imageSection","drawableHeight","handleDisableDrag","handleEnableDrag","centered","tooltip","tooltipContent","tooltipArrow","icon","toggleTooltip","nextProps","prevState","Component","styles","theme","marginTop","spacing","unit","border","borderRadius","alignItems","display","flexDirection","justifyContent","minHeight","paddingBottom","paddingRight","color","cursor","marginLeft","marginRight","backgroundColor","borderBottom","borderTopLeftRadius","borderTopRightRadius","padding","position","textAlign","background","fontSize","lineHeight","right","width","height","borderLeft","borderRight","borderTop","marginBottom","propTypes","PropTypes","object","isRequired","string","bool","func","shape","rectangles","array","polygons","number","defaultProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAAU;AACxB,MAAMC,SAAS,GAAG,SAAlB;AACA,SAAOD,IAAI,CAACE,IAAL,CAAUC,KAAV,CAAgBF,SAAhB,CAAP;AACD,CAHD;;IAKaG,S;;;;;AASX,qBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;AADiB,uG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,EAAAA,YAAY,EAAEsE,sBAAUG,MAAV,CAAiBD,UATX;AAUpB1F,EAAAA,MAAM,EAAEwF,sBAAUM,KAAV,CAAgB;AACtBC,IAAAA,UAAU,EAAEP,sBAAUQ,KADA;AAEtBC,IAAAA,QAAQ,EAAET,sBAAUQ;AAFE,GAAhB,EAGLN,UAbiB;AAcpBvE,EAAAA,WAAW,EAAEqE,sBAAUU,MAdH;AAepB9E,EAAAA,0BAA0B,EAAEoE,sBAAUI;AAflB,CAAtB;AAiBApH,SAAS,CAAC2H,YAAV,GAAyB;AACvBhF,EAAAA,WAAW,EAAE;AADU,CAAzB;;eAKe,uBAAWiC,MAAX,EAAmB5E,SAAnB,C","sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles/index';\nimport Help from '@material-ui/icons/Help';\n\nimport Drawable from './hotspot-drawable';\nimport Button from './button';\nimport UploadControl from './upload-control';\nimport { getAllShapes, groupShapes } from './utils';\n\nconst isImage = (file) => {\n const imageType = /image.*/;\n return file.type.match(imageType);\n};\n\nexport class Container extends Component {\n static getDerivedStateFromProps(nextProps, prevState) {\n // always transform shapes map into shapes array at this level\n return {\n ...prevState,\n shapes: getAllShapes(nextProps.shapes),\n }\n }\n\n constructor(props) {\n super(props);\n\n this.state = {\n dragEnabled: true,\n // always transform shapes map into shapes array at this level\n shapes: getAllShapes(props.shapes)\n }\n }\n\n handleFileRead = (file) => {\n const { onImageUpload } = this.props;\n const reader = new FileReader();\n\n reader.onloadend = () => onImageUpload(reader.result);\n reader.readAsDataURL(file)\n };\n\n handleUploadImage = (e) => {\n e.preventDefault();\n\n this.handleFileRead(e.target.files[0]);\n };\n\n enableDropzone = () => this.setState({ dropzoneActive: true });\n disableDropzone = () => this.setState({ dropzoneActive: false });\n\n handleOnDrop = (e) => {\n e.preventDefault();\n\n const { items, files } = e.dataTransfer;\n\n if (items && items[0].kind === 'file') {\n const file = items[0].getAsFile();\n\n if (isImage(file)) {\n this.handleFileRead(file);\n }\n } else if (isImage(files[0])) {\n this.handleFileRead(files[0]);\n }\n this.disableDropzone();\n };\n\n handleOnDragOver = (e) => {\n e.preventDefault();\n\n const { dropzoneActive } = this.state;\n\n if (!dropzoneActive) {\n this.enableDropzone();\n }\n };\n\n handleOnDragExit = (e) => {\n e.preventDefault();\n\n this.disableDropzone();\n };\n\n onUpdateShapes = newShapes => {\n const { onUpdateShapes } = this.props;\n\n this.setState(\n { shapes: newShapes },\n // always transform shapes array back into shapes map when saving changes\n () => onUpdateShapes(groupShapes(newShapes))\n );\n };\n\n handleUndo = () => {\n const { shapes } = this.state;\n\n if (shapes && shapes.length) {\n // sort by index value\n let newShapes = shapes.sort((a, b) => (parseInt(a.index) - parseInt(b.index)));\n\n newShapes = newShapes ? newShapes.slice(0, newShapes.length - 1) : [];\n\n this.onUpdateShapes(newShapes);\n }\n };\n\n handleClearAll = () => this.onUpdateShapes([]);\n\n handleEnableDrag = () => this.setState({ dragEnabled: true });\n handleDisableDrag = () => this.setState({ dragEnabled: false });\n handleInputClick = () => this.input.click();\n\n toggleTooltip = () => this.setState({ showTooltip: !this.state.showTooltip });\n\n render() {\n const {\n classes,\n dimensions,\n hotspotColor,\n imageUrl,\n multipleCorrect,\n onUpdateImageDimension,\n outlineColor,\n strokeWidth,\n preserveAspectRatioEnabled\n } = this.props;\n const {\n dropzoneActive,\n dragEnabled,\n showTooltip\n } = this.state;\n const { shapes } = this.state;\n\n return (\n <div className={classes.base}>\n <div className={`${classes.box} ${dropzoneActive ? classes.boxActive : ''}`}\n {...dragEnabled ? {\n onDragExit: this.handleOnDragExit,\n onDragLeave: this.handleOnDragExit,\n onDragOver: this.handleOnDragOver,\n onDrop: this.handleOnDrop\n } : {}}\n >\n <div className={classes.toolbar}>\n {imageUrl && (\n <UploadControl\n classNameButton={classes.replaceButton}\n classNameSection={classes.replaceSection}\n label=\"Replace Image\"\n onInputClick={this.handleInputClick}\n onUploadImage={this.handleUploadImage}\n setRef={(ref) => {\n this.input = ref;\n }}\n />\n )}\n <Button\n disabled={!(shapes && shapes.length)}\n onClick={this.handleUndo}\n label=\"Undo\"\n />\n <Button\n disabled={!(shapes && shapes.length)}\n onClick={this.handleClearAll}\n label=\"Clear all\"\n />\n </div>\n\n <div\n ref={ref => {\n this.imageSection = ref;\n }}\n className={classes.drawableHeight}>\n {imageUrl\n ? (\n <Drawable\n dimensions={dimensions}\n disableDrag={this.handleDisableDrag}\n enableDrag={this.handleEnableDrag}\n imageUrl={imageUrl}\n hotspotColor={hotspotColor}\n multipleCorrect={multipleCorrect}\n onUpdateImageDimension={onUpdateImageDimension}\n onUpdateShapes={this.onUpdateShapes}\n outlineColor={outlineColor}\n shapes={shapes}\n strokeWidth={strokeWidth}\n preserveAspectRatioEnabled={preserveAspectRatioEnabled}\n />\n )\n : (\n <div className={`${classes.drawableHeight} ${classes.centered}`}>\n <label>Drag and drop or upload image from computer</label>\n <br/>\n <UploadControl\n label=\"Upload Image\"\n onInputClick={this.handleInputClick}\n onUploadImage={this.handleUploadImage}\n setRef={(ref) => {\n this.input = ref;\n }}\n />\n </div>\n )}\n </div>\n\n {imageUrl && (\n <div className={classes.tooltip}>\n {showTooltip && (\n <div className={classes.tooltipContent}>\n <label>\n Click and drag to create a hotspot. Click the hotspot to mark correct. Click\n again to unmark.\n </label>\n <div className={classes.tooltipArrow}/>\n </div>\n )}\n <Help\n className={classes.icon}\n onMouseOut={this.toggleTooltip}\n onMouseOver={this.toggleTooltip}\n />\n </div>\n )}\n </div>\n </div>\n\n );\n }\n}\n\nconst styles = theme => ({\n base: {\n marginTop: theme.spacing.unit * 2\n },\n box: {\n border: '1px solid #E0E1E6',\n borderRadius: '5px'\n },\n boxActive: {\n border: '1px solid #0032C2'\n },\n centered: {\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center'\n },\n drawableHeight: {\n minHeight: 350,\n paddingBottom: '40px',\n paddingRight: '40px',\n },\n icon: {\n '&:hover': {\n color: '#333131',\n cursor: 'help'\n },\n color: '#C1C1C1'\n },\n replaceButton: {\n marginLeft: 0,\n },\n replaceSection: {\n marginRight: 'auto'\n },\n toolbar: {\n backgroundColor: '#ECEDF1',\n borderBottom: '1px solid #E0E1E6',\n borderTopLeftRadius: '5px',\n borderTopRightRadius: '5px',\n display: 'flex',\n justifyContent: 'flex-end',\n padding: '12px 8px'\n },\n tooltip: {\n position: 'relative',\n textAlign: 'right',\n padding: '5px 9px'\n },\n tooltipContent: {\n background: '#333131',\n borderRadius: '4px',\n color: '#FFFFFF',\n fontSize: '14px',\n lineHeight: '18px',\n marginTop: '-70px',\n padding: '7px 16px',\n position: 'absolute',\n right: '5px',\n textAlign: 'left',\n width: '300px'\n },\n tooltipArrow: {\n width: 0,\n height: 0,\n borderLeft: '10px solid transparent',\n borderRight: '10px solid transparent',\n borderTop: '10px solid #333131',\n marginBottom: -10,\n marginTop: '2px',\n position: 'absolute',\n right: '5px'\n }\n});\n\nContainer.propTypes = {\n classes: PropTypes.object.isRequired,\n dimensions: PropTypes.object.isRequired,\n imageUrl: PropTypes.string.isRequired,\n hotspotColor: PropTypes.string.isRequired,\n multipleCorrect: PropTypes.bool.isRequired,\n onImageUpload: PropTypes.func.isRequired,\n onUpdateImageDimension: PropTypes.func.isRequired,\n onUpdateShapes: PropTypes.func.isRequired,\n outlineColor: PropTypes.string.isRequired,\n shapes: PropTypes.shape({\n rectangles: PropTypes.array,\n polygons: PropTypes.array\n }).isRequired,\n strokeWidth: PropTypes.number,\n preserveAspectRatioEnabled: PropTypes.bool\n};\nContainer.defaultProps = {\n strokeWidth: 5\n};\n\n\nexport default withStyles(styles)(Container);\n"],"file":"hotspot-container.js"}
|
|
1
|
+
{"version":3,"sources":["../src/hotspot-container.jsx"],"names":["isImage","file","imageType","type","match","Container","props","onImageUpload","reader","FileReader","onloadend","result","readAsDataURL","e","preventDefault","handleFileRead","target","files","setState","dropzoneActive","clipboardData","dataTransfer","items","kind","getAsFile","disableDropzone","state","enableDropzone","newShapes","onUpdateShapes","shapes","length","sort","a","b","parseInt","index","slice","dragEnabled","input","click","showTooltip","classes","dimensions","hotspotColor","imageUrl","multipleCorrect","onUpdateImageDimension","outlineColor","strokeWidth","preserveAspectRatioEnabled","base","box","boxActive","onDragExit","handleOnDragExit","onDragLeave","onDragOver","handleOnDragOver","onDrop","handleOnDrop","onPaste","handleOnPaste","toolbar","replaceButton","replaceSection","handleInputClick","handleUploadImage","ref","handleUndo","handleClearAll","imageSection","drawableHeight","handleDisableDrag","handleEnableDrag","centered","tooltip","tooltipContent","tooltipArrow","icon","toggleTooltip","nextProps","prevState","Component","styles","theme","marginTop","spacing","unit","border","borderRadius","alignItems","display","flexDirection","justifyContent","minHeight","paddingBottom","paddingRight","color","cursor","marginLeft","marginRight","backgroundColor","borderBottom","borderTopLeftRadius","borderTopRightRadius","padding","position","textAlign","background","fontSize","lineHeight","right","width","height","borderLeft","borderRight","borderTop","marginBottom","propTypes","PropTypes","object","isRequired","string","bool","func","shape","rectangles","array","polygons","number","defaultProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;AAEA,IAAMA,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAAU;AACxB,MAAMC,SAAS,GAAG,SAAlB;AACA,SAAOD,IAAI,CAACE,IAAL,CAAUC,KAAV,CAAgBF,SAAhB,CAAP;AACD,CAHD;;IAKaG,S;;;;;AASX,qBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;AADiB,uGAUF,UAACL,IAAD,EAAU;AACzB,UAAQM,aAAR,GAA0B,MAAKD,KAA/B,CAAQC,aAAR;AACA,UAAMC,MAAM,GAAG,IAAIC,UAAJ,EAAf;;AAEAD,MAAAA,MAAM,CAACE,SAAP,GAAmB;AAAA,eAAMH,aAAa,CAACC,MAAM,CAACG,MAAR,CAAnB;AAAA,OAAnB;;AACAH,MAAAA,MAAM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A,cAAc,EAAE2F,sBAAUK,IAAV,CAAeH,UARX;AASpB1E,EAAAA,YAAY,EAAEwE,sBAAUG,MAAV,CAAiBD,UATX;AAUpB5F,EAAAA,MAAM,EAAE0F,sBAAUM,KAAV,CAAgB;AACtBC,IAAAA,UAAU,EAAEP,sBAAUQ,KADA;AAEtBC,IAAAA,QAAQ,EAAET,sBAAUQ;AAFE,GAAhB,EAGLN,UAbiB;AAcpBzE,EAAAA,WAAW,EAAEuE,sBAAUU,MAdH;AAepBhF,EAAAA,0BAA0B,EAAEsE,sBAAUI;AAflB,CAAtB;AAiBAvH,SAAS,CAAC8H,YAAV,GAAyB;AACvBlF,EAAAA,WAAW,EAAE;AADU,CAAzB;;eAKe,uBAAWmC,MAAX,EAAmB/E,SAAnB,C","sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles/index';\nimport Help from '@material-ui/icons/Help';\n\nimport Drawable from './hotspot-drawable';\nimport Button from './button';\nimport UploadControl from './upload-control';\nimport { getAllShapes, groupShapes } from './utils';\n\nconst isImage = (file) => {\n const imageType = /image.*/;\n return file.type.match(imageType);\n};\n\nexport class Container extends Component {\n static getDerivedStateFromProps(nextProps, prevState) {\n // always transform shapes map into shapes array at this level\n return {\n ...prevState,\n shapes: getAllShapes(nextProps.shapes),\n }\n }\n\n constructor(props) {\n super(props);\n\n this.state = {\n dragEnabled: true,\n // always transform shapes map into shapes array at this level\n shapes: getAllShapes(props.shapes)\n }\n }\n\n handleFileRead = (file) => {\n const { onImageUpload } = this.props;\n const reader = new FileReader();\n\n reader.onloadend = () => onImageUpload(reader.result);\n reader.readAsDataURL(file)\n };\n\n handleUploadImage = (e) => {\n e.preventDefault();\n\n this.handleFileRead(e.target.files[0]);\n };\n\n enableDropzone = () => this.setState({ dropzoneActive: true });\n disableDropzone = () => this.setState({ dropzoneActive: false });\n\n handleOnPaste = (e) => {\n const { files } = e.clipboardData;\n\n if (files && isImage(files[0])) {\n this.handleFileRead(files[0]);\n }\n };\n\n handleOnDrop = (e) => {\n e.preventDefault();\n\n const { items, files } = e.dataTransfer;\n\n if (items && items[0].kind === 'file') {\n const file = items[0].getAsFile();\n\n if (isImage(file)) {\n this.handleFileRead(file);\n }\n } else if (isImage(files[0])) {\n this.handleFileRead(files[0]);\n }\n this.disableDropzone();\n };\n\n handleOnDragOver = (e) => {\n e.preventDefault();\n\n const { dropzoneActive } = this.state;\n\n if (!dropzoneActive) {\n this.enableDropzone();\n }\n };\n\n handleOnDragExit = (e) => {\n e.preventDefault();\n\n this.disableDropzone();\n };\n\n onUpdateShapes = newShapes => {\n const { onUpdateShapes } = this.props;\n\n this.setState(\n { shapes: newShapes },\n // always transform shapes array back into shapes map when saving changes\n () => onUpdateShapes(groupShapes(newShapes))\n );\n };\n\n handleUndo = () => {\n const { shapes } = this.state;\n\n if (shapes && shapes.length) {\n // sort by index value\n let newShapes = shapes.sort((a, b) => (parseInt(a.index) - parseInt(b.index)));\n\n newShapes = newShapes ? newShapes.slice(0, newShapes.length - 1) : [];\n\n this.onUpdateShapes(newShapes);\n }\n };\n\n handleClearAll = () => this.onUpdateShapes([]);\n\n handleEnableDrag = () => this.setState({ dragEnabled: true });\n handleDisableDrag = () => this.setState({ dragEnabled: false });\n handleInputClick = () => this.input.click();\n\n toggleTooltip = () => this.setState({ showTooltip: !this.state.showTooltip });\n\n render() {\n const {\n classes,\n dimensions,\n hotspotColor,\n imageUrl,\n multipleCorrect,\n onUpdateImageDimension,\n outlineColor,\n strokeWidth,\n preserveAspectRatioEnabled\n } = this.props;\n const {\n dropzoneActive,\n dragEnabled,\n showTooltip\n } = this.state;\n const { shapes } = this.state;\n\n return (\n <div className={classes.base}>\n <div className={`${classes.box} ${dropzoneActive ? classes.boxActive : ''}`}\n {...dragEnabled ? {\n onDragExit: this.handleOnDragExit,\n onDragLeave: this.handleOnDragExit,\n onDragOver: this.handleOnDragOver,\n onDrop: this.handleOnDrop,\n onPaste: this.handleOnPaste\n } : {}}\n >\n <div className={classes.toolbar}>\n {imageUrl && (\n <UploadControl\n classNameButton={classes.replaceButton}\n classNameSection={classes.replaceSection}\n label=\"Replace Image\"\n onInputClick={this.handleInputClick}\n onUploadImage={this.handleUploadImage}\n setRef={(ref) => {\n this.input = ref;\n }}\n />\n )}\n <Button\n disabled={!(shapes && shapes.length)}\n onClick={this.handleUndo}\n label=\"Undo\"\n />\n <Button\n disabled={!(shapes && shapes.length)}\n onClick={this.handleClearAll}\n label=\"Clear all\"\n />\n </div>\n\n <div\n ref={ref => {\n this.imageSection = ref;\n }}\n className={classes.drawableHeight}>\n {imageUrl\n ? (\n <Drawable\n dimensions={dimensions}\n disableDrag={this.handleDisableDrag}\n enableDrag={this.handleEnableDrag}\n imageUrl={imageUrl}\n hotspotColor={hotspotColor}\n multipleCorrect={multipleCorrect}\n onUpdateImageDimension={onUpdateImageDimension}\n onUpdateShapes={this.onUpdateShapes}\n outlineColor={outlineColor}\n shapes={shapes}\n strokeWidth={strokeWidth}\n preserveAspectRatioEnabled={preserveAspectRatioEnabled}\n />\n )\n : (\n <div className={`${classes.drawableHeight} ${classes.centered}`}>\n <label>Drag and drop or upload image from computer</label>\n <br/>\n <UploadControl\n label=\"Upload Image\"\n onInputClick={this.handleInputClick}\n onUploadImage={this.handleUploadImage}\n setRef={(ref) => {\n this.input = ref;\n }}\n />\n </div>\n )}\n </div>\n\n {imageUrl && (\n <div className={classes.tooltip}>\n {showTooltip && (\n <div className={classes.tooltipContent}>\n <label>\n Click and drag to create a hotspot. Click the hotspot to mark correct. Click\n again to unmark.\n </label>\n <div className={classes.tooltipArrow}/>\n </div>\n )}\n <Help\n className={classes.icon}\n onMouseOut={this.toggleTooltip}\n onMouseOver={this.toggleTooltip}\n />\n </div>\n )}\n </div>\n </div>\n\n );\n }\n}\n\nconst styles = theme => ({\n base: {\n marginTop: theme.spacing.unit * 2\n },\n box: {\n border: '1px solid #E0E1E6',\n borderRadius: '5px'\n },\n boxActive: {\n border: '1px solid #0032C2'\n },\n centered: {\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center'\n },\n drawableHeight: {\n minHeight: 350,\n paddingBottom: '40px',\n paddingRight: '40px',\n },\n icon: {\n '&:hover': {\n color: '#333131',\n cursor: 'help'\n },\n color: '#C1C1C1'\n },\n replaceButton: {\n marginLeft: 0,\n },\n replaceSection: {\n marginRight: 'auto'\n },\n toolbar: {\n backgroundColor: '#ECEDF1',\n borderBottom: '1px solid #E0E1E6',\n borderTopLeftRadius: '5px',\n borderTopRightRadius: '5px',\n display: 'flex',\n justifyContent: 'flex-end',\n padding: '12px 8px'\n },\n tooltip: {\n position: 'relative',\n textAlign: 'right',\n padding: '5px 9px'\n },\n tooltipContent: {\n background: '#333131',\n borderRadius: '4px',\n color: '#FFFFFF',\n fontSize: '14px',\n lineHeight: '18px',\n marginTop: '-70px',\n padding: '7px 16px',\n position: 'absolute',\n right: '5px',\n textAlign: 'left',\n width: '300px'\n },\n tooltipArrow: {\n width: 0,\n height: 0,\n borderLeft: '10px solid transparent',\n borderRight: '10px solid transparent',\n borderTop: '10px solid #333131',\n marginBottom: -10,\n marginTop: '2px',\n position: 'absolute',\n right: '5px'\n }\n});\n\nContainer.propTypes = {\n classes: PropTypes.object.isRequired,\n dimensions: PropTypes.object.isRequired,\n imageUrl: PropTypes.string.isRequired,\n hotspotColor: PropTypes.string.isRequired,\n multipleCorrect: PropTypes.bool.isRequired,\n onImageUpload: PropTypes.func.isRequired,\n onUpdateImageDimension: PropTypes.func.isRequired,\n onUpdateShapes: PropTypes.func.isRequired,\n outlineColor: PropTypes.string.isRequired,\n shapes: PropTypes.shape({\n rectangles: PropTypes.array,\n polygons: PropTypes.array\n }).isRequired,\n strokeWidth: PropTypes.number,\n preserveAspectRatioEnabled: PropTypes.bool\n};\nContainer.defaultProps = {\n strokeWidth: 5\n};\n\n\nexport default withStyles(styles)(Container);\n"],"file":"hotspot-container.js"}
|
|
@@ -41,13 +41,15 @@ var _hotspotPolygon = _interopRequireDefault(require("./hotspot-polygon"));
|
|
|
41
41
|
|
|
42
42
|
var _utils = require("./utils");
|
|
43
43
|
|
|
44
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
44
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
45
45
|
|
|
46
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
46
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
47
47
|
|
|
48
48
|
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); }; }
|
|
49
49
|
|
|
50
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
50
|
+
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; } }
|
|
51
|
+
|
|
52
|
+
var IMAGE_MAX_WIDTH = 800;
|
|
51
53
|
|
|
52
54
|
var Drawable = /*#__PURE__*/function (_React$Component) {
|
|
53
55
|
(0, _inherits2["default"])(Drawable, _React$Component);
|
|
@@ -185,7 +187,11 @@ var Drawable = /*#__PURE__*/function (_React$Component) {
|
|
|
185
187
|
var elementStyle = getComputedStyle(target);
|
|
186
188
|
var newHeight = parseFloat(elementStyle.height);
|
|
187
189
|
var newWidth = parseFloat(elementStyle.width);
|
|
188
|
-
var
|
|
190
|
+
var aspectWidth = newWidth / IMAGE_MAX_WIDTH;
|
|
191
|
+
var dimensions = newWidth > IMAGE_MAX_WIDTH ? {
|
|
192
|
+
height: newHeight / aspectWidth,
|
|
193
|
+
width: IMAGE_MAX_WIDTH
|
|
194
|
+
} : {
|
|
189
195
|
height: newHeight,
|
|
190
196
|
width: newWidth
|
|
191
197
|
};
|
|
@@ -222,7 +228,7 @@ var Drawable = /*#__PURE__*/function (_React$Component) {
|
|
|
222
228
|
|
|
223
229
|
var hasMinimumWidth = width > 150 && height > 150;
|
|
224
230
|
|
|
225
|
-
if (resizeValid && hasMinimumWidth) {
|
|
231
|
+
if (resizeValid && hasMinimumWidth && box) {
|
|
226
232
|
box.style.width = "".concat(width, "px");
|
|
227
233
|
box.style.height = "".concat(height, "px");
|
|
228
234
|
|