@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.
@@ -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={correct ? selectedHotspotColor : hotspotColor}
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={correct ? selectedHotspotColor : hotspotColor}
85
+ fill={hotspotColor}
114
86
  onClick={this.handleClick}
115
87
  onTap={this.handleClick}
116
88
  draggable
117
- stroke={hovered ? 'transparent' : outlineColor}
118
- strokeWidth={correct && !hovered ? strokeWidth : 0}
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,
@@ -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}
@@ -11,7 +11,7 @@
11
11
  "main": "lib/index.js",
12
12
  "module": "src/index.js",
13
13
  "dependencies": {
14
- "@pie-lib/pie-toolbox": "1.29.0",
14
+ "@pie-lib/pie-toolbox": "1.28.0",
15
15
  "debug": "^4.1.1",
16
16
  "lodash": "^4.17.15"
17
17
  }
@@ -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",
@@ -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.18+a61e1177e",
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.29.0",
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": "a61e1177e55cd7bd8d244c638fda8a313f960078",
21
+ "gitHead": "6084f693cf23739eba410d0a16ee53a292e9077d",
22
22
  "scripts": {
23
23
  "postpublish": "../../scripts/postpublish"
24
24
  },