Skip to content

Commit 66f5e09

Browse files
Tolga MizrakciTolga Mizrakci
authored andcommitted
commit before pulling dragging changes from christian
1 parent 712cb31 commit 66f5e09

File tree

2 files changed

+86
-100
lines changed

2 files changed

+86
-100
lines changed

src/components/KonvaStage.jsx

Lines changed: 26 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
import React, { Component, createRef } from 'react';
1+
import React, { Component, createRef } from "react";
22
// 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";
86

97
class KonvaStage extends Component {
108
state = {
119
x: undefined,
12-
y: undefined,
10+
y: undefined
1311
};
1412

1513
constructor(props) {
@@ -18,7 +16,7 @@ class KonvaStage extends Component {
1816
this.group = createRef();
1917
}
2018

21-
handleStageMouseDown = (e) => {
19+
handleStageMouseDown = e => {
2220
// // clicked on stage - cler selection
2321
// if (e.target === e.target.getStage()) {
2422
// this.props.openExpansionPanel({});
@@ -66,13 +64,13 @@ class KonvaStage extends Component {
6664
scaleX,
6765
scaleY,
6866
focusComponent,
69-
focusChild,
67+
focusChild
7068
} = this.props;
7169
const { selectedShapeName } = this.state;
7270

7371
return (
7472
<Stage
75-
ref={(node) => {
73+
ref={node => {
7674
this.stage = node;
7775
}}
7876
onMouseDown={this.handleStageMouseDown}
@@ -83,41 +81,28 @@ class KonvaStage extends Component {
8381
<Group
8482
scaleX={scaleX}
8583
scaleY={scaleY}
86-
ref={(node) => {
84+
ref={node => {
8785
this.group = node;
8886
}}
8987
draggable={draggable}
9088
>
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+
))}
121106
<TransformerComponent
122107
focusComponent={focusComponent}
123108
focusChild={focusChild}

0 commit comments

Comments
 (0)