@pie-element/drawing-response 3.7.3-next.133 → 3.7.3-next.1332

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.
Files changed (67) hide show
  1. package/CHANGELOG.md +242 -0
  2. package/configure/CHANGELOG.md +200 -0
  3. package/configure/lib/defaults.js +20 -2
  4. package/configure/lib/defaults.js.map +1 -1
  5. package/configure/lib/image-container.js +44 -24
  6. package/configure/lib/image-container.js.map +1 -1
  7. package/configure/lib/index.js +17 -9
  8. package/configure/lib/index.js.map +1 -1
  9. package/configure/lib/root.js +50 -11
  10. package/configure/lib/root.js.map +1 -1
  11. package/configure/package.json +4 -4
  12. package/configure/src/__tests__/__snapshots__/image-container.test.jsx.snap +3 -2
  13. package/configure/src/__tests__/__snapshots__/root.test.jsx.snap +32 -14
  14. package/configure/src/__tests__/image-container.test.jsx +2 -2
  15. package/configure/src/defaults.js +20 -2
  16. package/configure/src/image-container.jsx +82 -50
  17. package/configure/src/index.js +14 -6
  18. package/configure/src/root.jsx +58 -25
  19. package/controller/CHANGELOG.md +24 -0
  20. package/controller/lib/index.js +13 -9
  21. package/controller/lib/index.js.map +1 -1
  22. package/controller/package.json +1 -1
  23. package/controller/src/__tests__/index.test.js +18 -9
  24. package/controller/src/index.js +4 -1
  25. package/docs/config-schema.json +95 -0
  26. package/docs/config-schema.json.md +73 -1
  27. package/docs/demo/generate.js +3 -1
  28. package/docs/pie-schema.json +39 -0
  29. package/docs/pie-schema.json.md +28 -0
  30. package/lib/drawing-response/container.js +78 -23
  31. package/lib/drawing-response/container.js.map +1 -1
  32. package/lib/drawing-response/drawable-circle.js +1 -1
  33. package/lib/drawing-response/drawable-circle.js.map +1 -1
  34. package/lib/drawing-response/drawable-eraser.js +1 -1
  35. package/lib/drawing-response/drawable-eraser.js.map +1 -1
  36. package/lib/drawing-response/drawable-free-path.js +1 -1
  37. package/lib/drawing-response/drawable-free-path.js.map +1 -1
  38. package/lib/drawing-response/drawable-helper.js.map +1 -1
  39. package/lib/drawing-response/drawable-image.js +1 -0
  40. package/lib/drawing-response/drawable-image.js.map +1 -1
  41. package/lib/drawing-response/drawable-line.js +1 -1
  42. package/lib/drawing-response/drawable-line.js.map +1 -1
  43. package/lib/drawing-response/drawable-main.js +45 -16
  44. package/lib/drawing-response/drawable-main.js.map +1 -1
  45. package/lib/drawing-response/drawable-palette.js +1 -1
  46. package/lib/drawing-response/drawable-palette.js.map +1 -1
  47. package/lib/drawing-response/drawable-rectangle.js +1 -1
  48. package/lib/drawing-response/drawable-rectangle.js.map +1 -1
  49. package/lib/drawing-response/drawable-text.js +15 -5
  50. package/lib/drawing-response/drawable-text.js.map +1 -1
  51. package/lib/drawing-response/drawable-transformer.js +1 -1
  52. package/lib/drawing-response/drawable-transformer.js.map +1 -1
  53. package/lib/drawing-response/index.js +9 -9
  54. package/lib/drawing-response/index.js.map +1 -1
  55. package/lib/index.js +4 -1
  56. package/lib/index.js.map +1 -1
  57. package/package.json +4 -4
  58. package/src/drawing-response/__tests__/__snapshots__/container.test.jsx.snap +172 -288
  59. package/src/drawing-response/__tests__/__snapshots__/drawing-main.test.jsx.snap +26 -2
  60. package/src/drawing-response/__tests__/container.test.jsx +7 -0
  61. package/src/drawing-response/__tests__/drawing-main.test.jsx +2 -1
  62. package/src/drawing-response/container.jsx +78 -36
  63. package/src/drawing-response/drawable-image.jsx +1 -0
  64. package/src/drawing-response/drawable-main.jsx +45 -17
  65. package/src/drawing-response/drawable-text.jsx +7 -1
  66. package/src/drawing-response/index.jsx +6 -4
  67. package/src/index.js +5 -0
