@pie-element/drawing-response 4.3.4-next.8 → 4.3.4-next.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/configure/lib/button.js.map +1 -1
  2. package/configure/lib/defaults.js.map +1 -1
  3. package/configure/lib/image-container.js +2 -2
  4. package/configure/lib/image-container.js.map +1 -1
  5. package/configure/lib/index.js.map +1 -1
  6. package/configure/lib/root.js.map +1 -1
  7. package/configure/package.json +2 -2
  8. package/configure/src/__tests__/image-container.test.jsx +42 -35
  9. package/configure/src/__tests__/index.test.js +7 -7
  10. package/configure/src/__tests__/root.test.jsx +18 -18
  11. package/configure/src/button.jsx +4 -4
  12. package/configure/src/defaults.js +11 -11
  13. package/configure/src/image-container.jsx +7 -18
  14. package/configure/src/index.js +5 -5
  15. package/configure/src/root.jsx +10 -28
  16. package/controller/lib/defaults.js.map +1 -1
  17. package/controller/lib/index.js.map +1 -1
  18. package/controller/src/__tests__/index.test.js +20 -19
  19. package/controller/src/defaults.js +2 -2
  20. package/controller/src/index.js +12 -16
  21. package/docs/config-schema.json.md +1 -1
  22. package/docs/demo/config.js +2 -2
  23. package/docs/demo/generate.js +2 -2
  24. package/docs/demo/session.js +4 -4
  25. package/docs/pie-schema.json.md +1 -1
  26. package/lib/drawing-response/button.js.map +1 -1
  27. package/lib/drawing-response/constants.js.map +1 -1
  28. package/lib/drawing-response/container.js.map +1 -1
  29. package/lib/drawing-response/drawable-image.js.map +1 -1
  30. package/lib/drawing-response/drawable-main.js +1 -0
  31. package/lib/drawing-response/drawable-main.js.map +1 -1
  32. package/lib/drawing-response/drawable-palette.js.map +1 -1
  33. package/lib/drawing-response/drawable-text.js.map +1 -1
  34. package/lib/drawing-response/drawable-transformer.js.map +1 -1
  35. package/lib/drawing-response/factory.js.map +1 -1
  36. package/lib/drawing-response/icon.js.map +1 -1
  37. package/lib/drawing-response/index.js.map +1 -1
  38. package/lib/index.js.map +1 -1
  39. package/package.json +2 -2
  40. package/src/__tests__/drawing-index-test.jsx +4 -4
  41. package/src/drawing-response/__tests__/container.test.jsx +2 -2
  42. package/src/drawing-response/__tests__/drawable-helper.test.jsx +1 -1
  43. package/src/drawing-response/__tests__/drawing-main.test.jsx +73 -86
  44. package/src/drawing-response/button.jsx +5 -8
  45. package/src/drawing-response/constants.js +42 -34
  46. package/src/drawing-response/container.jsx +36 -55
  47. package/src/drawing-response/drawable-image.jsx +4 -4
  48. package/src/drawing-response/drawable-main.jsx +1 -0
  49. package/src/drawing-response/drawable-palette.jsx +13 -37
  50. package/src/drawing-response/drawable-text.jsx +29 -49
  51. package/src/drawing-response/drawable-transformer.jsx +3 -1
  52. package/src/drawing-response/factory.js +3 -11
  53. package/src/drawing-response/icon.jsx +19 -20
  54. package/src/drawing-response/index.jsx +8 -16
  55. package/src/index.js +3 -11
@@ -11,16 +11,10 @@ import Icon from './icon';
11
11
 
12
12
  const { tools: TOOLS } = constants;
13
13
 
14
- const ROGVAIV = [
15
- 'red',
16
- 'orange',
17
- 'yellow',
18
- 'violet',
19
- 'blue',
20
- 'green',
21
- 'white',
22
- 'black'
23
- ].map(c => ({ value: c, label: c }));
14
+ const ROGVAIV = ['red', 'orange', 'yellow', 'violet', 'blue', 'green', 'white', 'black'].map((c) => ({
15
+ value: c,
16
+ label: c,
17
+ }));
24
18
 
