@pie-element/hotspot 5.7.1-beta.0 → 5.7.1-beta.3
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/package.json +2 -2
- package/package.json +2 -2
- package/configure/lib/button.js +0 -61
- package/configure/lib/button.js.map +0 -1
- package/configure/lib/defaults.js +0 -82
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/hotspot-container.js +0 -398
- package/configure/lib/hotspot-container.js.map +0 -1
- package/configure/lib/hotspot-drawable.js +0 -445
- package/configure/lib/hotspot-drawable.js.map +0 -1
- package/configure/lib/hotspot-palette.js +0 -154
- package/configure/lib/hotspot-palette.js.map +0 -1
- package/configure/lib/hotspot-polygon.js +0 -202
- package/configure/lib/hotspot-polygon.js.map +0 -1
- package/configure/lib/hotspot-rectangle.js +0 -150
- package/configure/lib/hotspot-rectangle.js.map +0 -1
- package/configure/lib/index.js +0 -212
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/root.js +0 -401
- package/configure/lib/root.js.map +0 -1
- package/configure/lib/upload-control.js +0 -68
- package/configure/lib/upload-control.js.map +0 -1
- package/configure/lib/utils.js +0 -160
- package/configure/lib/utils.js.map +0 -1
- package/controller/lib/defaults.js +0 -26
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -263
- package/controller/lib/index.js.map +0 -1
- package/controller/lib/utils.js +0 -50
- package/controller/lib/utils.js.map +0 -1
- package/lib/hotspot/container.js +0 -246
- package/lib/hotspot/container.js.map +0 -1
- package/lib/hotspot/icons.js +0 -8
- package/lib/hotspot/icons.js.map +0 -1
- package/lib/hotspot/image.js +0 -133
- package/lib/hotspot/image.js.map +0 -1
- package/lib/hotspot/index.js +0 -207
- package/lib/hotspot/index.js.map +0 -1
- package/lib/hotspot/polygon.js +0 -225
- package/lib/hotspot/polygon.js.map +0 -1
- package/lib/hotspot/rectangle.js +0 -207
- package/lib/hotspot/rectangle.js.map +0 -1
- package/lib/index.js +0 -114
- package/lib/index.js.map +0 -1
- package/lib/session-updater.js +0 -30
- package/lib/session-updater.js.map +0 -1
package/configure/package.json
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"@material-ui/core": "^3.9.2",
|
|
11
11
|
"@material-ui/icons": "^3.0.2",
|
|
12
12
|
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
13
|
-
"@pie-lib/config-ui": "12.0.0-beta.
|
|
14
|
-
"@pie-lib/editable-html": "10.0.0-beta.
|
|
13
|
+
"@pie-lib/config-ui": "12.0.0-beta.5",
|
|
14
|
+
"@pie-lib/editable-html": "10.0.0-beta.7",
|
|
15
15
|
"classnames": "^2.2.6",
|
|
16
16
|
"debug": "^3.1.0",
|
|
17
17
|
"konva": "^3.2.4",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/hotspot",
|
|
3
|
-
"version": "5.7.1-beta.
|
|
3
|
+
"version": "5.7.1-beta.3+e0e0490c5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": "pie-framework/pie-elements",
|
|
6
6
|
"publishConfig": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"author": "pie framework developers",
|
|
24
24
|
"license": "ISC",
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "e0e0490c5b040c67f504c0bdfd00f6b834a28481",
|
|
26
26
|
"scripts": {
|
|
27
27
|
"postpublish": "../../scripts/postpublish"
|
|
28
28
|
},
|
package/configure/lib/button.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
|
-
var _styles = require("@material-ui/core/styles");
|
|
15
|
-
|
|
16
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
-
|
|
18
|
-
var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
|
|
19
|
-
|
|
20
|
-
var RawButton = function RawButton(_ref) {
|
|
21
|
-
var classes = _ref.classes,
|
|
22
|
-
className = _ref.className,
|
|
23
|
-
label = _ref.label,
|
|
24
|
-
onClick = _ref.onClick,
|
|
25
|
-
disabled = _ref.disabled;
|
|
26
|
-
return /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
27
|
-
onClick: onClick,
|
|
28
|
-
disabled: disabled,
|
|
29
|
-
className: (0, _classnames["default"])(classes.addButton, className),
|
|
30
|
-
size: "small",
|
|
31
|
-
variant: "contained",
|
|
32
|
-
color: "default"
|
|
33
|
-
}, label);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
RawButton.propTypes = {
|
|
37
|
-
classes: _propTypes["default"].object.isRequired,
|
|
38
|
-
className: _propTypes["default"].string,
|
|
39
|
-
disabled: _propTypes["default"].bool,
|
|
40
|
-
label: _propTypes["default"].string,
|
|
41
|
-
onClick: _propTypes["default"].func
|
|
42
|
-
};
|
|
43
|
-
RawButton.defaultProps = {
|
|
44
|
-
className: '',
|
|
45
|
-
disabled: false,
|
|
46
|
-
label: 'Add',
|
|
47
|
-
onClick: function onClick() {}
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
var styles = function styles() {
|
|
51
|
-
return {
|
|
52
|
-
addButton: {
|
|
53
|
-
marginLeft: 8
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
var ButtonStyled = (0, _styles.withStyles)(styles)(RawButton);
|
|
59
|
-
var _default = ButtonStyled;
|
|
60
|
-
exports["default"] = _default;
|
|
61
|
-
//# sourceMappingURL=button.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/button.jsx"],"names":["RawButton","classes","className","label","onClick","disabled","addButton","propTypes","PropTypes","object","isRequired","string","bool","func","defaultProps","styles","marginLeft","ButtonStyled"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,SAAS,GAAG,SAAZA,SAAY;AAAA,MAAGC,OAAH,QAAGA,OAAH;AAAA,MAAYC,SAAZ,QAAYA,SAAZ;AAAA,MAAuBC,KAAvB,QAAuBA,KAAvB;AAAA,MAA8BC,OAA9B,QAA8BA,OAA9B;AAAA,MAAuCC,QAAvC,QAAuCA,QAAvC;AAAA,sBAChB,gCAAC,kBAAD;AACE,IAAA,OAAO,EAAED,OADX;AAEE,IAAA,QAAQ,EAAEC,QAFZ;AAGE,IAAA,SAAS,EAAE,4BAAWJ,OAAO,CAACK,SAAnB,EAA8BJ,SAA9B,CAHb;AAIE,IAAA,IAAI,EAAC,OAJP;AAKE,IAAA,OAAO,EAAC,WALV;AAME,IAAA,KAAK,EAAC;AANR,KAQGC,KARH,CADgB;AAAA,CAAlB;;AAaAH,SAAS,CAACO,SAAV,GAAsB;AACpBN,EAAAA,OAAO,EAAEO,sBAAUC,MAAV,CAAiBC,UADN;AAEpBR,EAAAA,SAAS,EAAEM,sBAAUG,MAFD;AAGpBN,EAAAA,QAAQ,EAAEG,sBAAUI,IAHA;AAIpBT,EAAAA,KAAK,EAAEK,sBAAUG,MAJG;AAKpBP,EAAAA,OAAO,EAAEI,sBAAUK;AALC,CAAtB;AAQAb,SAAS,CAACc,YAAV,GAAyB;AACvBZ,EAAAA,SAAS,EAAE,EADY;AAEvBG,EAAAA,QAAQ,EAAE,KAFa;AAGvBF,EAAAA,KAAK,EAAE,KAHgB;AAIvBC,EAAAA,OAAO,EAAE,mBAAM,CAAE;AAJM,CAAzB;;AAOA,IAAMW,MAAM,GAAG,SAATA,MAAS;AAAA,SAAO;AACpBT,IAAAA,SAAS,EAAE;AACTU,MAAAA,UAAU,EAAE;AADH;AADS,GAAP;AAAA,CAAf;;AAMA,IAAMC,YAAY,GAAG,wBAAWF,MAAX,EAAmBf,SAAnB,CAArB;eAEeiB,Y","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport Button from '@material-ui/core/Button';\n\nconst RawButton = ({ classes, className, label, onClick, disabled }) => (\n <Button\n onClick={onClick}\n disabled={disabled}\n className={classNames(classes.addButton, className)}\n size=\"small\"\n variant=\"contained\"\n color=\"default\"\n >\n {label}\n </Button>\n);\n\nRawButton.propTypes = {\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n disabled: PropTypes.bool,\n label: PropTypes.string,\n onClick: PropTypes.func,\n};\n\nRawButton.defaultProps = {\n className: '',\n disabled: false,\n label: 'Add',\n onClick: () => {},\n};\n\nconst styles = () => ({\n addButton: {\n marginLeft: 8,\n },\n});\n\nconst ButtonStyled = withStyles(styles)(RawButton);\n\nexport default ButtonStyled;\n"],"file":"button.js"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _default = {
|
|
8
|
-
model: {
|
|
9
|
-
prompt: 'This is the question prompt',
|
|
10
|
-
toolbarEditorPosition: 'bottom',
|
|
11
|
-
promptEnabled: true,
|
|
12
|
-
imageUrl: '',
|
|
13
|
-
shapes: {
|
|
14
|
-
rectangles: [],
|
|
15
|
-
polygons: []
|
|
16
|
-
},
|
|
17
|
-
multipleCorrect: true,
|
|
18
|
-
partialScoring: false,
|
|
19
|
-
dimensions: {
|
|
20
|
-
height: 0,
|
|
21
|
-
width: 0
|
|
22
|
-
},
|
|
23
|
-
hotspotColor: 'rgba(137, 183, 244, 0.25)',
|
|
24
|
-
hotspotList: ['rgba(137, 183, 244, 0.25)'],
|
|
25
|
-
outlineColor: 'blue',
|
|
26
|
-
outlineList: ['blue'],
|
|
27
|
-
rationaleEnabled: true,
|
|
28
|
-
teacherInstructionsEnabled: true,
|
|
29
|
-
studentInstructionsEnabled: true,
|
|
30
|
-
strokeWidth: 5
|
|
31
|
-
},
|
|
32
|
-
configuration: {
|
|
33
|
-
multipleCorrect: {
|
|
34
|
-
settings: true,
|
|
35
|
-
label: 'Multiple Correct Responses'
|
|
36
|
-
},
|
|
37
|
-
partialScoring: {
|
|
38
|
-
settings: false,
|
|
39
|
-
label: 'Allow Partial Scoring'
|
|
40
|
-
},
|
|
41
|
-
rationale: {
|
|
42
|
-
settings: true,
|
|
43
|
-
label: 'Rationale'
|
|
44
|
-
},
|
|
45
|
-
prompt: {
|
|
46
|
-
settings: true,
|
|
47
|
-
label: 'Prompt'
|
|
48
|
-
},
|
|
49
|
-
settingsPanelDisabled: false,
|
|
50
|
-
spellCheck: {
|
|
51
|
-
label: 'Spellcheck',
|
|
52
|
-
settings: false,
|
|
53
|
-
enabled: true
|
|
54
|
-
},
|
|
55
|
-
teacherInstructions: {
|
|
56
|
-
settings: true,
|
|
57
|
-
label: 'Teacher Instructions'
|
|
58
|
-
},
|
|
59
|
-
preserveAspectRatio: {
|
|
60
|
-
settings: false,
|
|
61
|
-
enabled: true,
|
|
62
|
-
label: 'Preserve aspect ratio'
|
|
63
|
-
},
|
|
64
|
-
minShapes: 2,
|
|
65
|
-
maxImageWidth: {
|
|
66
|
-
teacherInstructions: 300,
|
|
67
|
-
prompt: 300,
|
|
68
|
-
rationale: 300
|
|
69
|
-
},
|
|
70
|
-
maxImageHeight: {
|
|
71
|
-
teacherInstructions: 300,
|
|
72
|
-
prompt: 300,
|
|
73
|
-
rationale: 300
|
|
74
|
-
},
|
|
75
|
-
withRubric: {
|
|
76
|
-
settings: false,
|
|
77
|
-
label: 'Add Rubric'
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
exports["default"] = _default;
|
|
82
|
-
//# sourceMappingURL=defaults.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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","settingsPanelDisabled","spellCheck","enabled","teacherInstructions","preserveAspectRatio","minShapes","maxImageWidth","maxImageHeight","withRubric"],"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,CAAC,2BAAD,CAhBR;AAiBLC,IAAAA,YAAY,EAAE,MAjBT;AAkBLC,IAAAA,WAAW,EAAE,CAAC,MAAD,CAlBR;AAmBLC,IAAAA,gBAAgB,EAAE,IAnBb;AAoBLC,IAAAA,0BAA0B,EAAE,IApBvB;AAqBLC,IAAAA,0BAA0B,EAAE,IArBvB;AAsBLC,IAAAA,WAAW,EAAE;AAtBR,GADM;AAyBbC,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,qBAAqB,EAAE,KAjBV;AAkBbC,IAAAA,UAAU,EAAE;AACVH,MAAAA,KAAK,EAAE,YADG;AAEVD,MAAAA,QAAQ,EAAE,KAFA;AAGVK,MAAAA,OAAO,EAAE;AAHC,KAlBC;AAuBbC,IAAAA,mBAAmB,EAAE;AACnBN,MAAAA,QAAQ,EAAE,IADS;AAEnBC,MAAAA,KAAK,EAAE;AAFY,KAvBR;AA2BbM,IAAAA,mBAAmB,EAAE;AACnBP,MAAAA,QAAQ,EAAE,KADS;AAEnBK,MAAAA,OAAO,EAAE,IAFU;AAGnBJ,MAAAA,KAAK,EAAE;AAHY,KA3BR;AAgCbO,IAAAA,SAAS,EAAE,CAhCE;AAiCbC,IAAAA,aAAa,EAAE;AACbH,MAAAA,mBAAmB,EAAE,GADR;AAEb3B,MAAAA,MAAM,EAAE,GAFK;AAGbuB,MAAAA,SAAS,EAAE;AAHE,KAjCF;AAsCbQ,IAAAA,cAAc,EAAE;AACdJ,MAAAA,mBAAmB,EAAE,GADP;AAEd3B,MAAAA,MAAM,EAAE,GAFM;AAGduB,MAAAA,SAAS,EAAE;AAHG,KAtCH;AA2CbS,IAAAA,UAAU,EAAE;AACVX,MAAAA,QAAQ,EAAE,KADA;AAEVC,MAAAA,KAAK,EAAE;AAFG;AA3CC;AAzBF,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.25)',\n hotspotList: ['rgba(137, 183, 244, 0.25)'],\n outlineColor: 'blue',\n outlineList: ['blue'],\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 settingsPanelDisabled: false,\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 withRubric: {\n settings: false,\n label: 'Add Rubric',\n },\n },\n};\n"],"file":"defaults.js"}
|
|
@@ -1,398 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports["default"] = exports.Container = void 0;
|
|
11
|
-
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
-
|
|
20
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
-
|
|
22
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
-
|
|
24
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
-
|
|
26
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
-
|
|
28
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
29
|
-
|
|
30
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
|
-
|
|
32
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
33
|
-
|
|
34
|
-
var _index = require("@material-ui/core/styles/index");
|
|
35
|
-
|
|
36
|
-
var _Help = _interopRequireDefault(require("@material-ui/icons/Help"));
|
|
37
|
-
|
|
38
|
-
var _hotspotDrawable = _interopRequireDefault(require("./hotspot-drawable"));
|
|
39
|
-
|
|
40
|
-
var _button = _interopRequireDefault(require("./button"));
|
|
41
|
-
|
|
42
|
-
var _uploadControl = _interopRequireDefault(require("./upload-control"));
|
|
43
|
-
|
|
44
|
-
var _utils = require("./utils");
|
|
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
|
-
|
|
50
|
-
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; }
|
|
51
|
-
|
|
52
|
-
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; }
|
|
53
|
-
|
|
54
|
-
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); }; }
|
|
55
|
-
|
|
56
|
-
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; } }
|
|
57
|
-
|
|
58
|
-
var isImage = function isImage(file) {
|
|
59
|
-
var imageType = /image.*/;
|
|
60
|
-
return file.type.match(imageType);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
var Container = /*#__PURE__*/function (_Component) {
|
|
64
|
-
(0, _inherits2["default"])(Container, _Component);
|
|
65
|
-
|
|
66
|
-
var _super = _createSuper(Container);
|
|
67
|
-
|
|
68
|
-
function Container(props) {
|
|
69
|
-
var _this;
|
|
70
|
-
|
|
71
|
-
(0, _classCallCheck2["default"])(this, Container);
|
|
72
|
-
_this = _super.call(this, props);
|
|
73
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleFileRead", function (file) {
|
|
74
|
-
if (file instanceof Blob) {
|
|
75
|
-
var onImageUpload = _this.props.onImageUpload;
|
|
76
|
-
var reader = new FileReader();
|
|
77
|
-
|
|
78
|
-
reader.onloadend = function () {
|
|
79
|
-
return onImageUpload(reader.result);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
reader.readAsDataURL(file);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleUploadImage", function (e) {
|
|
86
|
-
e.preventDefault();
|
|
87
|
-
|
|
88
|
-
_this.handleFileRead(e.target.files[0]);
|
|
89
|
-
});
|
|
90
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "enableDropzone", function () {
|
|
91
|
-
return _this.setState({
|
|
92
|
-
dropzoneActive: true
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "disableDropzone", function () {
|
|
96
|
-
return _this.setState({
|
|
97
|
-
dropzoneActive: false
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleOnPaste", function (e) {
|
|
101
|
-
var files = e.clipboardData.files;
|
|
102
|
-
|
|
103
|
-
if (files && isImage(files[0])) {
|
|
104
|
-
_this.handleFileRead(files[0]);
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleOnDrop", function (e) {
|
|
108
|
-
e.preventDefault();
|
|
109
|
-
var _e$dataTransfer = e.dataTransfer,
|
|
110
|
-
items = _e$dataTransfer.items,
|
|
111
|
-
files = _e$dataTransfer.files;
|
|
112
|
-
|
|
113
|
-
if (items && items[0].kind === 'file') {
|
|
114
|
-
var file = items[0].getAsFile();
|
|
115
|
-
|
|
116
|
-
if (isImage(file)) {
|
|
117
|
-
_this.handleFileRead(file);
|
|
118
|
-
}
|
|
119
|
-
} else if (isImage(files[0])) {
|
|
120
|
-
_this.handleFileRead(files[0]);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
_this.disableDropzone();
|
|
124
|
-
});
|
|
125
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleOnDragOver", function (e) {
|
|
126
|
-
e.preventDefault();
|
|
127
|
-
var dropzoneActive = _this.state.dropzoneActive;
|
|
128
|
-
|
|
129
|
-
if (!dropzoneActive) {
|
|
130
|
-
_this.enableDropzone();
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleOnDragExit", function (e) {
|
|
134
|
-
e.preventDefault();
|
|
135
|
-
|
|
136
|
-
_this.disableDropzone();
|
|
137
|
-
});
|
|
138
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onUpdateShapes", function (newShapes) {
|
|
139
|
-
var onUpdateShapes = _this.props.onUpdateShapes;
|
|
140
|
-
|
|
141
|
-
_this.setState({
|
|
142
|
-
shapes: newShapes
|
|
143
|
-
}, // always transform shapes array back into shapes map when saving changes
|
|
144
|
-
function () {
|
|
145
|
-
return onUpdateShapes((0, _utils.groupShapes)(newShapes));
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleUndo", function () {
|
|
149
|
-
var shapes = _this.state.shapes;
|
|
150
|
-
|
|
151
|
-
if (shapes && shapes.length) {
|
|
152
|
-
// sort by index value
|
|
153
|
-
var newShapes = shapes.sort(function (a, b) {
|
|
154
|
-
return parseInt(a.index) - parseInt(b.index);
|
|
155
|
-
});
|
|
156
|
-
newShapes = newShapes ? newShapes.slice(0, newShapes.length - 1) : [];
|
|
157
|
-
|
|
158
|
-
_this.onUpdateShapes(newShapes);
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleClearAll", function () {
|
|
162
|
-
return _this.onUpdateShapes([]);
|
|
163
|
-
});
|
|
164
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleEnableDrag", function () {
|
|
165
|
-
return _this.setState({
|
|
166
|
-
dragEnabled: true
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleDisableDrag", function () {
|
|
170
|
-
return _this.setState({
|
|
171
|
-
dragEnabled: false
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleInputClick", function () {
|
|
175
|
-
return _this.input.click();
|
|
176
|
-
});
|
|
177
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toggleTooltip", function () {
|
|
178
|
-
return _this.setState({
|
|
179
|
-
showTooltip: !_this.state.showTooltip
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
_this.state = {
|
|
183
|
-
dragEnabled: true,
|
|
184
|
-
// always transform shapes map into shapes array at this level
|
|
185
|
-
shapes: (0, _utils.getAllShapes)(props.shapes)
|
|
186
|
-
};
|
|
187
|
-
return _this;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
(0, _createClass2["default"])(Container, [{
|
|
191
|
-
key: "render",
|
|
192
|
-
value: function render() {
|
|
193
|
-
var _classNames,
|
|
194
|
-
_this2 = this;
|
|
195
|
-
|
|
196
|
-
var _this$props = this.props,
|
|
197
|
-
classes = _this$props.classes,
|
|
198
|
-
dimensions = _this$props.dimensions,
|
|
199
|
-
hasErrors = _this$props.hasErrors,
|
|
200
|
-
hotspotColor = _this$props.hotspotColor,
|
|
201
|
-
imageUrl = _this$props.imageUrl,
|
|
202
|
-
multipleCorrect = _this$props.multipleCorrect,
|
|
203
|
-
onUpdateImageDimension = _this$props.onUpdateImageDimension,
|
|
204
|
-
outlineColor = _this$props.outlineColor,
|
|
205
|
-
strokeWidth = _this$props.strokeWidth,
|
|
206
|
-
preserveAspectRatioEnabled = _this$props.preserveAspectRatioEnabled;
|
|
207
|
-
var _this$state = this.state,
|
|
208
|
-
dropzoneActive = _this$state.dropzoneActive,
|
|
209
|
-
dragEnabled = _this$state.dragEnabled,
|
|
210
|
-
showTooltip = _this$state.showTooltip;
|
|
211
|
-
var shapes = this.state.shapes;
|
|
212
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
213
|
-
className: classes.base
|
|
214
|
-
}, /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
|
|
215
|
-
className: (0, _classnames["default"])(classes.box, (_classNames = {}, (0, _defineProperty2["default"])(_classNames, classes.boxError, hasErrors && !dropzoneActive), (0, _defineProperty2["default"])(_classNames, classes.boxActive, dropzoneActive), _classNames))
|
|
216
|
-
}, dragEnabled ? {
|
|
217
|
-
onDragExit: this.handleOnDragExit,
|
|
218
|
-
onDragLeave: this.handleOnDragExit,
|
|
219
|
-
onDragOver: this.handleOnDragOver,
|
|
220
|
-
onDrop: this.handleOnDrop,
|
|
221
|
-
onPaste: this.handleOnPaste
|
|
222
|
-
} : {}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
223
|
-
className: classes.toolbar
|
|
224
|
-
}, imageUrl && /*#__PURE__*/_react["default"].createElement(_uploadControl["default"], {
|
|
225
|
-
classNameButton: classes.replaceButton,
|
|
226
|
-
classNameSection: classes.replaceSection,
|
|
227
|
-
label: "Replace Image",
|
|
228
|
-
onInputClick: this.handleInputClick,
|
|
229
|
-
onUploadImage: this.handleUploadImage,
|
|
230
|
-
setRef: function setRef(ref) {
|
|
231
|
-
_this2.input = ref;
|
|
232
|
-
}
|
|
233
|
-
}), /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
234
|
-
disabled: !(shapes && shapes.length),
|
|
235
|
-
onClick: this.handleUndo,
|
|
236
|
-
label: "Undo"
|
|
237
|
-
}), /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
238
|
-
disabled: !(shapes && shapes.length),
|
|
239
|
-
onClick: this.handleClearAll,
|
|
240
|
-
label: "Clear all"
|
|
241
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
242
|
-
ref: function ref(_ref) {
|
|
243
|
-
_this2.imageSection = _ref;
|
|
244
|
-
},
|
|
245
|
-
className: classes.drawableHeight
|
|
246
|
-
}, imageUrl ? /*#__PURE__*/_react["default"].createElement(_hotspotDrawable["default"], {
|
|
247
|
-
dimensions: dimensions,
|
|
248
|
-
disableDrag: this.handleDisableDrag,
|
|
249
|
-
enableDrag: this.handleEnableDrag,
|
|
250
|
-
imageUrl: imageUrl,
|
|
251
|
-
hotspotColor: hotspotColor,
|
|
252
|
-
multipleCorrect: multipleCorrect,
|
|
253
|
-
onUpdateImageDimension: onUpdateImageDimension,
|
|
254
|
-
onUpdateShapes: this.onUpdateShapes,
|
|
255
|
-
outlineColor: outlineColor,
|
|
256
|
-
shapes: shapes,
|
|
257
|
-
strokeWidth: strokeWidth,
|
|
258
|
-
preserveAspectRatioEnabled: preserveAspectRatioEnabled
|
|
259
|
-
}) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
260
|
-
className: (0, _classnames["default"])(classes.drawableHeight, classes.centered)
|
|
261
|
-
}, /*#__PURE__*/_react["default"].createElement("label", null, "Drag and drop or upload image from computer"), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement(_uploadControl["default"], {
|
|
262
|
-
label: "Upload Image",
|
|
263
|
-
onInputClick: this.handleInputClick,
|
|
264
|
-
onUploadImage: this.handleUploadImage,
|
|
265
|
-
setRef: function setRef(ref) {
|
|
266
|
-
_this2.input = ref;
|
|
267
|
-
}
|
|
268
|
-
}))), imageUrl && /*#__PURE__*/_react["default"].createElement("div", {
|
|
269
|
-
className: classes.tooltip
|
|
270
|
-
}, showTooltip && /*#__PURE__*/_react["default"].createElement("div", {
|
|
271
|
-
className: classes.tooltipContent
|
|
272
|
-
}, /*#__PURE__*/_react["default"].createElement("label", null, "Click and drag to create a hotspot. Click the hotspot to mark correct. Click again to unmark."), /*#__PURE__*/_react["default"].createElement("div", {
|
|
273
|
-
className: classes.tooltipArrow
|
|
274
|
-
})), /*#__PURE__*/_react["default"].createElement(_Help["default"], {
|
|
275
|
-
className: classes.icon,
|
|
276
|
-
onMouseOut: this.toggleTooltip,
|
|
277
|
-
onMouseOver: this.toggleTooltip
|
|
278
|
-
}))));
|
|
279
|
-
}
|
|
280
|
-
}], [{
|
|
281
|
-
key: "getDerivedStateFromProps",
|
|
282
|
-
value: function getDerivedStateFromProps(nextProps, prevState) {
|
|
283
|
-
// always transform shapes map into shapes array at this level
|
|
284
|
-
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
285
|
-
shapes: (0, _utils.getAllShapes)(nextProps.shapes)
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
}]);
|
|
289
|
-
return Container;
|
|
290
|
-
}(_react.Component);
|
|
291
|
-
|
|
292
|
-
exports.Container = Container;
|
|
293
|
-
|
|
294
|
-
var styles = function styles(theme) {
|
|
295
|
-
return {
|
|
296
|
-
base: {
|
|
297
|
-
marginTop: theme.spacing.unit * 2
|
|
298
|
-
},
|
|
299
|
-
box: {
|
|
300
|
-
border: '1px solid #E0E1E6',
|
|
301
|
-
borderRadius: '5px'
|
|
302
|
-
},
|
|
303
|
-
boxActive: {
|
|
304
|
-
border: '1px solid #0032C2'
|
|
305
|
-
},
|
|
306
|
-
boxError: {
|
|
307
|
-
border: '1px solid red'
|
|
308
|
-
},
|
|
309
|
-
centered: {
|
|
310
|
-
alignItems: 'center',
|
|
311
|
-
display: 'flex',
|
|
312
|
-
flexDirection: 'column',
|
|
313
|
-
justifyContent: 'center'
|
|
314
|
-
},
|
|
315
|
-
drawableHeight: {
|
|
316
|
-
minHeight: 350,
|
|
317
|
-
paddingBottom: theme.spacing.unit * 5,
|
|
318
|
-
paddingRight: theme.spacing.unit * 5
|
|
319
|
-
},
|
|
320
|
-
icon: {
|
|
321
|
-
'&:hover': {
|
|
322
|
-
color: '#333131',
|
|
323
|
-
cursor: 'help'
|
|
324
|
-
},
|
|
325
|
-
color: '#C1C1C1'
|
|
326
|
-
},
|
|
327
|
-
replaceButton: {
|
|
328
|
-
marginLeft: 0
|
|
329
|
-
},
|
|
330
|
-
replaceSection: {
|
|
331
|
-
marginRight: 'auto'
|
|
332
|
-
},
|
|
333
|
-
toolbar: {
|
|
334
|
-
backgroundColor: '#ECEDF1',
|
|
335
|
-
borderBottom: '1px solid #E0E1E6',
|
|
336
|
-
borderTopLeftRadius: '5px',
|
|
337
|
-
borderTopRightRadius: '5px',
|
|
338
|
-
display: 'flex',
|
|
339
|
-
justifyContent: 'flex-end',
|
|
340
|
-
padding: theme.spacing.unit
|
|
341
|
-
},
|
|
342
|
-
tooltip: {
|
|
343
|
-
position: 'relative',
|
|
344
|
-
textAlign: 'right',
|
|
345
|
-
padding: theme.spacing.unit
|
|
346
|
-
},
|
|
347
|
-
tooltipContent: {
|
|
348
|
-
background: '#333131',
|
|
349
|
-
borderRadius: '4px',
|
|
350
|
-
color: '#FFFFFF',
|
|
351
|
-
fontSize: theme.typography.fontSize,
|
|
352
|
-
lineHeight: '18px',
|
|
353
|
-
marginTop: '-60px',
|
|
354
|
-
padding: theme.spacing.unit,
|
|
355
|
-
position: 'absolute',
|
|
356
|
-
right: '5px',
|
|
357
|
-
textAlign: 'left',
|
|
358
|
-
width: '300px'
|
|
359
|
-
},
|
|
360
|
-
tooltipArrow: {
|
|
361
|
-
width: 0,
|
|
362
|
-
height: 0,
|
|
363
|
-
borderLeft: '10px solid transparent',
|
|
364
|
-
borderRight: '10px solid transparent',
|
|
365
|
-
borderTop: '10px solid #333131',
|
|
366
|
-
marginBottom: -10,
|
|
367
|
-
marginTop: '4px',
|
|
368
|
-
position: 'absolute',
|
|
369
|
-
right: '5px'
|
|
370
|
-
}
|
|
371
|
-
};
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
Container.propTypes = {
|
|
375
|
-
classes: _propTypes["default"].object.isRequired,
|
|
376
|
-
dimensions: _propTypes["default"].object.isRequired,
|
|
377
|
-
imageUrl: _propTypes["default"].string.isRequired,
|
|
378
|
-
hotspotColor: _propTypes["default"].string.isRequired,
|
|
379
|
-
multipleCorrect: _propTypes["default"].bool.isRequired,
|
|
380
|
-
onImageUpload: _propTypes["default"].func.isRequired,
|
|
381
|
-
onUpdateImageDimension: _propTypes["default"].func.isRequired,
|
|
382
|
-
onUpdateShapes: _propTypes["default"].func.isRequired,
|
|
383
|
-
outlineColor: _propTypes["default"].string.isRequired,
|
|
384
|
-
shapes: _propTypes["default"].shape({
|
|
385
|
-
rectangles: _propTypes["default"].array,
|
|
386
|
-
polygons: _propTypes["default"].array
|
|
387
|
-
}).isRequired,
|
|
388
|
-
strokeWidth: _propTypes["default"].number,
|
|
389
|
-
preserveAspectRatioEnabled: _propTypes["default"].bool
|
|
390
|
-
};
|
|
391
|
-
Container.defaultProps = {
|
|
392
|
-
strokeWidth: 5
|
|
393
|
-
};
|
|
394
|
-
|
|
395
|
-
var _default = (0, _index.withStyles)(styles)(Container);
|
|
396
|
-
|
|
397
|
-
exports["default"] = _default;
|
|
398
|
-
//# sourceMappingURL=hotspot-container.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hotspot-container.jsx"],"names":["isImage","file","imageType","type","match","Container","props","Blob","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","hasErrors","hotspotColor","imageUrl","multipleCorrect","onUpdateImageDimension","outlineColor","strokeWidth","preserveAspectRatioEnabled","base","box","boxError","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","typography","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;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;AAEA,IAAMA,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAAU;AACxB,MAAMC,SAAS,GAAG,SAAlB;AAEA,SAAOD,IAAI,CAACE,IAAL,CAAUC,KAAV,CAAgBF,SAAhB,CAAP;AACD,CAJD;;IAMaG,S;;;;;AASX,qBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,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A,WAAW,EAAE,wBAJD;AAKZC,MAAAA,SAAS,EAAE,oBALC;AAMZC,MAAAA,YAAY,EAAE,CAAC,EANH;AAOZjC,MAAAA,SAAS,EAAE,KAPC;AAQZqB,MAAAA,QAAQ,EAAE,UARE;AASZM,MAAAA,KAAK,EAAE;AATK;AAjEW,GAAZ;AAAA,CAAf;;AA8EA/G,SAAS,CAACsH,SAAV,GAAsB;AACpBhF,EAAAA,OAAO,EAAEiF,sBAAUC,MAAV,CAAiBC,UADN;AAEpBlF,EAAAA,UAAU,EAAEgF,sBAAUC,MAAV,CAAiBC,UAFT;AAGpB/E,EAAAA,QAAQ,EAAE6E,sBAAUG,MAAV,CAAiBD,UAHP;AAIpBhF,EAAAA,YAAY,EAAE8E,sBAAUG,MAAV,CAAiBD,UAJX;AAKpB9E,EAAAA,eAAe,EAAE4E,sBAAUI,IAAV,CAAeF,UALZ;AAMpBtH,EAAAA,aAAa,EAAEoH,sBAAUK,IAAV,CAAeH,UANV;AAOpB7E,EAAAA,sBAAsB,EAAE2E,sBAAUK,IAAV,CAAeH,UAPnB;AAQpBhG,EAAAA,cAAc,EAAE8F,sBAAUK,IAAV,CAAeH,UARX;AASpB5E,EAAAA,YAAY,EAAE0E,sBAAUG,MAAV,CAAiBD,UATX;AAUpB/F,EAAAA,MAAM,EAAE6F,sBAAUM,KAAV,CAAgB;AACtBC,IAAAA,UAAU,EAAEP,sBAAUQ,KADA;AAEtBC,IAAAA,QAAQ,EAAET,sBAAUQ;AAFE,GAAhB,EAGLN,UAbiB;AAcpB3E,EAAAA,WAAW,EAAEyE,sBAAUU,MAdH;AAepBlF,EAAAA,0BAA0B,EAAEwE,sBAAUI;AAflB,CAAtB;AAkBA3H,SAAS,CAACkI,YAAV,GAAyB;AACvBpF,EAAAA,WAAW,EAAE;AADU,CAAzB;;eAIe,uBAAWoC,MAAX,EAAmBlF,SAAnB,C","sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\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\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 if (file instanceof Blob) {\n const { onImageUpload } = this.props;\n const reader = new FileReader();\n\n reader.onloadend = () => onImageUpload(reader.result);\n reader.readAsDataURL(file);\n }\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\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\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\n handleDisableDrag = () => this.setState({ dragEnabled: false });\n\n handleInputClick = () => this.input.click();\n\n toggleTooltip = () => this.setState({ showTooltip: !this.state.showTooltip });\n\n render() {\n const {\n classes,\n dimensions,\n hasErrors,\n hotspotColor,\n imageUrl,\n multipleCorrect,\n onUpdateImageDimension,\n outlineColor,\n strokeWidth,\n preserveAspectRatioEnabled,\n } = this.props;\n const { dropzoneActive, dragEnabled, showTooltip } = this.state;\n const { shapes } = this.state;\n\n return (\n <div className={classes.base}>\n <div\n className={classNames(classes.box, {\n [classes.boxError]: hasErrors && !dropzoneActive,\n [classes.boxActive]: dropzoneActive,\n })}\n {...(dragEnabled\n ? {\n onDragExit: this.handleOnDragExit,\n onDragLeave: this.handleOnDragExit,\n onDragOver: this.handleOnDragOver,\n onDrop: this.handleOnDrop,\n onPaste: this.handleOnPaste,\n }\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\n <Button disabled={!(shapes && shapes.length)} onClick={this.handleUndo} label=\"Undo\" />\n <Button disabled={!(shapes && shapes.length)} onClick={this.handleClearAll} label=\"Clear all\" />\n </div>\n\n <div\n ref={(ref) => {\n this.imageSection = ref;\n }}\n className={classes.drawableHeight}\n >\n {imageUrl ? (\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 <div className={classNames(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 again to unmark.\n </label>\n <div className={classes.tooltipArrow} />\n </div>\n )}\n\n <Help className={classes.icon} onMouseOut={this.toggleTooltip} onMouseOver={this.toggleTooltip} />\n </div>\n )}\n </div>\n </div>\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 boxError: {\n border: '1px solid red',\n },\n centered: {\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n },\n drawableHeight: {\n minHeight: 350,\n paddingBottom: theme.spacing.unit * 5,\n paddingRight: theme.spacing.unit * 5,\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: theme.spacing.unit,\n },\n tooltip: {\n position: 'relative',\n textAlign: 'right',\n padding: theme.spacing.unit,\n },\n tooltipContent: {\n background: '#333131',\n borderRadius: '4px',\n color: '#FFFFFF',\n fontSize: theme.typography.fontSize,\n lineHeight: '18px',\n marginTop: '-60px',\n padding: theme.spacing.unit,\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: '4px',\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};\n\nContainer.defaultProps = {\n strokeWidth: 5,\n};\n\nexport default withStyles(styles)(Container);\n"],"file":"hotspot-container.js"}
|