1
- import React , { Component , createRef } from ' react' ;
1
+ import React , { Component , createRef } from " react" ;
2
2
// import PropTypes from 'prop-types';
3
- import {
4
- Stage , Layer , Image , Group ,
5
- } from 'react-konva' ;
6
- import TransformerComponent from './TransformerComponent.jsx' ;
7
- import Rectangle from './Rectangle.jsx' ;
3
+ import { Stage , Layer , Image , Group } from "react-konva" ;
4
+ import TransformerComponent from "./TransformerComponent.jsx" ;
5
+ import Rectangle from "./Rectangle.jsx" ;
8
6
9
7
class KonvaStage extends Component {
10
8
state = {
11
9
x : undefined ,
12
- y : undefined ,
10
+ y : undefined
13
11
} ;
14
12
15
13
constructor ( props ) {
@@ -18,7 +16,7 @@ class KonvaStage extends Component {
18
16
this . group = createRef ( ) ;
19
17
}
20
18
21
- handleStageMouseDown = ( e ) => {
19
+ handleStageMouseDown = e => {
22
20
// // clicked on stage - cler selection
23
21
// if (e.target === e.target.getStage()) {
24
22
// this.props.openExpansionPanel({});
@@ -66,13 +64,13 @@ class KonvaStage extends Component {
66
64
scaleX,
67
65
scaleY,
68
66
focusComponent,
69
- focusChild,
67
+ focusChild
70
68
} = this . props ;
71
69
const { selectedShapeName } = this . state ;
72
70
73
71
return (
74
72
< Stage
75
- ref = { ( node ) => {
73
+ ref = { node => {
76
74
this . stage = node ;
77
75
} }
78
76
onMouseDown = { this . handleStageMouseDown }
@@ -83,41 +81,28 @@ class KonvaStage extends Component {
83
81
< Group
84
82
scaleX = { scaleX }
85
83
scaleY = { scaleY }
86
- ref = { ( node ) => {
84
+ ref = { node => {
87
85
this . group = node ;
88
86
} }
89
87
draggable = { draggable }
90
88
>
91
- { /* {components.map((comp, i) => (
92
- <Rectangle
93
- draggable={comp.draggable}
94
- selectedShapeName={selectedShapeName}
95
- key={i}
96
- componentId={comp.id}
97
- x={comp.position.x}
98
- y={comp.position.y}
99
- width={comp.position.width}
100
- height={comp.position.height}
101
- title={comp.title}
102
- color={comp.color}
103
- handleTransform={handleTransform}
104
- />
105
- ))} */ }
106
- { components . find ( ( comp ) => comp . title === focusComponent . title )
107
- . childrenArray . map ( ( child , i ) => < Rectangle
108
- draggable = { child . draggable }
109
- selectedShapeName = { selectedShapeName }
110
- key = { i + child . componentName }
111
- componentId = { child . id }
112
- x = { child . position . x }
113
- y = { child . position . y }
114
- width = { child . position . width }
115
- height = { child . position . height }
116
- title = { child . childId + child . componentName }
117
- color = { 'red' }
118
- handleTransform = { handleTransform }
119
- /> ) }
120
- { /* )} */ }
89
+ { components
90
+ . find ( comp => comp . title === focusComponent . title )
91
+ . childrenArray . map ( ( child , i ) => (
92
+ < Rectangle
93
+ draggable = { child . draggable }
94
+ selectedShapeName = { selectedShapeName }
95
+ key = { i + child . componentName }
96
+ componentId = { child . id }
97
+ x = { child . position . x }
98
+ y = { child . position . y }
99
+ width = { child . position . width }
100
+ height = { child . position . height }
101
+ title = { child . childId + child . componentName }
102
+ color = { "red" }
103
+ handleTransform = { handleTransform }
104
+ />
105
+ ) ) }
121
106
< TransformerComponent
122
107
focusComponent = { focusComponent }
123
108
focusChild = { focusChild }
0 commit comments