@@ -12,7 +12,8 @@ describe('controller', () => {
12
12
  height: 0,
13
13
  width: 0
14
14
  },
15
- teacherInstructions: 'Teacher Instructions'
15
+ teacherInstructions: 'Teacher Instructions',
16
+ backgroundImageEnabled: true
16
17
  };
17
18
  });
18
19
 
@@ -56,7 +57,8 @@ describe('controller', () => {
56
57
  imageUrl: question.imageUrl,
57
58
  imageDimensions: question.imageDimensions,
58
59
  prompt: question.prompt,
59
- teacherInstructions: null
60
+ teacherInstructions: null,
61
+ backgroundImageEnabled: question.backgroundImageEnabled
60
62
  });
61
63
  });
62
64
 
@@ -69,7 +71,8 @@ describe('controller', () => {
69
71
  imageUrl: question.imageUrl,
70
72
  imageDimensions: question.imageDimensions,
71
73
  prompt: null,
72
- teacherInstructions: null
74
+ teacherInstructions: null,
75
+ backgroundImageEnabled: question.backgroundImageEnabled
73
76
  });
74
77
  });
75
78
 
@@ -83,7 +86,8 @@ describe('controller', () => {
83
86
  imageUrl: question.imageUrl,
84
87
  imageDimensions: question.imageDimensions,
85
88
  prompt: question.prompt,
86
- teacherInstructions: null
89
+ teacherInstructions: null,
90
+ backgroundImageEnabled: question.backgroundImageEnabled
87
91
  });
88
92
  });
89
93
 
@@ -96,7 +100,8 @@ describe('controller', () => {
96
100
  imageUrl: question.imageUrl,
97
101
  imageDimensions: question.imageDimensions,
98
102
  prompt: question.prompt,
99
- teacherInstructions: question.teacherInstructions
103
+ teacherInstructions: question.teacherInstructions,
104
+ backgroundImageEnabled: question.backgroundImageEnabled
100
105
  });
101
106
  });
102
107
 
@@ -112,7 +117,8 @@ describe('controller', () => {
112
117
  imageUrl: question.imageUrl,
113
118
  imageDimensions: question.imageDimensions,
114
119
  prompt: question.prompt,
115
- teacherInstructions: null
120
+ teacherInstructions: null,
121
+ backgroundImageEnabled: question.backgroundImageEnabled
116
122
  });
117
123
  });
118
124
 
@@ -125,7 +131,8 @@ describe('controller', () => {
125
131
  imageUrl: question.imageUrl,
126
132
  imageDimensions: question.imageDimensions,
127
133
  prompt: question.prompt,
128
- teacherInstructions: null
134
+ teacherInstructions: null,
135
+ backgroundImageEnabled: question.backgroundImageEnabled
129
136
  });
130
137
  });
131
138
 
@@ -138,7 +145,8 @@ describe('controller', () => {
138
145
  imageUrl: question.imageUrl,
139
146
  imageDimensions: question.imageDimensions,
140
147
  prompt: question.prompt,
141
- teacherInstructions: question.teacherInstructions
148
+ teacherInstructions: question.teacherInstructions,
149
+ backgroundImageEnabled: question.backgroundImageEnabled
142
150
  });
143
151
  });
144
152
 
@@ -154,7 +162,8 @@ describe('controller', () => {
154
162
  imageUrl: question.imageUrl,
155
163
  imageDimensions: question.imageDimensions,
156
164
  prompt: question.prompt,
157
- teacherInstructions: null
165
+ teacherInstructions: null,
166
+ backgroundImageEnabled: question.backgroundImageEnabled
158
167
  });
159
168
  });
160
169
  });
@@ -7,6 +7,7 @@ export const normalize = question => ({
7
7
  promptEnabled: true,
8
8
  teacherInstructionsEnabled: true,
9
9
  studentInstructionsEnabled: true,
10
+ backgroundImageEnabled: true,
10
11
  ...question,
11
12
  });
12
13
 