25
19
  export class Container extends Component {
26
20
  static propTypes = {
@@ -30,7 +24,7 @@ export class Container extends Component {
30
24
  onSessionChange: PropTypes.func.isRequired,
31
25
  imageDimensions: PropTypes.object.isRequired,
32
26
  imageUrl: PropTypes.string.isRequired,
33
- backgroundImageEnabled: PropTypes.bool.isRequired
27
+ backgroundImageEnabled: PropTypes.bool.isRequired,
34
28
  };
35
29
 
36
30
  constructor(props) {
@@ -41,7 +35,7 @@ export class Container extends Component {
41
35
  scale: 1,
42
36
  drawableDimensions: {
43
37
  height: 0,
44
- width: 0
38
+ width: 0,
45
39
  },
46
40
  toolActive: TOOLS[0],
47
41
  fillColor: 'white',
@@ -49,13 +43,13 @@ export class Container extends Component {
49
43
  { value: 'transparent', label: 'no fill' },
50
44
  { value: 'lightblue', label: 'light blue' },
51
45
  { value: 'lightyellow', label: 'light yellow' },
52
- ...ROGVAIV
46
+ ...ROGVAIV,
53
47
  ],
54
48
  outlineColor: 'black',
55
49
  outlineColorList: ROGVAIV,
56
50
  paintColor: 'red',
57
51
  paintColorList: ROGVAIV,
58
- TextEntry
52
+ TextEntry,
59
53
  };
60
54
  }
61
55
 
@@ -67,8 +61,8 @@ export class Container extends Component {
67
61
  this.setState({
68
62
  drawableDimensions: {
69
63
  height,
70
- width
71
- }
64
+ width,
65
+ },
72
66
  });
73
67
  }
74
68
  } catch (e) {
@@ -85,19 +79,16 @@ export class Container extends Component {
85
79
 
86
80
  this.observer = new MutationObserver((mutations) => {
87
81
  mutations.forEach(() => {
88
- const target = document.getElementById('question-container')?.style?.cssText
89
- const zoom = target?.substring(
90
- target.indexOf('--pie-zoom') + 11,
91
- target.lastIndexOf('%')
92
- );
82
+ const target = document.getElementById('question-container')?.style?.cssText;
83
+ const zoom = target?.substring(target.indexOf('--pie-zoom') + 11, target.lastIndexOf('%'));
93
84
  const zoomParsed = zoom?.replace(/\s/g, '');
94
85
 
95
- if (zoomParsed) {
86
+ if (zoomParsed) {
96
87
  const newScale = parseFloat(zoomParsed) / 100;
97
88
  if (newScale !== this.state.scale) {
98
89
  this.setState({
99
90
  scale: parseFloat(zoomParsed) / 100,
100
- })
91
+ });
101
92
  }
102
93
  } else if (!zoomParsed && this.state.scale !== 1) {
103
94
  this.setState({
@@ -109,7 +100,7 @@ export class Container extends Component {
109
100
 
110
101
  const target = document.getElementById('question-container');
111
102
  if (target) {
112
- this.observer.observe(target, { attributes : true, attributeFilter : ['style'] })
103
+ this.observer.observe(target, { attributes: true, attributeFilter: ['style'] });
113
104
  }
114
105
  }
115
106
 
@@ -126,21 +117,20 @@ export class Container extends Component {
126
117
 
127
118
  if (type !== 'Text') {
128
119
  this.setState({
129
- toolActive: tool
120
+ toolActive: tool,
130
121
  });
131
122
  } else {
132
123
  TextEntry.addNewTextEntry();
133
124
  // Force update
134
125
  this.setState({
135
- updatedAt: new Date()
126
+ updatedAt: new Date(),
136
127
  });
137
128
  }
138
129
  }
139
130
 
140
- checkIfToolIsDisabled = type => {
131
+ checkIfToolIsDisabled = (type) => {
141
132
  if (this.props.disabled) return true;
142
133
 
143
-
144
134
  const { toolActive } = this.state;
145
135
  // Text will never be disabled since on each "Text Entry" click a new text is added
146
136
  if (type === 'Text') {
@@ -152,20 +142,13 @@ export class Container extends Component {
152
142
  handleColorChange(type, color) {
153
143
  const cType = `${type}Color`;
154
144
  this.setState({
155
- [cType]: color
145
+ [cType]: color,
156
146
  });
157
147
  }
158
148
 
159
149
  render() {
160
- const {
161
- classes,
162
- disabled,
163
- imageUrl,
164
- imageDimensions,
165
- onSessionChange,
166
- session,
167
- backgroundImageEnabled
168
- } = this.props;
150
+ const { classes, disabled, imageUrl, imageDimensions, onSessionChange, session, backgroundImageEnabled } =
151
+ this.props;
169
152
  const {
170
153
  drawableDimensions,
171
154
  toolActive,
@@ -175,14 +158,14 @@ export class Container extends Component {
175
158
  outlineColorList,
176
159
  paintColor,
177
160
  paintColorList,
178
- TextEntry
161
+ TextEntry,
179
162
  } = this.state;
180
163
 
181
164
  const heightToUse = drawableDimensions.height * this.state.scale;
182
165
 
183
166
  return (
184
167
  <div className={classes.base}>
185
- {!disabled &&
168
+ {!disabled && (
186
169
  <DrawablePalette
187
170
  fillColor={fillColor}
188
171
  fillList={fillColorList}
@@ -190,17 +173,15 @@ export class Container extends Component {
190
173
  outlineList={outlineColorList}
191
174
  paintColor={paintColor}
192
175
  paintList={paintColorList}
193
- onFillColorChange={color => this.handleColorChange('fill', color)}
194
- onOutlineColorChange={color =>
195
- this.handleColorChange('outline', color)
196
- }
197
- onPaintColorChange={color => this.handleColorChange('paint', color)}
176
+ onFillColorChange={(color) => this.handleColorChange('fill', color)}
177
+ onOutlineColorChange={(color) => this.handleColorChange('outline', color)}
178
+ onPaintColorChange={(color) => this.handleColorChange('paint', color)}
198
179
  />
199
- }
180
+ )}
200
181
 
201
182
  <div className={classes.box}>
202
183
  <div className={classes.toolbar}>
203
- {TOOLS.map(tool => {
184
+ {TOOLS.map((tool) => {
204
185
  const { type, label, icon } = tool;
205
186
 
206
187
  return (
@@ -216,7 +197,7 @@ export class Container extends Component {
216
197
  </div>
217
198
 
218
199
  <div
219
- ref={drawable => {
200
+ ref={(drawable) => {
220
201
  this.drawable = drawable;
221
202
  }}
222
203
  className={classes.drawableHeight}
@@ -244,19 +225,19 @@ export class Container extends Component {
244
225
  }
245
226
  }
246
227
 
247
- const styles = theme => ({
228
+ const styles = (theme) => ({
248
229
  base: {
249
- marginTop: theme.spacing.unit * 2
230
+ marginTop: theme.spacing.unit * 2,
250
231
  },
251
232
  box: {
252
233
  border: '1px solid #E0E1E6',
253
234
  borderRadius: '5px',
254
235
  marginTop: theme.spacing.unit * 2,
255
- backgroundColor: '#ECEDF1'
236
+ backgroundColor: '#ECEDF1',
256
237
  },
257
238
  drawableHeight: {
258
239
  minHeight: 350,
259
- backgroundColor: '#fff'
240
+ backgroundColor: '#fff',
260
241
  },
261
242
  toolbar: {
262
243
  borderBottom: '1px solid #E0E1E6',
@@ -266,9 +247,9 @@ const styles = theme => ({
266
247
  boxSizing: 'border-box',
267
248
  maxWidth: 'calc(100% - 163px)', // 163px is the width set on undoControls
268
249
  '& button': {
269
- marginBottom: '8px'
270
- }
271
- }
250
+ marginBottom: '8px',
251
+ },
252
+ },
272
253
  });
273
254
 
274
255
  export default withStyles(styles)(Container);
@@ -22,18 +22,18 @@ const styles = () => ({
22
22
  image: {
23
23
  alignItems: 'center',
24
24
  display: 'flex',
25
- justifyContent: 'center'
25
+ justifyContent: 'center',
26
26
  },
27
27
  imageContainer: {
28
28
  position: 'relative',
29
- width: 'fit-content'
30
- }
29
+ width: 'fit-content',
30
+ },
31
31
  });
32
32
 
33
33
  DrawableImage.propTypes = {
34
34
  classes: PropTypes.object.isRequired,
35
35
  dimensions: PropTypes.object.isRequired,
36
- url:PropTypes.string.isRequired
36
+ url: PropTypes.string.isRequired,
37
37
  };
38
38
 
39
39
  export default withStyles(styles)(DrawableImage);
@@ -300,6 +300,7 @@ const styles = () => ({
300
300
  stage: {
301
301
  left: 0,
302
302
  position: 'absolute',
303
+ touchAction: 'none',
303
304
  top: 0
304
305
  },
305
306
  active: {
@@ -8,13 +8,9 @@ import classnames from 'classnames';
8
8
 
9
9
  // TODO: Change Palette so will render inputs and colors dynamically
10
10
  class Palette extends React.Component {
11
- onChange = name => event => {
11
+ onChange = (name) => (event) => {
12
12
  const { value } = event.target;
13
- const {
14
- onFillColorChange,
15
- onOutlineColorChange,
16
- onPaintColorChange
17
- } = this.props;
13
+ const { onFillColorChange, onOutlineColorChange, onPaintColorChange } = this.props;
18
14
 
19
15
  if (name === 'fill') {
20
16
  onFillColorChange(value);
@@ -26,29 +22,18 @@ class Palette extends React.Component {
26
22
  };
27
23
 
28
24
  render() {
29
- const {
30
- classes,
31
- fillColor,
32
- outlineColor,
33
- fillList,
34
- outlineList
35
- } = this.props;
25
+ const { classes, fillColor, outlineColor, fillList, outlineList } = this.props;
36
26
 
37
27
  return (
38
28
  <div className={classes.base}>
39
29
  <InputContainer label="Fill Color" className={classes.input}>
40
- <Select
41
- className={classes.select}
42
- onChange={this.onChange('fill')}
43
- value={fillColor}
44
- >
30
+ <Select className={classes.select} onChange={this.onChange('fill')} value={fillColor}>
45
31
  {fillList.map(({ value, label }) => (
46
32
  <MenuItem
47
33
  key={value}
48
34
  value={value}
49
35
  className={classnames(classes.item, {
50
- [classes.blackColorItem]:
51
- value === 'black'
36
+ [classes.blackColorItem]: value === 'black',
52
37
  })}
53
38
  style={{ backgroundColor: value }}
54
39
  >
@@ -59,18 +44,9 @@ class Palette extends React.Component {
59
44
  </InputContainer>
60
45
 
61
46
  <InputContainer label="Outline Color" className={classes.input}>
62
- <Select
63
- className={classes.select}
64
- onChange={this.onChange('outline')}
65
- value={outlineColor}
66
- >
47
+ <Select className={classes.select} onChange={this.onChange('outline')} value={outlineColor}>
67
48
  {outlineList.map(({ value, label }) => (
68
- <MenuItem
69
- key={value}
70
- value={value}
71
- className={classes.item}
72
- style={{ border: `2px solid ${value}` }}
73
- >
49
+ <MenuItem key={value} value={value} className={classes.item} style={{ border: `2px solid ${value}` }}>
74
50
  {label}
75
51
  </MenuItem>
76
52
  ))}
@@ -81,10 +57,10 @@ class Palette extends React.Component {
81
57
  }
82
58
  }
83
59
 
84
- const styles = theme => ({
60
+ const styles = (theme) => ({
85
61
  base: {
86
62
  marginTop: theme.spacing.unit * 2,
87
- display: 'flex'
63
+ display: 'flex',
88
64
  },
89
65
  input: {
90
66
  flex: 1,
@@ -97,15 +73,15 @@ const styles = theme => ({
97
73
  height: '22px',
98
74
  marginLeft: theme.spacing.unit * 2,
99
75
  marginRight: theme.spacing.unit * 2,
100
- marginTop: theme.spacing.unit * 2
76
+ marginTop: theme.spacing.unit * 2,
101
77
  },
102
78
  blackColorItem: {
103
- color:theme.palette.background.paper,
79
+ color: theme.palette.background.paper,
104
80
  },
105
81
  select: {
106
82
  fontSize: 'inherit',
107
83
  transform: 'translate(0%, 40%)',
108
- }
84
+ },
109
85
  });
110
86
 
111
87
  Palette.propTypes = {
@@ -116,7 +92,7 @@ Palette.propTypes = {
116
92
  onOutlineColorChange: PropTypes.func.isRequired,
117
93
  onPaintColorChange: PropTypes.func.isRequired,
118
94
  outlineColor: PropTypes.string.isRequired,
119
- outlineList: PropTypes.array.isRequired
95
+ outlineList: PropTypes.array.isRequired,
120
96
  };
121
97
 
122
98
  export default withStyles(styles)(Palette);
@@ -3,10 +3,7 @@ import { Text } from 'react-konva';
3
3
 
4
4
  import Transformer from './drawable-transformer';
5
5
 
6
- export const generateId = () =>
7
- Math.random()
8
- .toString(36)
9
- .substring(2) + new Date().getTime().toString(36);
6
+ export const generateId = () => Math.random().toString(36).substring(2) + new Date().getTime().toString(36);
10
7
 
11
8
  export default class TextDrawable {
12
9
  static getTextareaNode(id) {
@@ -26,10 +23,9 @@ export default class TextDrawable {
26
23
  this.eventListenersDetachArray = [];
27
24
  }
28
25
 
29
- removeEventListeners = () =>
30
- this.eventListenersDetachArray.forEach(fn => fn());
26
+ removeEventListeners = () => this.eventListenersDetachArray.forEach((fn) => fn());
31
27
 
32
- setAll = all => {
28
+ setAll = (all) => {
33
29
  this.all = all;
34
30
  this.props.forceUpdate();
35
31
  };
@@ -49,14 +45,14 @@ export default class TextDrawable {
49
45
  transformerVisible: true,
50
46
  textareaVisible: false,
51
47
  createdAt: new Date(),
52
- type: 'text-entry'
48
+ type: 'text-entry',
53
49
  });
54
50
 
55
51
  this.props.handleSessionChange();
56
52
  };
57
53
 
58
54
  showOnlyTextNodes() {
59
- this.all.map(item => {
55
+ this.all.map((item) => {
60
56
  item.textVisible = true;
61
57
  item.transformerVisible = false;
62
58
  item.textareaVisible = false;
@@ -64,13 +60,13 @@ export default class TextDrawable {
64
60
  }
65
61
 
66
62
  toggleTextarea(id, value) {
67
- this.all = this.all.map(item => {
63
+ this.all = this.all.map((item) => {
68
64
  if (item.id === id) {
69
65
  return {
70
66
  ...item,
71
67
  textVisible: !value,
72
68
  transformerVisible: !value,
73
- textareaVisible: value
69
+ textareaVisible: value,
74
70
  };
75
71
  }
76
72
  return item;
@@ -80,7 +76,7 @@ export default class TextDrawable {
80
76
 
81
77
  initializeDefault(id, isDefault) {
82
78
  if (isDefault) {
83
- const current = this.all.filter(item => item.id === id)[0];
79
+ const current = this.all.filter((item) => item.id === id)[0];
84
80
  current.isDefault = false;
85
81
  }
86
82
  }
@@ -89,7 +85,7 @@ export default class TextDrawable {
89
85
  if (textareaNode.value) {
90
86
  textNode.text(textareaNode.value);
91
87
  } else {
92
- this.all = this.all.filter(text => text.id !== id);
88
+ this.all = this.all.filter((text) => text.id !== id);
93
89
  this.props.forceUpdate();
94
90
  }
95
91
 
@@ -100,7 +96,7 @@ export default class TextDrawable {
100
96
  handleMouseUp = () => this.props.toggleTextSelected(false);
101
97
 
102
98
  handleClick = (e, id) => {
103
- const current = this.all.filter(item => item.id === id)[0];
99
+ const current = this.all.filter((item) => item.id === id)[0];
104
100
  current.transformerVisible = true;
105
101
  this.props.forceUpdate();
106
102
  };
@@ -119,8 +115,7 @@ export default class TextDrawable {
119
115
  textareaNode.style.top = areaPosition.y + 'px';
120
116
  textareaNode.style.left = areaPosition.x + 'px';
121
117
  textareaNode.style.width = textNode.width() - textNode.padding() * 2 + 'px';
122
- textareaNode.style.height =
123
- textNode.height() - textNode.padding() * 2 + 5 + 'px';
118
+ textareaNode.style.height = textNode.height() - textNode.padding() * 2 + 5 + 'px';
124
119
  textareaNode.style.fontSize = textNode.fontSize() + 'px';
125
120
  textareaNode.style.border = 'none';
126
121
  textareaNode.style.padding = '0px';
@@ -156,7 +151,7 @@ export default class TextDrawable {
156
151
 
157
152
  textareaNode.focus();
158
153
 
159
- const keyDownHandler = e => {
154
+ const keyDownHandler = (e) => {
160
155
  // hide on enter but don't hide on shift + enter
161
156
  if (e.keyCode === 13 && !e.shiftKey) {
162
157
  this.toggleTextarea(id, false);
@@ -171,9 +166,7 @@ export default class TextDrawable {
171
166
 
172
167
  textareaNode.addEventListener('keydown', keyDownHandler);
173
168
 
174
- this.eventListenersDetachArray.push(() =>
175
- textareaNode.removeEventListener('keydown', keyDownHandler)
176
- );
169
+ this.eventListenersDetachArray.push(() => textareaNode.removeEventListener('keydown', keyDownHandler));
177
170
 
178
171
  const blurHandler = () => {
179
172
  this.showOnlyTextNodes();
@@ -182,9 +175,7 @@ export default class TextDrawable {
182
175
 
183
176
  textareaNode.addEventListener('blur', blurHandler);
184
177
 
185
- this.eventListenersDetachArray.push(() =>
186
- textareaNode.removeEventListener('blur', blurHandler)
187
- );
178
+ this.eventListenersDetachArray.push(() => textareaNode.removeEventListener('blur', blurHandler));
188
179
 
189
180
  this.initializeDefault(id, isDefault);
190
181
  this.props.forceUpdate();
@@ -198,14 +189,14 @@ export default class TextDrawable {
198
189
  };
199
190
 
200
191
  renderTextareas() {
201
- return this.all.map(text => {
192
+ return this.all.map((text) => {
202
193
  const { id, textareaVisible } = text;
203
194
  const textareaNode = `textarea_${id}`;
204
195
 
205
196
  return (
206
197
  <textarea
207
198
  key={textareaNode}
208
- ref={textarea => {
199
+ ref={(textarea) => {
209
200
  this[textareaNode] = textarea;
210
201
  }}
211
202
  style={{ display: `${textareaVisible ? 'block' : 'none'}` }}
@@ -228,7 +219,7 @@ export default class TextDrawable {
228
219
 
229
220
  // setting the handler only once
230
221
  if (newStage !== this.stage) {
231
- const stageClickHandler = e => {
222
+ const stageClickHandler = (e) => {
232
223
  if (e.target !== this.stage) {
233
224
  return;
234
225
  }
@@ -239,25 +230,14 @@ export default class TextDrawable {
239
230
 
240
231
  newStage.on('click', stageClickHandler);
241
232
 
242
- this.eventListenersDetachArray.push(() =>
243
- newStage.off('click', stageClickHandler)
244
- );
233
+ this.eventListenersDetachArray.push(() => newStage.off('click', stageClickHandler));
245
234
  }
246
235
 
247
236
  this.stage = newStage;
248
237
  }
249
238
 
250
- return this.all.map(text => {
251
- const {
252
- id,
253
- label,
254
- x,
255
- y,
256
- width,
257
- textVisible,
258
- rotation,
259
- transformerVisible
260
- } = text;
239
+ return this.all.map((text) => {
240
+ const { id, label, x, y, width, textVisible, rotation, transformerVisible } = text;
261
241
 
262
242
  const textNode = `text_${id}`;
263
243
  const transformerNode = `transformer_${id}`;
@@ -265,11 +245,11 @@ export default class TextDrawable {
265
245
 
266
246
  if (!props.disabled) {
267
247
  extraProps = {
268
- onClick: e => this.handleClick(e, id),
269
- onTap: e => this.handleClick(e, id),
270
- onDblClick: e => this.handleDblClick(e, text),
271
- onDblTap: e => this.handleDblClick(e, text),
272
- onTransform: e => this.handleTransform(e, textNode),
248
+ onClick: (e) => this.handleClick(e, id),
249
+ onTap: (e) => this.handleClick(e, id),
250
+ onDblClick: (e) => this.handleDblClick(e, text),
251
+ onDblTap: (e) => this.handleDblClick(e, text),
252
+ onTransform: (e) => this.handleTransform(e, textNode),
273
253
  onTransformEnd: this.props.handleSessionChange,
274
254
  onMouseDown: this.handleMouseDown,
275
255
  onTouchStart: this.handleMouseDown,
@@ -278,7 +258,7 @@ export default class TextDrawable {
278
258
  onDragEnd: this.props.handleSessionChange,
279
259
  onMouseEnter: this.props.onMouseOverElement,
280
260
  onMouseLeave: this.props.onMouseOutElement,
281
- }
261
+ };
282
262
  }
283
263
 
284
264
  if (rotation) {
@@ -290,7 +270,7 @@ export default class TextDrawable {
290
270
  key={id}
291
271
  bubbles={true}
292
272
  id={id}
293
- ref={text => {
273
+ ref={(text) => {
294
274
  this[textNode] = text;
295
275
  }}
296
276
  text={text.text || label}
@@ -306,7 +286,7 @@ export default class TextDrawable {
306
286
  transformerVisible && (
307
287
  <Transformer
308
288
  key={`transformer_${id}`}
309
- ref={text => {
289
+ ref={(text) => {
310
290
  this[transformerNode] = text;
311
291
  }}
312
292
  selectedShapeName={textNode}
@@ -315,7 +295,7 @@ export default class TextDrawable {
315
295
  onMouseUp={this.handleMouseUp}
316
296
  onTouchEnd={this.handleMouseUp}
317
297
  />
318
- )
298
+ ),
319
299
  ];
320
300
  });
321
301
  }
@@ -35,7 +35,9 @@ class TransformerComponent extends React.Component {
35
35
  render() {
36
36
  return (
37
37
  <Transformer
38
- ref={node => { this.transformer = node; }}
38
+ ref={(node) => {
39
+ this.transformer = node;
40
+ }}
39
41
  enabledAnchors={['middle-left', 'middle-right']}
40
42
  {...this.props}
41
43
  />
@@ -4,22 +4,14 @@ import RectangleDrawable from './drawable-rectangle';
4
4
  import CircleDrawable from './drawable-circle';
5
5
  import EraserDrawable from './drawable-eraser';
6
6
 
7
- const DRAWABLES = [
8
- FreePathDrawable,
9
- LineDrawable,
10
- RectangleDrawable,
11
- CircleDrawable,
12
- EraserDrawable
13
- ];
7
+ const DRAWABLES = [FreePathDrawable, LineDrawable, RectangleDrawable, CircleDrawable, EraserDrawable];
14
8
 
15
9
  export default (type, props) => {
16
- const T = DRAWABLES.find(D => D.TYPE === type);
10
+ const T = DRAWABLES.find((D) => D.TYPE === type);
17
11
 
18
12
  if (T) {
19
13
  return new T(props);
20
14
  }
21
15
 
22
- throw new Error(
23
- `Can't find drawable for type: ${type} and props: ${JSON.stringify(props)}`
24
- );
16
+ throw new Error(`Can't find drawable for type: ${type} and props: ${JSON.stringify(props)}`);
25
17
  };