Skip to content

Commit ff1511c

Browse files
final canvas version
1 parent 0db331d commit ff1511c

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

src/components/DataTable.jsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ function dataTable(props) {
3030
classes, rowData, rowHeader, deletePropHandler,
3131
} = props;
3232

33-
// console.log(classes)
34-
// console.log('rowHeader');
35-
// console.log(rowHeader);
36-
// console.log('rowData');
37-
// console.log(rowData);
38-
3933
const renderHeader = rowHeader.map((col, idx) => (
4034
<TableCell key={`head_+${idx}`}>{col}</TableCell>
4135
));

src/components/GrandchildRectangle.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Rect, Group } from 'react-konva';
33

44
class GrandchildRectangle extends Component {
55
getComponentColor(componentId) {
6-
console.log(componentId);
76
const color = this.props.components.find(comp => comp.id == componentId).color;
87
return color;
98
}

src/components/KonvaStage.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ class KonvaStage extends Component {
4646
draggable: true,
4747
color: component.color,
4848
};
49+
// console.log('getDirectChildrenCopy, pseudoChild.position: ', pseudoChild.position);
4950
childrenArrCopy = childrenArrCopy.concat(pseudoChild);
50-
console.log('arr copy: ', childrenArrCopy);
5151
return childrenArrCopy;
5252
}
5353

src/components/Rectangle.jsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,24 @@ class Rectangle extends Component {
1919
}
2020

2121
handleResize(componentId, childId, target, blockSnapSize) {
22-
const focChild = this.props.focusChild;
23-
// const focChild = this.props.components.find(comp => comp.id === componentId).focusChild;
24-
// .childrenArray.find(child => child.childId === childId);
22+
// focusChild is not being reliably updated (similar problem with focusComponent sometimes)
23+
// so, grab the position of the focusChild manually from the children array
24+
let focChild = this.props.components
25+
.find(comp => comp.id === this.props.componentId)
26+
.childrenArray.find(child => child.childId === childId);
2527

28+
if (childId == '-1') {
29+
focChild = this.props.components.find(comp => comp.id === this.props.componentId);
30+
}
2631
const transformation = {
2732
width: Math.round((target.width() * target.scaleX()) / blockSnapSize) * blockSnapSize,
2833
height: Math.round((target.height() * target.scaleY()) / blockSnapSize) * blockSnapSize,
2934
x: target.x() + focChild.position.x,
3035
y: target.y() + focChild.position.y,
3136
};
3237

38+
console.log(transformation);
39+
3340
this.props.handleTransform(componentId, childId, transformation);
3441
}
3542

src/utils/componentReducer.util.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ export const handleTransform = (state, {
278278
}),
279279
transformedComponent,
280280
];
281-
console.log('trans pos: ', transformedComponent.position);
281+
// console.log('trans pos: ', transformedComponent.position);
282282
return { ...state, components };
283283
}
284284

@@ -423,6 +423,7 @@ export const changeFocusComponent = (state, { title = state.focusComponent.title
423423
export const changeFocusChild = (state, { title, childId }) => {
424424
// just finds first child with given title, need to pass in specific childId somehow
425425
// maybe default to title if childId is unknown
426+
console.log('change foc comp reducer: childId: ', childId);
426427
const focComp = state.components.find(comp => comp.title === state.focusComponent.title);
427428
let newFocusChild = focComp.childrenArray.find(child => child.childId === childId);
428429

0 commit comments

Comments
 (0)