@@ -16,7 +17,8 @@ export function model(question, session, env) {
16
17
  imageUrl,
17
18
  imageDimensions,
18
19
  prompt,
19
- promptEnabled
20
+ promptEnabled,
21
+ backgroundImageEnabled
20
22
  } = normalizedQuestion;
21
23
 
22
24
  return new Promise(resolve => {
@@ -26,6 +28,7 @@ export function model(question, session, env) {
26
28
  imageDimensions,
27
29
  imageUrl,
28
30
  prompt: promptEnabled ? prompt : null,
31
+ backgroundImageEnabled
29
32
  };
30
33
 
31
34
  if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
@@ -40,6 +40,22 @@
40
40
  }
41
41
  }
42
42
  },
43
+ "spellCheck": {
44
+ "title": "ConfigureProp",
45
+ "type": "object",
46
+ "properties": {
47
+ "settings": {
48
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
49
+ "type": "boolean",
50
+ "title": "settings"
51
+ },
52
+ "label": {
53
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
54
+ "type": "string",
55
+ "title": "label"
56
+ }
57
+ }
58
+ },
43
59
  "studentInstructions": {
44
60
  "title": "ConfigureProp",
45
61
  "type": "object",
@@ -72,6 +88,64 @@
72
88
  }
73
89
  }
74
90
  },
91
+ "maxImageWidth": {
92
+ "title": "ConfigureMaxImageDimensionsProp",
93
+ "type": "object",
94
+ "properties": {
95
+ "teacherInstructions": {
96
+ "description": "Indicates the max dimension for images in teacher instructions",
97
+ "type": "number",
98
+ "title": "teacherInstructions"
99
+ },
100
+ "prompt": {
101
+ "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",
102
+ "type": "number",
103
+ "title": "prompt"
104
+ },
105
+ "rationale": {
106
+ "description": "Indicates the max dimension for images in rationale",
107
+ "type": "number",
108
+ "title": "rationale"
109
+ }
110
+ }
111
+ },
112
+ "maxImageHeight": {
113
+ "title": "ConfigureMaxImageDimensionsProp",
114
+ "type": "object",
115
+ "properties": {
116
+ "teacherInstructions": {
117
+ "description": "Indicates the max dimension for images in teacher instructions",
118
+ "type": "number",
119
+ "title": "teacherInstructions"
120
+ },
121
+ "prompt": {
122
+ "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",
123
+ "type": "number",
124
+ "title": "prompt"
125
+ },
126
+ "rationale": {
127
+ "description": "Indicates the max dimension for images in rationale",
128
+ "type": "number",
129
+ "title": "rationale"
130
+ }
131
+ }
132
+ },
133
+ "withRubric": {
134
+ "title": "ConfigureProp",
135
+ "type": "object",
136
+ "properties": {
137
+ "settings": {
138
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
139
+ "type": "boolean",
140
+ "title": "settings"
141
+ },
142
+ "label": {
143
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
144
+ "type": "string",
145
+ "title": "label"
146
+ }
147
+ }
148
+ },
75
149
  "showPrompt": {
76
150
  "description": "Determines whether prompt field will be displayed or not",
77
151
  "default": true,
@@ -122,6 +196,27 @@
122
196
  "title": "label"
123
197
  }
124
198
  }
199
+ },
200
+ "ConfigureMaxImageDimensionsProp": {
201
+ "title": "ConfigureMaxImageDimensionsProp",
202
+ "type": "object",
203
+ "properties": {
204
+ "teacherInstructions": {
205
+ "description": "Indicates the max dimension for images in teacher instructions",
206
+ "type": "number",
207
+ "title": "teacherInstructions"
208
+ },
209
+ "prompt": {
210
+ "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",
211
+ "type": "number",
212
+ "title": "prompt"
213
+ },
214
+ "rationale": {
215
+ "description": "Indicates the max dimension for images in rationale",
216
+ "type": "number",
217
+ "title": "rationale"
218
+ }
219
+ }
125
220
  }
126
221
  },
127
222
  "$schema": "http://json-schema.org/draft-07/schema#"
@@ -31,6 +31,18 @@ Indicates if the item has to be displayed in the Settings Panel
31
31
 
32
32
  Indicates the label for the item that has to be displayed in the Settings Panel
33
33
 
