@pie-element/hotspot 5.7.1-beta.3 → 5.7.1-beta.4
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/configure/lib/button.js +51 -0
- package/configure/lib/button.js.map +1 -0
- package/configure/lib/defaults.js +82 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/hotspot-container.js +350 -0
- package/configure/lib/hotspot-container.js.map +1 -0
- package/configure/lib/hotspot-drawable.js +397 -0
- package/configure/lib/hotspot-drawable.js.map +1 -0
- package/configure/lib/hotspot-palette.js +126 -0
- package/configure/lib/hotspot-palette.js.map +1 -0
- package/configure/lib/hotspot-polygon.js +170 -0
- package/configure/lib/hotspot-polygon.js.map +1 -0
- package/configure/lib/hotspot-rectangle.js +123 -0
- package/configure/lib/hotspot-rectangle.js.map +1 -0
- package/configure/lib/index.js +177 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/root.js +359 -0
- package/configure/lib/root.js.map +1 -0
- package/configure/lib/upload-control.js +58 -0
- package/configure/lib/upload-control.js.map +1 -0
- package/configure/lib/utils.js +137 -0
- package/configure/lib/utils.js.map +1 -0
- package/controller/lib/defaults.js +26 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +221 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/utils.js +39 -0
- package/controller/lib/utils.js.map +1 -0
- package/lib/hotspot/container.js +211 -0
- package/lib/hotspot/container.js.map +1 -0
- package/lib/hotspot/icons.js +8 -0
- package/lib/hotspot/icons.js.map +1 -0
- package/lib/hotspot/image.js +113 -0
- package/lib/hotspot/image.js.map +1 -0
- package/lib/hotspot/index.js +174 -0
- package/lib/hotspot/index.js.map +1 -0
- package/lib/hotspot/polygon.js +197 -0
- package/lib/hotspot/polygon.js.map +1 -0
- package/lib/hotspot/rectangle.js +179 -0
- package/lib/hotspot/rectangle.js.map +1 -0
- package/lib/index.js +87 -0
- package/lib/index.js.map +1 -0
- package/lib/session-updater.js +27 -0
- package/lib/session-updater.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":["_cloneDeep","_interopRequireDefault","require","_excluded","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","updateImageDimensions","initialDim","nextDim","keepAspectRatio","resizeType","imageAspectRatio","width","height","exports","getDelta","referenceInitialValue","referenceNextValue","currentValue","getUpdatedRectangle","shape","x","y","getUpdatedPlygon","points","map","point","getUpdatedShapes","shapes","group","getAllShapes","shapesMap","shapesArray","shapesKeys","reduce","acc","currentShapeKey","concat","index","groupShapes","rectangles","polygons","_ref","shapeProps","_objectWithoutProperties2","_toConsumableArray2","cloneDeep","generateValidationMessage","config","minShapes","maxShapes","maxSelections","shapesMessage","selectionsMessage","message"],"sources":["../src/utils.js"],"sourcesContent":["import cloneDeep from 'lodash/cloneDeep';\n\nconst updateImageDimensions = (initialDim, nextDim, keepAspectRatio, resizeType) => {\n // if we want to keep image aspect ratio\n if (keepAspectRatio) {\n const imageAspectRatio = initialDim.width / initialDim.height;\n\n if (resizeType === 'height') {\n // if we want to change image height => we update the width accordingly\n return {\n width: nextDim.height * imageAspectRatio,\n height: nextDim.height,\n };\n }\n\n // if we want to change image width => we update the height accordingly\n return {\n width: nextDim.width,\n height: nextDim.width / imageAspectRatio,\n };\n }\n\n // if we don't want to keep aspect ratio, we just update both values\n return {\n width: nextDim.width,\n height: nextDim.height,\n };\n};\n\n// referenceInitialValue = the initial value of the Stage\n// referenceNextValue = the next value of the Stage\n// currentValue = the value that has to be re-sized influenced by the changes that were made on the Stage\nconst getDelta = (referenceInitialValue, referenceNextValue, currentValue) =>\n (referenceNextValue / referenceInitialValue) * currentValue;\n\nconst getUpdatedRectangle = (initialDim, nextDim, shape) => ({\n ...shape,\n width: getDelta(initialDim.width, nextDim.width, shape.width),\n height: getDelta(initialDim.height, nextDim.height, shape.height),\n x: getDelta(initialDim.width, nextDim.width, shape.x),\n y: getDelta(initialDim.height, nextDim.height, shape.y),\n});\n\nconst getUpdatedPlygon = (initialDim, nextDim, shape) => ({\n ...shape,\n points: shape.points.map((point) => ({\n x: getDelta(initialDim.width, nextDim.width, point.x),\n y: getDelta(initialDim.height, nextDim.height, point.y),\n })),\n});\n\n// initialDim = the initial dimensions: { width, height } of the Stage\n// nextDim = the next dimensions: { width, height } of the Stage\n// shapes = array of shapes that have to be re-sized and re-positioned\nconst getUpdatedShapes = (initialDim, nextDim, shapes) => {\n return shapes.map((shape) => {\n if (shape.group === 'rectangles') {\n return getUpdatedRectangle(initialDim, nextDim, shape);\n }\n\n if (shape.group === 'polygons') {\n return getUpdatedPlygon(initialDim, nextDim, shape);\n }\n });\n};\n\n// converts shapes map to shapes array\n// example:\n// from: { rectangles: [r1], polygons: [p1, p2]}\n// to: [{ ...r1, group: 'rectangles' }, { ...p1, group: 'polygons' }, { ...p2, group: 'polygons' }]\n// if a shape has index defined, keep it, otherwise initialize it\n// index is used for the UNDO function\nconst getAllShapes = (shapesMap) => {\n shapesMap = shapesMap || {};\n const shapesArray = [];\n const shapesKeys = Object.keys(shapesMap);\n\n return shapesKeys.length\n ? shapesKeys.reduce(\n (acc, currentShapeKey) =>\n acc.concat(\n shapesMap[currentShapeKey]\n ? shapesMap[currentShapeKey].map((shape, index) => ({\n ...shape,\n group: currentShapeKey,\n index: shape.index || acc.length + index,\n }))\n : [],\n ),\n shapesArray,\n )\n : shapesArray;\n};\n\n// converts shapes array to shapes map\n// is the reverse of getAllShapes function\n// example:\n// from: [{ ...r1, group: 'rectangles' }, { ...p1, group: 'polygons' }, { ...p2, group: 'polygons' }]\n// to: { rectangles: [r1], polygons: [p1, p2]}\nconst groupShapes = (shapesArray) => {\n shapesArray = shapesArray || [];\n const shapesMap = {\n rectangles: [],\n polygons: [],\n };\n\n if (shapesArray.length) {\n return shapesArray.reduce((acc, { group, ...shapeProps }) => {\n acc[group] = [...(acc[group] || []), shapeProps];\n return acc;\n }, shapesMap);\n }\n\n return cloneDeep(shapesMap);\n};\n\nconst generateValidationMessage = (config) => {\n const { minShapes, maxShapes, maxSelections } = config;\n\n const shapesMessage =\n `\\nThere should be at least ${minShapes} ` + (maxShapes ? `and at most ${maxShapes} ` : '') + 'shapes defined.';\n\n const selectionsMessage =\n `\\nThere should be at least 1 ` +\n (maxSelections ? `and at most ${maxSelections} ` : '') +\n 'shape' +\n (maxSelections ? 's' : '') +\n ' selected.';\n\n const message = 'Validation requirements:' + shapesMessage + selectionsMessage;\n\n return message;\n};\n\nexport {\n updateImageDimensions,\n generateValidationMessage,\n getUpdatedShapes,\n getAllShapes,\n groupShapes,\n getUpdatedRectangle,\n getUpdatedPlygon,\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAyC,IAAAC,SAAA;AAAA,SAAAC,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAI,MAAA,CAAAc,MAAA,OAAAC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
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
prompt: 'This is the question prompt',
|
|
9
|
+
imageUrl: '',
|
|
10
|
+
shapes: {
|
|
11
|
+
rectangles: [],
|
|
12
|
+
polygons: []
|
|
13
|
+
},
|
|
14
|
+
multipleCorrect: true,
|
|
15
|
+
partialScoring: false,
|
|
16
|
+
dimensions: {
|
|
17
|
+
height: 0,
|
|
18
|
+
width: 0
|
|
19
|
+
},
|
|
20
|
+
hotspotColor: 'rgba(137, 183, 244, 0.25)',
|
|
21
|
+
hotspotList: ['rgba(137, 183, 244, 0.25)'],
|
|
22
|
+
outlineColor: 'blue',
|
|
23
|
+
outlineList: ['blue']
|
|
24
|
+
};
|
|
25
|
+
exports["default"] = _default;
|
|
26
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","names":["prompt","imageUrl","shapes","rectangles","polygons","multipleCorrect","partialScoring","dimensions","height","width","hotspotColor","hotspotList","outlineColor","outlineList","exports","_default"],"sources":["../src/defaults.js"],"sourcesContent":["export default {\n prompt: 'This is the question prompt',\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.25)',\n hotspotList: ['rgba(137, 183, 244, 0.25)'],\n outlineColor: 'blue',\n outlineList: ['blue'],\n};\n"],"mappings":";;;;;;eAAe;EACbA,MAAM,EAAE,6BAA6B;EACrCC,QAAQ,EAAE,EAAE;EACZC,MAAM,EAAE;IACNC,UAAU,EAAE,EAAE;IACdC,QAAQ,EAAE;EACZ,CAAC;EACDC,eAAe,EAAE,IAAI;EACrBC,cAAc,EAAE,KAAK;EACrBC,UAAU,EAAE;IACVC,MAAM,EAAE,CAAC;IACTC,KAAK,EAAE;EACT,CAAC;EACDC,YAAY,EAAE,2BAA2B;EACzCC,WAAW,EAAE,CAAC,2BAA2B,CAAC;EAC1CC,YAAY,EAAE,MAAM;EACpBC,WAAW,EAAE,CAAC,MAAM;AACtB,CAAC;AAAAC,OAAA,cAAAC,QAAA"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createDefaultModel = exports.createCorrectResponseSession = void 0;
|
|
8
|
+
exports.model = model;
|
|
9
|
+
exports.normalize = void 0;
|
|
10
|
+
exports.outcome = outcome;
|
|
11
|
+
exports.validate = void 0;
|
|
12
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
var _debug = _interopRequireDefault(require("debug"));
|
|
16
|
+
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
17
|
+
var _controllerUtils = require("@pie-lib/controller-utils");
|
|
18
|
+
var _utils = require("./utils");
|
|
19
|
+
var _defaults = _interopRequireDefault(require("./defaults"));
|
|
20
|
+
var _excluded = ["index"],
|
|
21
|
+
_excluded2 = ["index"];
|
|
22
|
+
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; }
|
|
23
|
+
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; }
|
|
24
|
+
var log = (0, _debug["default"])('pie-elements:hotspot:controller');
|
|
25
|
+
var normalize = function normalize(question) {
|
|
26
|
+
return _objectSpread({
|
|
27
|
+
promptEnabled: true,
|
|
28
|
+
rationaleEnabled: true,
|
|
29
|
+
teacherInstructionsEnabled: true,
|
|
30
|
+
studentInstructionsEnabled: true,
|
|
31
|
+
strokeWidth: 5
|
|
32
|
+
}, question);
|
|
33
|
+
};
|
|
34
|
+
exports.normalize = normalize;
|
|
35
|
+
function model(question, session, env) {
|
|
36
|
+
var normalizedQuestion = normalize(question);
|
|
37
|
+
var imageUrl = normalizedQuestion.imageUrl,
|
|
38
|
+
dimensions = normalizedQuestion.dimensions,
|
|
39
|
+
hotspotColor = normalizedQuestion.hotspotColor,
|
|
40
|
+
multipleCorrect = normalizedQuestion.multipleCorrect,
|
|
41
|
+
outlineColor = normalizedQuestion.outlineColor,
|
|
42
|
+
partialScoring = normalizedQuestion.partialScoring,
|
|
43
|
+
prompt = normalizedQuestion.prompt,
|
|
44
|
+
shapes = normalizedQuestion.shapes;
|
|
45
|
+
var _ref = shapes || {},
|
|
46
|
+
rectangles = _ref.rectangles,
|
|
47
|
+
polygons = _ref.polygons;
|
|
48
|
+
return new Promise(function (resolve) {
|
|
49
|
+
var out = {
|
|
50
|
+
disabled: env.mode !== 'gather',
|
|
51
|
+
mode: env.mode,
|
|
52
|
+
dimensions: dimensions,
|
|
53
|
+
imageUrl: imageUrl,
|
|
54
|
+
outlineColor: outlineColor,
|
|
55
|
+
hotspotColor: hotspotColor,
|
|
56
|
+
multipleCorrect: multipleCorrect,
|
|
57
|
+
partialScoring: partialScoring,
|
|
58
|
+
shapes: _objectSpread(_objectSpread({}, shapes), {}, {
|
|
59
|
+
// eslint-disable-next-line no-unused-vars
|
|
60
|
+
rectangles: (rectangles || []).map(function (_ref2) {
|
|
61
|
+
var index = _ref2.index,
|
|
62
|
+
rectProps = (0, _objectWithoutProperties2["default"])(_ref2, _excluded);
|
|
63
|
+
return _objectSpread({}, rectProps);
|
|
64
|
+
}),
|
|
65
|
+
// eslint-disable-next-line no-unused-vars
|
|
66
|
+
polygons: (polygons || []).map(function (_ref3) {
|
|
67
|
+
var index = _ref3.index,
|
|
68
|
+
polyProps = (0, _objectWithoutProperties2["default"])(_ref3, _excluded2);
|
|
69
|
+
return _objectSpread({}, polyProps);
|
|
70
|
+
})
|
|
71
|
+
}),
|
|
72
|
+
responseCorrect: env.mode === 'evaluate' ? (0, _utils.isResponseCorrect)(normalizedQuestion, session) : undefined
|
|
73
|
+
};
|
|
74
|
+
if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
|
|
75
|
+
out.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;
|
|
76
|
+
out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;
|
|
77
|
+
} else {
|
|
78
|
+
out.rationale = null;
|
|
79
|
+
out.teacherInstructions = null;
|
|
80
|
+
}
|
|
81
|
+
out.prompt = normalizedQuestion.promptEnabled ? prompt : null;
|
|
82
|
+
out.strokeWidth = normalizedQuestion.strokeWidth;
|
|
83
|
+
|
|
84
|
+
// console.log(out);
|
|
85
|
+
resolve(out);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
var createDefaultModel = function createDefaultModel() {
|
|
89
|
+
var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
90
|
+
return new Promise(function (resolve) {
|
|
91
|
+
resolve(_objectSpread(_objectSpread({}, _defaults["default"]), model));
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
exports.createDefaultModel = createDefaultModel;
|
|
95
|
+
var getScore = function getScore(config, session) {
|
|
96
|
+
var env = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
97
|
+
var _ref4 = session || {},
|
|
98
|
+
answers = _ref4.answers;
|
|
99
|
+
if (!config.shapes || !config.shapes.rectangles && !config.shapes.polygons) {
|
|
100
|
+
return 0;
|
|
101
|
+
}
|
|
102
|
+
var _config$shapes = config.shapes,
|
|
103
|
+
_config$shapes2 = _config$shapes === void 0 ? {} : _config$shapes,
|
|
104
|
+
_config$shapes2$recta = _config$shapes2.rectangles,
|
|
105
|
+
rectangles = _config$shapes2$recta === void 0 ? [] : _config$shapes2$recta,
|
|
106
|
+
_config$shapes2$polyg = _config$shapes2.polygons,
|
|
107
|
+
polygons = _config$shapes2$polyg === void 0 ? [] : _config$shapes2$polyg;
|
|
108
|
+
var partialScoringEnabled = _controllerUtils.partialScoring.enabled(config, env);
|
|
109
|
+
if (!partialScoringEnabled) {
|
|
110
|
+
return (0, _utils.isResponseCorrect)(config, session) ? 1 : 0;
|
|
111
|
+
}
|
|
112
|
+
var correctAnswers = 0;
|
|
113
|
+
var selectedChoices = 0;
|
|
114
|
+
var choices = [].concat((0, _toConsumableArray2["default"])(rectangles), (0, _toConsumableArray2["default"])(polygons));
|
|
115
|
+
var correctChoices = choices.filter(function (choice) {
|
|
116
|
+
return choice.correct;
|
|
117
|
+
});
|
|
118
|
+
choices.forEach(function (shape) {
|
|
119
|
+
var selected = answers && answers.filter(function (answer) {
|
|
120
|
+
return answer.id === shape.id;
|
|
121
|
+
})[0];
|
|
122
|
+
var correctlySelected = shape.correct && selected;
|
|
123
|
+
if (selected) {
|
|
124
|
+
selectedChoices += 1;
|
|
125
|
+
}
|
|
126
|
+
if (correctlySelected) {
|
|
127
|
+
correctAnswers += 1;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
var extraAnswers = selectedChoices > correctChoices.length ? selectedChoices - correctChoices.length : 0;
|
|
131
|
+
var total = correctChoices.length === 0 ? 1 : correctChoices.length;
|
|
132
|
+
var str = ((correctAnswers - extraAnswers) / total).toFixed(2);
|
|
133
|
+
return str < 0 ? 0 : parseFloat(str);
|
|
134
|
+
};
|
|
135
|
+
function outcome(config, session) {
|
|
136
|
+
var env = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
137
|
+
return new Promise(function (resolve) {
|
|
138
|
+
log('outcome...');
|
|
139
|
+
if (!session || (0, _isEmpty["default"])(session)) {
|
|
140
|
+
resolve({
|
|
141
|
+
score: 0,
|
|
142
|
+
empty: true
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
if (session.answers) {
|
|
146
|
+
var score = getScore(config, session, env);
|
|
147
|
+
resolve({
|
|
148
|
+
score: score
|
|
149
|
+
});
|
|
150
|
+
} else {
|
|
151
|
+
resolve({
|
|
152
|
+
score: 0,
|
|
153
|
+
empty: true
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
var returnShapesCorrect = function returnShapesCorrect(shapes) {
|
|
159
|
+
var answers = [];
|
|
160
|
+
shapes.forEach(function (i) {
|
|
161
|
+
var correct = i.correct,
|
|
162
|
+
id = i.id;
|
|
163
|
+
if (correct) {
|
|
164
|
+
answers.push({
|
|
165
|
+
id: id
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
return answers;
|
|
170
|
+
};
|
|
171
|
+
var createCorrectResponseSession = function createCorrectResponseSession(question, env) {
|
|
172
|
+
return new Promise(function (resolve) {
|
|
173
|
+
if (env.mode !== 'evaluate' && env.role === 'instructor') {
|
|
174
|
+
var _question$shapes = question.shapes,
|
|
175
|
+
_question$shapes2 = _question$shapes === void 0 ? {} : _question$shapes,
|
|
176
|
+
_question$shapes2$rec = _question$shapes2.rectangles,
|
|
177
|
+
rectangles = _question$shapes2$rec === void 0 ? [] : _question$shapes2$rec,
|
|
178
|
+
_question$shapes2$pol = _question$shapes2.polygons,
|
|
179
|
+
polygons = _question$shapes2$pol === void 0 ? {} : _question$shapes2$pol;
|
|
180
|
+
var rectangleCorrect = returnShapesCorrect(rectangles);
|
|
181
|
+
var polygonsCorrect = returnShapesCorrect(polygons);
|
|
182
|
+
resolve({
|
|
183
|
+
answers: [].concat((0, _toConsumableArray2["default"])(rectangleCorrect), (0, _toConsumableArray2["default"])(polygonsCorrect)),
|
|
184
|
+
id: '1'
|
|
185
|
+
});
|
|
186
|
+
} else {
|
|
187
|
+
resolve(null);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
exports.createCorrectResponseSession = createCorrectResponseSession;
|
|
192
|
+
var validate = function validate() {
|
|
193
|
+
var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
194
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
195
|
+
var shapes = model.shapes;
|
|
196
|
+
var _config$minShapes = config.minShapes,
|
|
197
|
+
minShapes = _config$minShapes === void 0 ? 2 : _config$minShapes,
|
|
198
|
+
maxShapes = config.maxShapes,
|
|
199
|
+
maxSelections = config.maxSelections;
|
|
200
|
+
var errors = {};
|
|
201
|
+
var allShapes = Object.values(shapes || {}).reduce(function (acc, shape) {
|
|
202
|
+
return [].concat((0, _toConsumableArray2["default"])(acc), (0, _toConsumableArray2["default"])(shape));
|
|
203
|
+
}, []);
|
|
204
|
+
var nbOfSelections = (allShapes || []).reduce(function (acc, shape) {
|
|
205
|
+
return shape.correct ? acc + 1 : acc;
|
|
206
|
+
}, 0);
|
|
207
|
+
var nbOfShapes = (allShapes || []).length;
|
|
208
|
+
if (nbOfShapes < minShapes) {
|
|
209
|
+
errors.shapesError = "There should be at least ".concat(minShapes, " shapes defined.");
|
|
210
|
+
} else if (nbOfShapes > maxShapes) {
|
|
211
|
+
errors.shapesError = "No more than ".concat(maxShapes, " shapes should be defined.");
|
|
212
|
+
}
|
|
213
|
+
if (nbOfSelections < 1) {
|
|
214
|
+
errors.selectionsError = 'There should be at least 1 shape selected.';
|
|
215
|
+
} else if (nbOfSelections > maxSelections) {
|
|
216
|
+
errors.selectionsError = "No more than ".concat(maxSelections, " shapes should be selected.");
|
|
217
|
+
}
|
|
218
|
+
return errors;
|
|
219
|
+
};
|
|
220
|
+
exports.validate = validate;
|
|
221
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_debug","_interopRequireDefault","require","_isEmpty","_controllerUtils","_utils","_defaults","_excluded","_excluded2","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","log","debug","normalize","question","promptEnabled","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","strokeWidth","exports","model","session","env","normalizedQuestion","imageUrl","dimensions","hotspotColor","multipleCorrect","outlineColor","partialScoring","prompt","shapes","_ref","rectangles","polygons","Promise","resolve","out","disabled","mode","map","_ref2","index","rectProps","_objectWithoutProperties2","_ref3","polyProps","responseCorrect","isResponseCorrect","undefined","role","rationale","teacherInstructions","createDefaultModel","defaults","getScore","config","_ref4","answers","_config$shapes","_config$shapes2","_config$shapes2$recta","_config$shapes2$polyg","partialScoringEnabled","enabled","correctAnswers","selectedChoices","choices","concat","_toConsumableArray2","correctChoices","choice","correct","shape","selected","answer","id","correctlySelected","extraAnswers","total","str","toFixed","parseFloat","outcome","isEmpty","score","empty","returnShapesCorrect","createCorrectResponseSession","_question$shapes","_question$shapes2","_question$shapes2$rec","_question$shapes2$pol","rectangleCorrect","polygonsCorrect","validate","_config$minShapes","minShapes","maxShapes","maxSelections","errors","allShapes","values","reduce","acc","nbOfSelections","nbOfShapes","shapesError","selectionsError"],"sources":["../src/index.js"],"sourcesContent":["import debug from 'debug';\nimport isEmpty from 'lodash/isEmpty';\nimport { partialScoring } from '@pie-lib/controller-utils';\n\nimport { isResponseCorrect } from './utils';\n\nimport defaults from './defaults';\n\nconst log = debug('pie-elements:hotspot:controller');\n\nexport const normalize = (question) => ({\n promptEnabled: true,\n rationaleEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n strokeWidth: 5,\n ...question,\n});\n\nexport function model(question, session, env) {\n const normalizedQuestion = normalize(question);\n const { imageUrl, dimensions, hotspotColor, multipleCorrect, outlineColor, partialScoring, prompt, shapes } =\n normalizedQuestion;\n const { rectangles, polygons } = shapes || {};\n\n return new Promise((resolve) => {\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n dimensions,\n imageUrl,\n outlineColor,\n hotspotColor,\n multipleCorrect,\n partialScoring,\n shapes: {\n ...shapes,\n // eslint-disable-next-line no-unused-vars\n rectangles: (rectangles || []).map(({ index, ...rectProps }) => ({ ...rectProps })),\n // eslint-disable-next-line no-unused-vars\n polygons: (polygons || []).map(({ index, ...polyProps }) => ({ ...polyProps })),\n },\n responseCorrect: env.mode === 'evaluate' ? isResponseCorrect(normalizedQuestion, session) : undefined,\n };\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n out.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.rationale = null;\n out.teacherInstructions = null;\n }\n\n out.prompt = normalizedQuestion.promptEnabled ? prompt : null;\n out.strokeWidth = normalizedQuestion.strokeWidth;\n\n // console.log(out);\n resolve(out);\n });\n}\n\nexport const createDefaultModel = (model = {}) =>\n new Promise((resolve) => {\n resolve({\n ...defaults,\n ...model,\n });\n });\n\nconst getScore = (config, session, env = {}) => {\n const { answers } = session || {};\n\n if (!config.shapes || (!config.shapes.rectangles && !config.shapes.polygons)) {\n return 0;\n }\n\n const { shapes: { rectangles = [], polygons = [] } = {} } = config;\n const partialScoringEnabled = partialScoring.enabled(config, env);\n\n if (!partialScoringEnabled) {\n return isResponseCorrect(config, session) ? 1 : 0;\n }\n\n let correctAnswers = 0;\n let selectedChoices = 0;\n\n const choices = [...rectangles, ...polygons];\n\n const correctChoices = choices.filter((choice) => choice.correct);\n\n choices.forEach((shape) => {\n const selected = answers && answers.filter((answer) => answer.id === shape.id)[0];\n const correctlySelected = shape.correct && selected;\n\n if (selected) {\n selectedChoices += 1;\n }\n\n if (correctlySelected) {\n correctAnswers += 1;\n }\n });\n\n const extraAnswers = selectedChoices > correctChoices.length ? selectedChoices - correctChoices.length : 0;\n\n const total = correctChoices.length === 0 ? 1 : correctChoices.length;\n const str = ((correctAnswers - extraAnswers) / total).toFixed(2);\n\n return str < 0 ? 0 : parseFloat(str);\n};\n\nexport function outcome(config, session, env = {}) {\n return new Promise((resolve) => {\n log('outcome...');\n\n if (!session || isEmpty(session)) {\n resolve({ score: 0, empty: true });\n }\n\n if (session.answers) {\n const score = getScore(config, session, env);\n resolve({ score });\n } else {\n resolve({ score: 0, empty: true });\n }\n });\n}\n\nconst returnShapesCorrect = (shapes) => {\n let answers = [];\n\n shapes.forEach((i) => {\n const { correct, id } = i;\n if (correct) {\n answers.push({ id });\n }\n });\n return answers;\n};\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { shapes: { rectangles = [], polygons = {} } = {} } = question;\n\n const rectangleCorrect = returnShapesCorrect(rectangles);\n const polygonsCorrect = returnShapesCorrect(polygons);\n\n resolve({\n answers: [...rectangleCorrect, ...polygonsCorrect],\n id: '1',\n });\n } else {\n resolve(null);\n }\n });\n};\n\nexport const validate = (model = {}, config = {}) => {\n const { shapes } = model;\n const { minShapes = 2, maxShapes, maxSelections } = config;\n const errors = {};\n\n const allShapes = Object.values(shapes || {}).reduce((acc, shape) => [...acc, ...shape], []);\n\n const nbOfSelections = (allShapes || []).reduce((acc, shape) => (shape.correct ? acc + 1 : acc), 0);\n\n const nbOfShapes = (allShapes || []).length;\n\n if (nbOfShapes < minShapes) {\n errors.shapesError = `There should be at least ${minShapes} shapes defined.`;\n } else if (nbOfShapes > maxShapes) {\n errors.shapesError = `No more than ${maxShapes} shapes should be defined.`;\n }\n\n if (nbOfSelections < 1) {\n errors.selectionsError = 'There should be at least 1 shape selected.';\n } else if (nbOfSelections > maxSelections) {\n errors.selectionsError = `No more than ${maxSelections} shapes should be selected.`;\n }\n\n return errors;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AAEA,IAAAI,SAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAkC,IAAAK,SAAA;EAAAC,UAAA;AAAA,SAAAC,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAI,MAAA,CAAAc,MAAA,OAAAC,OAAA,WAAAC,GAAA,QAAAC,gBAAA,aAAAP,MAAA,EAAAM,GAAA,EAAAF,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EA,IAAIO,cAAc,GAAG,CAAC,EAAE;IACtBL,MAAM,CAACQ,eAAe,GAAG,4CAA4C;EACvE,CAAC,MAAM,IAAIH,cAAc,GAAGN,aAAa,EAAE;IACzCC,MAAM,CAACQ,eAAe,mBAAAxC,MAAA,CAAmB+B,aAAa,gCAA6B;EACrF;EAEA,OAAOC,MAAM;AACf,CAAC;AAACjF,OAAA,CAAA4E,QAAA,GAAAA,QAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.isResponseCorrect = exports.getCorrectResponse = void 0;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
+
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
10
|
+
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
11
|
+
var getCorrectResponse = function getCorrectResponse(choices) {
|
|
12
|
+
return choices.filter(function (c) {
|
|
13
|
+
return c.correct;
|
|
14
|
+
}).map(function (c) {
|
|
15
|
+
return c.id;
|
|
16
|
+
}).sort();
|
|
17
|
+
};
|
|
18
|
+
exports.getCorrectResponse = getCorrectResponse;
|
|
19
|
+
var isResponseCorrect = function isResponseCorrect(question, session) {
|
|
20
|
+
var _question$shapes = question.shapes,
|
|
21
|
+
rectangles = _question$shapes.rectangles,
|
|
22
|
+
polygons = _question$shapes.polygons;
|
|
23
|
+
var choices = [].concat((0, _toConsumableArray2["default"])(rectangles), (0, _toConsumableArray2["default"])(polygons));
|
|
24
|
+
var correctResponseIds = getCorrectResponse(choices);
|
|
25
|
+
if (!session || (0, _isEmpty["default"])(session)) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
if (session.answers && session.answers.length) {
|
|
29
|
+
var answerIds = (session.answers || []).map(function (a) {
|
|
30
|
+
return a.id;
|
|
31
|
+
});
|
|
32
|
+
return (0, _isEqual["default"])(answerIds.sort(), correctResponseIds);
|
|
33
|
+
} else if (!(correctResponseIds && correctResponseIds.length)) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
};
|
|
38
|
+
exports.isResponseCorrect = isResponseCorrect;
|
|
39
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":["_isEqual","_interopRequireDefault","require","_isEmpty","getCorrectResponse","choices","filter","c","correct","map","id","sort","exports","isResponseCorrect","question","session","_question$shapes","shapes","rectangles","polygons","concat","_toConsumableArray2","correctResponseIds","isEmpty","answers","length","answerIds","a","isEqual"],"sources":["../src/utils.js"],"sourcesContent":["import isEqual from 'lodash/isEqual';\nimport isEmpty from 'lodash/isEmpty';\n\nexport const getCorrectResponse = (choices) =>\n choices\n .filter((c) => c.correct)\n .map((c) => c.id)\n .sort();\n\nexport const isResponseCorrect = (question, session) => {\n const {\n shapes: { rectangles, polygons },\n } = question;\n const choices = [...rectangles, ...polygons];\n let correctResponseIds = getCorrectResponse(choices);\n\n if (!session || isEmpty(session)) {\n return false;\n }\n\n if (session.answers && session.answers.length) {\n let answerIds = (session.answers || []).map((a) => a.id);\n\n return isEqual(answerIds.sort(), correctResponseIds);\n } else if (!(correctResponseIds && correctResponseIds.length)) {\n return true;\n }\n\n return false;\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEO,IAAME,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,OAAO;EAAA,OACxCA,OAAO,CACJC,MAAM,CAAC,UAACC,CAAC;IAAA,OAAKA,CAAC,CAACC,OAAO;EAAA,EAAC,CACxBC,GAAG,CAAC,UAACF,CAAC;IAAA,OAAKA,CAAC,CAACG,EAAE;EAAA,EAAC,CAChBC,IAAI,CAAC,CAAC;AAAA;AAACC,OAAA,CAAAR,kBAAA,GAAAA,kBAAA;AAEL,IAAMS,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAIC,QAAQ,EAAEC,OAAO,EAAK;EACtD,IAAAC,gBAAA,GAEIF,QAAQ,CADVG,MAAM;IAAIC,UAAU,GAAAF,gBAAA,CAAVE,UAAU;IAAEC,QAAQ,GAAAH,gBAAA,CAARG,QAAQ;EAEhC,IAAMd,OAAO,MAAAe,MAAA,KAAAC,mBAAA,aAAOH,UAAU,OAAAG,mBAAA,aAAKF,QAAQ,EAAC;EAC5C,IAAIG,kBAAkB,GAAGlB,kBAAkB,CAACC,OAAO,CAAC;EAEpD,IAAI,CAACU,OAAO,IAAI,IAAAQ,mBAAO,EAACR,OAAO,CAAC,EAAE;IAChC,OAAO,KAAK;EACd;EAEA,IAAIA,OAAO,CAACS,OAAO,IAAIT,OAAO,CAACS,OAAO,CAACC,MAAM,EAAE;IAC7C,IAAIC,SAAS,GAAG,CAACX,OAAO,CAACS,OAAO,IAAI,EAAE,EAAEf,GAAG,CAAC,UAACkB,CAAC;MAAA,OAAKA,CAAC,CAACjB,EAAE;IAAA,EAAC;IAExD,OAAO,IAAAkB,mBAAO,EAACF,SAAS,CAACf,IAAI,CAAC,CAAC,EAAEW,kBAAkB,CAAC;EACtD,CAAC,MAAM,IAAI,EAAEA,kBAAkB,IAAIA,kBAAkB,CAACG,MAAM,CAAC,EAAE;IAC7D,OAAO,IAAI;EACb;EAEA,OAAO,KAAK;AACd,CAAC;AAACb,OAAA,CAAAC,iBAAA,GAAAA,iBAAA"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = exports.Container = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
var _react = _interopRequireDefault(require("react"));
|
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
+
var _reactKonva = require("react-konva");
|
|
18
|
+
var _styles = require("@material-ui/core/styles");
|
|
19
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
20
|
+
var _rectangle = _interopRequireDefault(require("./rectangle"));
|
|
21
|
+
var _polygon = _interopRequireDefault(require("./polygon"));
|
|
22
|
+
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); }; }
|
|
23
|
+
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; } }
|
|
24
|
+
var Container = /*#__PURE__*/function (_React$Component) {
|
|
25
|
+
(0, _inherits2["default"])(Container, _React$Component);
|
|
26
|
+
var _super = _createSuper(Container);
|
|
27
|
+
function Container() {
|
|
28
|
+
var _this;
|
|
29
|
+
(0, _classCallCheck2["default"])(this, Container);
|
|
30
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
31
|
+
args[_key] = arguments[_key];
|
|
32
|
+
}
|
|
33
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
34
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "correctness", function (isCorrect, isChecked) {
|
|
35
|
+
return isCorrect ? isChecked : !isChecked;
|
|
36
|
+
});
|
|
37
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getEvaluateText", function (isCorrect, selected) {
|
|
38
|
+
if (selected && isCorrect) {
|
|
39
|
+
return 'Correctly\nselected';
|
|
40
|
+
}
|
|
41
|
+
if (selected && !isCorrect) {
|
|
42
|
+
return 'Should not have\nbeen selected';
|
|
43
|
+
}
|
|
44
|
+
if (!selected && isCorrect) {
|
|
45
|
+
return 'Should have\nbeen selected';
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
});
|
|
49
|
+
return _this;
|
|
50
|
+
}
|
|
51
|
+
(0, _createClass2["default"])(Container, [{
|
|
52
|
+
key: "isSelected",
|
|
53
|
+
value: function isSelected(shape) {
|
|
54
|
+
var selectedShape = this.props.session.answers.filter(function (answer) {
|
|
55
|
+
return answer.id === shape.id;
|
|
56
|
+
})[0];
|
|
57
|
+
return !!selectedShape;
|
|
58
|
+
}
|
|
59
|
+
}, {
|
|
60
|
+
key: "render",
|
|
61
|
+
value: function render() {
|
|
62
|
+
var _this2 = this;
|
|
63
|
+
var _this$props = this.props,
|
|
64
|
+
classes = _this$props.classes,
|
|
65
|
+
_this$props$dimension = _this$props.dimensions,
|
|
66
|
+
withProp = _this$props$dimension.width,
|
|
67
|
+
heightProp = _this$props$dimension.height,
|
|
68
|
+
disabled = _this$props.disabled,
|
|
69
|
+
hotspotColor = _this$props.hotspotColor,
|
|
70
|
+
imageUrl = _this$props.imageUrl,
|
|
71
|
+
isEvaluateMode = _this$props.isEvaluateMode,
|
|
72
|
+
outlineColor = _this$props.outlineColor,
|
|
73
|
+
onSelectChoice = _this$props.onSelectChoice,
|
|
74
|
+
_this$props$shapes = _this$props.shapes,
|
|
75
|
+
rectangles = _this$props$shapes.rectangles,
|
|
76
|
+
polygons = _this$props$shapes.polygons,
|
|
77
|
+
SCALE = _this$props.scale,
|
|
78
|
+
strokeWidth = _this$props.strokeWidth,
|
|
79
|
+
showCorrect = _this$props.showCorrect;
|
|
80
|
+
var width = withProp * SCALE;
|
|
81
|
+
var height = heightProp * SCALE;
|
|
82
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
83
|
+
className: classes.base,
|
|
84
|
+
style: {
|
|
85
|
+
padding: strokeWidth / 2
|
|
86
|
+
}
|
|
87
|
+
}, imageUrl ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
88
|
+
className: classes.imageContainer
|
|
89
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
90
|
+
alt: "hotspot-image",
|
|
91
|
+
className: classes.image,
|
|
92
|
+
height: "auto",
|
|
93
|
+
src: imageUrl,
|
|
94
|
+
style: {
|
|
95
|
+
width: width,
|
|
96
|
+
height: height,
|
|
97
|
+
maxWidth: width,
|
|
98
|
+
maxHeight: height
|
|
99
|
+
}
|
|
100
|
+
})) : null, /*#__PURE__*/_react["default"].createElement(_reactKonva.Stage, {
|
|
101
|
+
className: classes.stage,
|
|
102
|
+
height: height + strokeWidth,
|
|
103
|
+
width: width + strokeWidth,
|
|
104
|
+
x: strokeWidth / 2,
|
|
105
|
+
y: strokeWidth / 2
|
|
106
|
+
}, /*#__PURE__*/_react["default"].createElement(_reactKonva.Layer, null, rectangles.map(function (shape) {
|
|
107
|
+
var selected = _this2.isSelected(shape);
|
|
108
|
+
var isCorrect = isEvaluateMode ? _this2.correctness(shape.correct, selected) : undefined;
|
|
109
|
+
var evaluateText = isEvaluateMode ? _this2.getEvaluateText(shape.correct, selected) : null;
|
|
110
|
+
var markAsCorrect = !!(isEvaluateMode && showCorrect && shape.correct);
|
|
111
|
+
return /*#__PURE__*/_react["default"].createElement(_rectangle["default"], {
|
|
112
|
+
scale: SCALE,
|
|
113
|
+
isEvaluateMode: isEvaluateMode,
|
|
114
|
+
isCorrect: isCorrect,
|
|
115
|
+
evaluateText: evaluateText,
|
|
116
|
+
disabled: disabled,
|
|
117
|
+
selected: selected,
|
|
118
|
+
height: shape.height,
|
|
119
|
+
hotspotColor: hotspotColor,
|
|
120
|
+
id: shape.id,
|
|
121
|
+
key: shape.id,
|
|
122
|
+
onClick: onSelectChoice,
|
|
123
|
+
outlineColor: outlineColor,
|
|
124
|
+
width: shape.width,
|
|
125
|
+
x: shape.x,
|
|
126
|
+
y: shape.y,
|
|
127
|
+
strokeWidth: strokeWidth,
|
|
128
|
+
markAsCorrect: markAsCorrect,
|
|
129
|
+
showCorrectEnabled: showCorrect
|
|
130
|
+
});
|
|
131
|
+
}), polygons.map(function (polygon) {
|
|
132
|
+
var selected = _this2.isSelected(polygon);
|
|
133
|
+
var isCorrect = isEvaluateMode ? _this2.correctness(polygon.correct, selected) : undefined;
|
|
134
|
+
var evaluateText = isEvaluateMode ? _this2.getEvaluateText(polygon.correct, selected) : null;
|
|
135
|
+
var markAsCorrect = !!(isEvaluateMode && showCorrect && polygon.correct);
|
|
136
|
+
return /*#__PURE__*/_react["default"].createElement(_polygon["default"], {
|
|
137
|
+
scale: SCALE,
|
|
138
|
+
isEvaluateMode: isEvaluateMode,
|
|
139
|
+
isCorrect: !!isCorrect,
|
|
140
|
+
evaluateText: evaluateText,
|
|
141
|
+
disabled: disabled,
|
|
142
|
+
selected: selected,
|
|
143
|
+
hotspotColor: hotspotColor,
|
|
144
|
+
id: polygon.id,
|
|
145
|
+
key: polygon.id,
|
|
146
|
+
onClick: onSelectChoice,
|
|
147
|
+
outlineColor: outlineColor,
|
|
148
|
+
points: polygon.points,
|
|
149
|
+
strokeWidth: strokeWidth,
|
|
150
|
+
markAsCorrect: markAsCorrect,
|
|
151
|
+
showCorrectEnabled: showCorrect
|
|
152
|
+
});
|
|
153
|
+
}))));
|
|
154
|
+
}
|
|
155
|
+
}]);
|
|
156
|
+
return Container;
|
|
157
|
+
}(_react["default"].Component);
|
|
158
|
+
exports.Container = Container;
|
|
159
|
+
var styles = function styles(theme) {
|
|
160
|
+
return {
|
|
161
|
+
base: {
|
|
162
|
+
marginTop: theme.spacing.unit * 3,
|
|
163
|
+
position: 'relative'
|
|
164
|
+
},
|
|
165
|
+
image: {
|
|
166
|
+
alignItems: 'center',
|
|
167
|
+
display: 'flex',
|
|
168
|
+
justifyContent: 'center'
|
|
169
|
+
},
|
|
170
|
+
imageContainer: {
|
|
171
|
+
position: 'relative',
|
|
172
|
+
width: 'fit-content'
|
|
173
|
+
},
|
|
174
|
+
stage: {
|
|
175
|
+
left: 0,
|
|
176
|
+
top: 0,
|
|
177
|
+
position: 'absolute'
|
|
178
|
+
},
|
|
179
|
+
resize: {
|
|
180
|
+
borderBottom: "1px solid ".concat(_renderUi.color.disabled()),
|
|
181
|
+
borderRight: "1px solid ".concat(_renderUi.color.disabled()),
|
|
182
|
+
bottom: '-10px',
|
|
183
|
+
cursor: 'se-resize',
|
|
184
|
+
height: '10px',
|
|
185
|
+
position: 'absolute',
|
|
186
|
+
right: '-10px',
|
|
187
|
+
width: '10px'
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
Container.propTypes = {
|
|
192
|
+
classes: _propTypes["default"].object.isRequired,
|
|
193
|
+
dimensions: _propTypes["default"].object.isRequired,
|
|
194
|
+
disabled: _propTypes["default"].bool.isRequired,
|
|
195
|
+
hotspotColor: _propTypes["default"].string.isRequired,
|
|
196
|
+
imageUrl: _propTypes["default"].string.isRequired,
|
|
197
|
+
isEvaluateMode: _propTypes["default"].bool.isRequired,
|
|
198
|
+
onSelectChoice: _propTypes["default"].func.isRequired,
|
|
199
|
+
outlineColor: _propTypes["default"].string.isRequired,
|
|
200
|
+
session: _propTypes["default"].object.isRequired,
|
|
201
|
+
shapes: _propTypes["default"].object.isRequired,
|
|
202
|
+
strokeWidth: _propTypes["default"].number,
|
|
203
|
+
scale: _propTypes["default"].number,
|
|
204
|
+
showCorrect: _propTypes["default"].bool
|
|
205
|
+
};
|
|
206
|
+
Container.defaultProps = {
|
|
207
|
+
scale: 1
|
|
208
|
+
};
|
|
209
|
+
var _default = (0, _styles.withStyles)(styles)(Container);
|
|
210
|
+
exports["default"] = _default;
|
|
211
|
+
//# sourceMappingURL=container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.js","names":["_react","_interopRequireDefault","require","_propTypes","_reactKonva","_styles","_renderUi","_rectangle","_polygon","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","result","NewTarget","constructor","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","prototype","valueOf","call","e","Container","_React$Component","_inherits2","_super","_this","_classCallCheck2","_len","length","args","Array","_key","concat","_defineProperty2","_assertThisInitialized2","isCorrect","isChecked","selected","_createClass2","key","value","isSelected","shape","selectedShape","props","session","answers","filter","answer","id","render","_this2","_this$props","classes","_this$props$dimension","dimensions","withProp","width","heightProp","height","disabled","hotspotColor","imageUrl","isEvaluateMode","outlineColor","onSelectChoice","_this$props$shapes","shapes","rectangles","polygons","SCALE","scale","strokeWidth","showCorrect","createElement","className","base","style","padding","imageContainer","alt","image","src","maxWidth","maxHeight","Stage","stage","x","y","Layer","map","correctness","correct","undefined","evaluateText","getEvaluateText","markAsCorrect","onClick","showCorrectEnabled","polygon","points","React","Component","exports","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","_default","withStyles"],"sources":["../../src/hotspot/container.jsx"],"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 className={classes.base} style={{ padding: strokeWidth / 2 }}>\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"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAEA,IAAAK,UAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,QAAA,GAAAP,sBAAA,CAAAC,OAAA;AAAgC,SAAAO,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,aAAAL,OAAA,GAAAM,MAAA,MAAAL,yBAAA,QAAAM,SAAA,OAAAF,gBAAA,mBAAAG,WAAA,EAAAF,MAAA,GAAAG,OAAA,CAAAC,SAAA,CAAAN,KAAA,EAAAO,SAAA,EAAAJ,SAAA,YAAAD,MAAA,GAAAF,KAAA,CAAAQ,KAAA,OAAAD,SAAA,gBAAAE,2BAAA,mBAAAP,MAAA;AAAA,SAAAJ,0BAAA,eAAAO,OAAA,qBAAAA,OAAA,CAAAC,SAAA,oBAAAD,OAAA,CAAAC,SAAA,CAAAI,IAAA,2BAAAC,KAAA,oCAAAC,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAV,OAAA,CAAAC,SAAA,CAAAM,OAAA,8CAAAI,CAAA;AAAA,IAEnBC,SAAS,0BAAAC,gBAAA;EAAA,IAAAC,UAAA,aAAAF,SAAA,EAAAC,gBAAA;EAAA,IAAAE,MAAA,GAAAzB,YAAA,CAAAsB,SAAA;EAAA,SAAAA,UAAA;IAA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