@pie-element/hotspot 6.24.1-next.18 → 6.24.1-next.5
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/hotspot-circle.js +3 -11
- package/configure/lib/hotspot-circle.js.map +1 -1
- package/configure/lib/hotspot-container.js +1 -7
- package/configure/lib/hotspot-container.js.map +1 -1
- package/configure/lib/hotspot-drawable.js +1 -7
- package/configure/lib/hotspot-drawable.js.map +1 -1
- package/configure/lib/hotspot-polygon.js +3 -43
- package/configure/lib/hotspot-polygon.js.map +1 -1
- package/configure/lib/hotspot-rectangle.js +5 -18
- package/configure/lib/hotspot-rectangle.js.map +1 -1
- package/configure/lib/root.js +0 -2
- package/configure/lib/root.js.map +1 -1
- package/configure/package.json +1 -1
- package/configure/src/hotspot-circle.jsx +6 -30
- package/configure/src/hotspot-container.jsx +0 -7
- package/configure/src/hotspot-drawable.jsx +42 -52
- package/configure/src/hotspot-polygon.jsx +2 -50
- package/configure/src/hotspot-rectangle.jsx +4 -34
- package/configure/src/root.jsx +0 -2
- package/controller/package.json +1 -1
- package/docs/pie-schema.json +0 -10
- package/docs/pie-schema.json.md +0 -8
- package/package.json +3 -3
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { Group, Line, Circle } from 'react-konva';
|
|
4
4
|
import { withStyles } from '@material-ui/core/styles/index';
|
|
5
|
-
import { Rect } from 'react-konva/lib/ReactKonvaCore';
|
|
6
5
|
import DeleteWidget from './DeleteWidget';
|
|
7
6
|
|
|
8
7
|
const HOVERED_COLOR = '#00BFFF';
|
|
@@ -167,66 +166,21 @@ class PolComponent extends React.Component {
|
|
|
167
166
|
onDeleteShape(id);
|
|
168
167
|
};
|
|
169
168
|
|
|
170
|
-
// serialize(points) {
|
|
171
|
-
// return points.reduce((acc, point) => [...acc, point.x, point.y], []);
|
|
172
|
-
// }
|
|
173
|
-
|
|
174
|
-
getBoundingBox(points) {
|
|
175
|
-
const xValues = points.map((point) => point.x);
|
|
176
|
-
const yValues = points.map((point) => point.y);
|
|
177
|
-
const minX = Math.min(...xValues);
|
|
178
|
-
const maxX = Math.max(...xValues);
|
|
179
|
-
const minY = Math.min(...yValues);
|
|
180
|
-
const maxY = Math.max(...yValues);
|
|
181
|
-
return {
|
|
182
|
-
x: minX,
|
|
183
|
-
y: minY,
|
|
184
|
-
width: maxX - minX,
|
|
185
|
-
height: maxY - minY,
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
|
|
189
169
|
render() {
|
|
190
|
-
const {
|
|
191
|
-
classes,
|
|
192
|
-
correct,
|
|
193
|
-
id,
|
|
194
|
-
hotspotColor,
|
|
195
|
-
outlineColor,
|
|
196
|
-
selectedHotspotColor,
|
|
197
|
-
hoverOutlineColor,
|
|
198
|
-
strokeWidth = 5,
|
|
199
|
-
} = this.props;
|
|
200
|
-
|
|
170
|
+
const { classes, correct, id, hotspotColor, outlineColor, strokeWidth = 5 } = this.props;
|
|
201
171
|
const { points, x, y, hovered } = this.state;
|
|
202
172
|
const showPoints = hovered || id === 'newPolygon';
|
|
203
173
|
|
|
204
|
-
const hoverColor = hoverOutlineColor || HOVERED_COLOR;
|
|
205
|
-
|
|
206
174
|
const calculatedStrokeWidth = correct ? strokeWidth : hovered ? 1 : 0;
|
|
207
175
|
const calculatedStroke = correct ? outlineColor : hovered ? HOVERED_COLOR : '';
|
|
208
|
-
// const calculatedStroke = correct ? outlineColor : hovered ? hoverColor : '';
|
|
209
|
-
const boundingBox = this.getBoundingBox(points);
|
|
210
176
|
|
|
211
177
|
return (
|
|
212
178
|
<Group classes={classes.group} onMouseLeave={this.handleMouseLeave} onMouseEnter={this.handleMouseEnter}>
|
|
213
|
-
{hoverOutlineColor && hovered && (
|
|
214
|
-
<Rect
|
|
215
|
-
x={boundingBox.x}
|
|
216
|
-
y={boundingBox.y}
|
|
217
|
-
width={boundingBox.width}
|
|
218
|
-
height={boundingBox.height}
|
|
219
|
-
stroke={hoverOutlineColor}
|
|
220
|
-
strokeWidth={2}
|
|
221
|
-
listening={false}
|
|
222
|
-
/>
|
|
223
|
-
)}
|
|
224
|
-
|
|
225
179
|
<Line
|
|
226
180
|
classes={classes.base}
|
|
227
181
|
points={this.serialize(points)}
|
|
228
182
|
closed={true}
|
|
229
|
-
fill={
|
|
183
|
+
fill={hotspotColor}
|
|
230
184
|
onClick={this.handleClick}
|
|
231
185
|
onTap={this.handleClick}
|
|
232
186
|
draggable
|
|
@@ -290,8 +244,6 @@ PolComponent.propTypes = {
|
|
|
290
244
|
imageHeight: PropTypes.number,
|
|
291
245
|
imageWidth: PropTypes.number,
|
|
292
246
|
hotspotColor: PropTypes.string.isRequired,
|
|
293
|
-
selectedHotspotColor: PropTypes.string,
|
|
294
|
-
hoverOutlineColor: PropTypes.string,
|
|
295
247
|
onClick: PropTypes.func.isRequired,
|
|
296
248
|
addPolygonPoint: PropTypes.func.isRequired,
|
|
297
249
|
onDeleteShape: PropTypes.func.isRequired,
|
|
@@ -74,48 +74,20 @@ class RectComponent extends React.Component {
|
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
render() {
|
|
77
|
-
const {
|
|
78
|
-
classes,
|
|
79
|
-
correct,
|
|
80
|
-
height,
|
|
81
|
-
hotspotColor,
|
|
82
|
-
id,
|
|
83
|
-
outlineColor,
|
|
84
|
-
width,
|
|
85
|
-
x,
|
|
86
|
-
y,
|
|
87
|
-
strokeWidth = 5,
|
|
88
|
-
selectedHotspotColor,
|
|
89
|
-
hoverOutlineColor,
|
|
90
|
-
} = this.props;
|
|
91
|
-
|
|
92
|
-
const { hovered } = this.state;
|
|
93
|
-
|
|
77
|
+
const { classes, correct, height, hotspotColor, id, outlineColor, width, x, y, strokeWidth = 5 } = this.props;
|
|
94
78
|
return (
|
|
95
79
|
<Group classes={classes.group} onMouseLeave={this.handleMouseLeave} onMouseEnter={this.handleMouseEnter}>
|
|
96
|
-
{hoverOutlineColor && hovered && (
|
|
97
|
-
<Rect
|
|
98
|
-
x={x}
|
|
99
|
-
y={y}
|
|
100
|
-
width={width}
|
|
101
|
-
height={height}
|
|
102
|
-
stroke={hoverOutlineColor}
|
|
103
|
-
strokeWidth={2}
|
|
104
|
-
listening={false}
|
|
105
|
-
/>
|
|
106
|
-
)}
|
|
107
|
-
|
|
108
80
|
<Rect
|
|
109
81
|
classes={classes.base}
|
|
110
82
|
ref={this.shapeRef}
|
|
111
83
|
width={width}
|
|
112
84
|
height={height}
|
|
113
|
-
fill={
|
|
85
|
+
fill={hotspotColor}
|
|
114
86
|
onClick={this.handleClick}
|
|
115
87
|
onTap={this.handleClick}
|
|
116
88
|
draggable
|
|
117
|
-
stroke={
|
|
118
|
-
strokeWidth={correct
|
|
89
|
+
stroke={outlineColor}
|
|
90
|
+
strokeWidth={correct ? strokeWidth : 0}
|
|
119
91
|
onDragStart={() => this.setState({ isDragging: true })}
|
|
120
92
|
onDragEnd={this.handleOnDragEnd}
|
|
121
93
|
onTransformStart={() => this.setState({ isDragging: true })}
|
|
@@ -162,8 +134,6 @@ RectComponent.propTypes = {
|
|
|
162
134
|
id: PropTypes.string.isRequired,
|
|
163
135
|
height: PropTypes.number.isRequired,
|
|
164
136
|
hotspotColor: PropTypes.string.isRequired,
|
|
165
|
-
selectedHotspotColor: PropTypes.string,
|
|
166
|
-
hoverOutlineColor: PropTypes.string,
|
|
167
137
|
onClick: PropTypes.func.isRequired,
|
|
168
138
|
onDeleteShape: PropTypes.func.isRequired,
|
|
169
139
|
onDragEnd: PropTypes.func.isRequired,
|
package/configure/src/root.jsx
CHANGED
|
@@ -214,8 +214,6 @@ export class Root extends React.Component {
|
|
|
214
214
|
hasErrors={!!shapesError || !!selectionsError}
|
|
215
215
|
hotspotColor={model.hotspotColor}
|
|
216
216
|
outlineColor={model.outlineColor}
|
|
217
|
-
selectedHotspotColor={model.selectedHotspotColor}
|
|
218
|
-
hoverOutlineColor={model.hoverOutlineColor}
|
|
219
217
|
onUpdateImageDimension={onUpdateImageDimension}
|
|
220
218
|
onUpdateShapes={onUpdateShapes}
|
|
221
219
|
onImageUpload={onImageUpload}
|
package/controller/package.json
CHANGED
package/docs/pie-schema.json
CHANGED
|
@@ -164,16 +164,6 @@
|
|
|
164
164
|
"type": "string",
|
|
165
165
|
"title": "hotspotColor"
|
|
166
166
|
},
|
|
167
|
-
"selectedHotspotColor": {
|
|
168
|
-
"description": "The color that fills the hotspot",
|
|
169
|
-
"type": "string",
|
|
170
|
-
"title": "selectedHotspotColor"
|
|
171
|
-
},
|
|
172
|
-
"hoverOutlineColor": {
|
|
173
|
-
"description": "The color of the rectangular outline",
|
|
174
|
-
"type": "string",
|
|
175
|
-
"title": "hoverOutlineColor"
|
|
176
|
-
},
|
|
177
167
|
"hotspotList": {
|
|
178
168
|
"description": "The filling hotspot color options",
|
|
179
169
|
"type": "array",
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -110,14 +110,6 @@ the width of the section
|
|
|
110
110
|
|
|
111
111
|
The color that fills the hotspot
|
|
112
112
|
|
|
113
|
-
# `selectedHotspotColor` (string)
|
|
114
|
-
|
|
115
|
-
The color that fills the hotspot
|
|
116
|
-
|
|
117
|
-
# `hoverOutlineColor` (string)
|
|
118
|
-
|
|
119
|
-
The color of the rectangular outline
|
|
120
|
-
|
|
121
113
|
# `hotspotList` (array)
|
|
122
114
|
|
|
123
115
|
The filling hotspot color options
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/hotspot",
|
|
3
|
-
"version": "6.24.1-next.
|
|
3
|
+
"version": "6.24.1-next.5+6084f693c",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": "pie-framework/pie-elements",
|
|
6
6
|
"publishConfig": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@material-ui/core": "^3.9.3",
|
|
11
11
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
12
|
-
"@pie-lib/pie-toolbox": "1.
|
|
12
|
+
"@pie-lib/pie-toolbox": "1.28.0",
|
|
13
13
|
"konva": "^3.2.5",
|
|
14
14
|
"prop-types": "^15.6.1",
|
|
15
15
|
"react": "^16.8.1",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"author": "pie framework developers",
|
|
20
20
|
"license": "ISC",
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "6084f693cf23739eba410d0a16ee53a292e9077d",
|
|
22
22
|
"scripts": {
|
|
23
23
|
"postpublish": "../../scripts/postpublish"
|
|
24
24
|
},
|