34
+ # `spellCheck` (object)
35
+
36
+ Properties of the `spellCheck` object:
37
+
38
+ ## `settings` (boolean)
39
+
40
+ Indicates if the item has to be displayed in the Settings Panel
41
+
42
+ ## `label` (string)
43
+
44
+ Indicates the label for the item that has to be displayed in the Settings Panel
45
+
34
46
  # `studentInstructions` (object)
35
47
 
36
48
  Properties of the `studentInstructions` object:
@@ -55,6 +67,50 @@ Indicates if the item has to be displayed in the Settings Panel
55
67
 
56
68
  Indicates the label for the item that has to be displayed in the Settings Panel
57
69
 
70
+ # `maxImageWidth` (object)
71
+
72
+ Properties of the `maxImageWidth` object:
73
+
74
+ ## `teacherInstructions` (number)
75
+
76
+ Indicates the max dimension for images in teacher instructions
77
+
78
+ ## `prompt` (number)
79
+
80
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
81
+
82
+ ## `rationale` (number)
83
+
84
+ Indicates the max dimension for images in rationale
85
+
86
+ # `maxImageHeight` (object)
87
+
88
+ Properties of the `maxImageHeight` object:
89
+
90
+ ## `teacherInstructions` (number)
91
+
92
+ Indicates the max dimension for images in teacher instructions
93
+
94
+ ## `prompt` (number)
95
+
96
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
97
+
98
+ ## `rationale` (number)
99
+
100
+ Indicates the max dimension for images in rationale
101
+
102
+ # `withRubric` (object)
103
+
104
+ Properties of the `withRubric` object:
105
+
106
+ ## `settings` (boolean)
107
+
108
+ Indicates if the item has to be displayed in the Settings Panel
109
+
110
+ ## `label` (string)
111
+
112
+ Indicates the label for the item that has to be displayed in the Settings Panel
113
+
58
114
  # `showPrompt` (boolean)
59
115
 
60
116
  Determines whether prompt field will be displayed or not
@@ -100,4 +156,20 @@ Indicates if the item has to be displayed in the Settings Panel
100
156
 
101
157
  ### `label` (string)
102
158
 
103
- Indicates the label for the item that has to be displayed in the Settings Panel
159
+ Indicates the label for the item that has to be displayed in the Settings Panel
160
+
161
+ ## `ConfigureMaxImageDimensionsProp` (object)
162
+
163
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
164
+
165
+ ### `teacherInstructions` (number)
166
+
167
+ Indicates the max dimension for images in teacher instructions
168
+
169
+ ### `prompt` (number)
170
+
171
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
172
+
173
+ ### `rationale` (number)
174
+
175
+ Indicates the max dimension for images in rationale
@@ -3,10 +3,12 @@ exports.model = (id, element) => ({
3
3
  element,
4
4
  prompt: 'This is the question prompt',
5
5
  promptEnabled: true,
6
+ backgroundImageEnabled: true,
6
7
  toolbarEditorPosition: 'bottom',
7
8
  imageUrl: '',
8
9
  imageDimensions: {
9
10
  height: 0,
10
11
  width: 0
11
- }
12
+ },
13
+ rubricEnabled: false
12
14
  });
@@ -63,6 +63,16 @@
63
63
  "type": "boolean",
64
64
  "title": "teacherInstructionsEnabled"
65
65
  },
66
+ "spellCheckEnabled": {
67
+ "description": "Indicates if spellcheck is enabled for the author. Default value is true",
68
+ "type": "boolean",
69
+ "title": "spellCheckEnabled"
70
+ },
71
+ "backgroundImageEnabled": {
72
+ "description": "Indicates if Background Image is enabled",
73
+ "type": "boolean",
74
+ "title": "backgroundImageEnabled"
75
+ },
66
76
  "toolbarEditorPosition": {
67
77
  "description": "Indicates the editor's toolbar position which can be 'bottom' or 'top'",
68
78
  "default": ": 'bottom'",
@@ -73,6 +83,11 @@
73
83
  "type": "string",
74
84
  "title": "toolbarEditorPosition"
75
85
  },
86
+ "rubricEnabled": {
87
+ "description": "Indicates if Rubric is enabled",
88
+ "type": "boolean",
89
+ "title": "rubricEnabled"
90
+ },
76
91
  "id": {
77
92
  "description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
78
93
  "type": "string",
@@ -85,9 +100,12 @@
85
100
  }
86
101
  },
87
102
  "required": [
103
+ "backgroundImageEnabled",
88
104
  "element",
89
105
  "id",
90
106
  "imageDimensions",
107
+ "rubricEnabled",
108
+ "spellCheckEnabled",
91
109
  "studentInstructionsEnabled",
92
110
  "teacherInstructionsEnabled"
93
111
  ],
@@ -129,6 +147,27 @@
129
147
  }
130
148
  }
131
149
  },
150
+ "ConfigureMaxImageDimensionsProp": {
151
+ "title": "ConfigureMaxImageDimensionsProp",
152
+ "type": "object",
153
+ "properties": {
154
+ "teacherInstructions": {
155
+ "description": "Indicates the max dimension for images in teacher instructions",
156
+ "type": "number",
157
+ "title": "teacherInstructions"
158
+ },
159
+ "prompt": {
160
+ "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",
161
+ "type": "number",
162
+ "title": "prompt"
163
+ },
164
+ "rationale": {
165
+ "description": "Indicates the max dimension for images in rationale",
166
+ "type": "number",
167
+ "title": "rationale"
168
+ }
169
+ }
170
+ },
132
171
  "Dimension": {
133
172
  "title": "Dimension",
134
173
  "type": "object",
@@ -46,6 +46,14 @@ Indicates if Student Instructions are enabled
46
46
 
47
47
  Indicates if Teacher Instructions are enabled
48
48
 
49
+ # `spellCheckEnabled` (boolean, required)
50
+
51
+ Indicates if spellcheck is enabled for the author. Default value is true
52
+
53
+ # `backgroundImageEnabled` (boolean, required)
54
+
55
+ Indicates if Background Image is enabled
56
+
49
57
  # `toolbarEditorPosition` (string, enum)
50
58
 
51
59
  Indicates the editor's toolbar position which can be 'bottom' or 'top'
@@ -57,6 +65,10 @@ This element must be one of the following enum values:
57
65
 
58
66
  Default: `": 'bottom'"`
59
67
 
68
+ # `rubricEnabled` (boolean, required)
69
+
70
+ Indicates if Rubric is enabled
71
+
60
72
  # `id` (string, required)
61
73
 
62
74
  Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
@@ -100,6 +112,22 @@ Indicates if the item has to be displayed in the Settings Panel
100
112
 
101
113
  Indicates the label for the item that has to be displayed in the Settings Panel
102
114
 
115
+ ## `ConfigureMaxImageDimensionsProp` (object)
116
+
117
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
118
+
119
+ ### `teacherInstructions` (number)
120
+
121
+ Indicates the max dimension for images in teacher instructions
122
+
123
+ ### `prompt` (number)
124
+
125
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
126
+
127
+ ### `rationale` (number)
128
+
129
+ Indicates the max dimension for images in rationale
130
+
103
131
  ## `Dimension` (object)
104
132
 
105
133
  Properties of the `Dimension` object:
@@ -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
  });
@@ -43,9 +43,13 @@ var _drawableText = _interopRequireDefault(require("./drawable-text"));
43
43
 
44
44
  var _icon = _interopRequireDefault(require("./icon"));
45
45
 
46
+ 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); }
47
+
48
+ 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; }
49
+
46
50
  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); }; }
47
51
 
48
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
52
+ 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; } }
49
53
 
50
54
  var TOOLS = _constants["default"].tools;
51
55
  var ROGVAIV = ['red', 'orange', 'yellow', 'violet', 'blue', 'green', 'white', 'black'].map(function (c) {
@@ -77,6 +81,7 @@ var Container = /*#__PURE__*/function (_Component) {
77
81
  });
78
82
  var TextEntry = new _drawableText["default"]();
79
83
  _this.state = {
84
+ scale: 1,
80
85
  drawableDimensions: {
81
86
  height: 0,
82
87
  width: 0
@@ -132,13 +137,49 @@ var Container = /*#__PURE__*/function (_Component) {
132
137
  }, {
133
138
  key: "componentDidMount",
134
139
  value: function componentDidMount() {
140
+ var _this3 = this;
141
+
135
142
  this.setDimensions();
143
+ this.observer = new MutationObserver(function (mutations) {
144
+ mutations.forEach(function () {
145
+ var _document$getElementB, _document$getElementB2;
146
+
147
+ var target = (_document$getElementB = document.getElementById('question-container')) === null || _document$getElementB === void 0 ? void 0 : (_document$getElementB2 = _document$getElementB.style) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.cssText;
148
+ var zoom = target === null || target === void 0 ? void 0 : target.substring(target.indexOf('--pie-zoom') + 11, target.lastIndexOf('%'));
149
+ var zoomParsed = zoom === null || zoom === void 0 ? void 0 : zoom.replace(/\s/g, '');
150
+
151
+ if (zoomParsed) {
152
+ var newScale = parseFloat(zoomParsed) / 100;
153
+
154
+ if (newScale !== _this3.state.scale) {
155
+ _this3.setState({
156
+ scale: parseFloat(zoomParsed) / 100
157
+ });
158
+ }
159
+ } else if (!zoomParsed && _this3.state.scale !== 1) {
160
+ _this3.setState({
161
+ scale: 1
162
+ });
163
+ }
164
+ });
165
+ });
166
+ var target = document.getElementById('question-container');
167
+
168
+ if (target) {
169
+ this.observer.observe(target, {
170
+ attributes: true,
171
+ attributeFilter: ['style']
172
+ });
173
+ }
136
174
  }
137
175
  }, {
138
176
  key: "componentWillUnmount",
139
177
  value: function componentWillUnmount() {
178
+ var _this$observer;
179
+
140
180
  var TextEntry = this.state.TextEntry;
141
181
  TextEntry.removeEventListeners();
182
+ (_this$observer = this.observer) === null || _this$observer === void 0 ? void 0 : _this$observer.disconnect();
142
183
  }
143
184
  }, {
144
185
  key: "handleMakeToolActive",
@@ -167,7 +208,7 @@ var Container = /*#__PURE__*/function (_Component) {
167
208
  }, {
168
209
  key: "render",
169
210
  value: function render() {
170
- var _this3 = this;
211
+ var _this4 = this;
171
212
 
172
213
  var _this$props = this.props,
173
214
  classes = _this$props.classes,
@@ -175,7 +216,8 @@ var Container = /*#__PURE__*/function (_Component) {
175
216
  imageUrl = _this$props.imageUrl,
176
217
  imageDimensions = _this$props.imageDimensions,
177
218
  onSessionChange = _this$props.onSessionChange,
178
- session = _this$props.session;
219
+ session = _this$props.session,
220
+ backgroundImageEnabled = _this$props.backgroundImageEnabled;
179
221
  var _this$state = this.state,
180
222
  drawableDimensions = _this$state.drawableDimensions,
181
223
  toolActive = _this$state.toolActive,
@@ -186,9 +228,10 @@ var Container = /*#__PURE__*/function (_Component) {
186
228
  paintColor = _this$state.paintColor,
187
229
  paintColorList = _this$state.paintColorList,
188
230
  TextEntry = _this$state.TextEntry;
231
+ var heightToUse = drawableDimensions.height * this.state.scale;
189
232
  return /*#__PURE__*/_react["default"].createElement("div", {
190
233
  className: classes.base
191
- }, /*#__PURE__*/_react["default"].createElement(_drawablePalette["default"], {
234
+ }, !disabled && /*#__PURE__*/_react["default"].createElement(_drawablePalette["default"], {
192
235
  fillColor: fillColor,
193
236
  fillList: fillColorList,
194
237
  outlineColor: outlineColor,
@@ -196,39 +239,44 @@ var Container = /*#__PURE__*/function (_Component) {
196
239
  paintColor: paintColor,
197
240
  paintList: paintColorList,
198
241
  onFillColorChange: function onFillColorChange(color) {
199
- return _this3.handleColorChange('fill', color);
242
+ return _this4.handleColorChange('fill', color);
200
243
  },
201
244
  onOutlineColorChange: function onOutlineColorChange(color) {
202
- return _this3.handleColorChange('outline', color);
245
+ return _this4.handleColorChange('outline', color);
203
246
  },
204
247
  onPaintColorChange: function onPaintColorChange(color) {
205
- return _this3.handleColorChange('paint', color);
248
+ return _this4.handleColorChange('paint', color);
206
249
  }
207
250
  }), /*#__PURE__*/_react["default"].createElement("div", {
208
251
  className: classes.box
209
252
  }, /*#__PURE__*/_react["default"].createElement("div", {
210
253
  className: classes.toolbar
211
- }, /*#__PURE__*/_react["default"].createElement("div", null, TOOLS.map(function (tool) {
254
+ }, TOOLS.map(function (tool) {
212
255
  var type = tool.type,
213
256
  label = tool.label,
214
257
  icon = tool.icon;
215
258
  return /*#__PURE__*/_react["default"].createElement(_button["default"], {
216
259
  title: label,
217
260
  key: type,
218
- disabled: _this3.checkIfToolIsDisabled(type),
261
+ disabled: _this4.checkIfToolIsDisabled(type),
219
262
  onClick: function onClick() {
220
- return _this3.handleMakeToolActive(tool);
263
+ return _this4.handleMakeToolActive(tool);
221
264
  },
222
265
  label: /*#__PURE__*/_react["default"].createElement(_icon["default"], {
223
266
  path: icon
224
267
  })
225
268
  });
226
- }))), /*#__PURE__*/_react["default"].createElement("div", {
269
+ })), /*#__PURE__*/_react["default"].createElement("div", {
227
270
  ref: function ref(drawable) {
228
- _this3.drawable = drawable;
271
+ _this4.drawable = drawable;
229
272
  },
230
- className: classes.drawableHeight
273
+ className: classes.drawableHeight,
274
+ style: {
275
+ height: heightToUse,
276
+ maxHeight: heightToUse
277
+ }
231
278
  }, /*#__PURE__*/_react["default"].createElement(_drawableMain["default"], {
279
+ scale: this.state.scale,
232
280
  session: session,
233
281
  disabled: disabled,
234
282
  onSessionChange: onSessionChange,
@@ -239,7 +287,8 @@ var Container = /*#__PURE__*/function (_Component) {
239
287
  drawableDimensions: drawableDimensions,
240
288
  imageDimensions: imageDimensions,
241
289
  toolActive: toolActive,
242
- TextEntry: TextEntry
290
+ TextEntry: TextEntry,
291
+ backgroundImageEnabled: backgroundImageEnabled
243
292
  }))));
244
293
  }
245
294
  }]);
@@ -253,7 +302,8 @@ exports.Container = Container;
253
302
  session: _propTypes["default"].object.isRequired,
254
303
  onSessionChange: _propTypes["default"].func.isRequired,
255
304
  imageDimensions: _propTypes["default"].object.isRequired,
256
- imageUrl: _propTypes["default"].string.isRequired
305
+ imageUrl: _propTypes["default"].string.isRequired,
306
+ backgroundImageEnabled: _propTypes["default"].bool.isRequired
257
307
  });
258
308
 
259
309
  var styles = function styles(theme) {
@@ -264,19 +314,24 @@ var styles = function styles(theme) {
264
314
  box: {
265
315
  border: '1px solid #E0E1E6',
266
316
  borderRadius: '5px',
267
- marginTop: theme.spacing.unit * 2
317
+ marginTop: theme.spacing.unit * 2,
318
+ backgroundColor: '#ECEDF1'
268
319
  },
269
320
  drawableHeight: {
270
- minHeight: 350
321
+ minHeight: 350,
322
+ backgroundColor: '#fff'
271
323
  },
272
324
  toolbar: {
273
- backgroundColor: '#ECEDF1',
274
325
  borderBottom: '1px solid #E0E1E6',
275
326
  borderTopLeftRadius: '5px',
276
327
  borderTopRightRadius: '5px',
277
- display: 'flex',
278
- justifyContent: 'space-between',
279
- padding: '12px 8px'
328
+ padding: '12px 8px 4px',
329
+ boxSizing: 'border-box',
330
+ maxWidth: 'calc(100% - 163px)',
331
+ // 163px is the width set on undoControls
332
+ '& button': {
333
+ marginBottom: '8px'
334
+ }
280
335
  }
281
336
  };
282
337
  };