Skip to content

Commit df5b56c

Browse files
committed
minor changes in Canvas
1 parent 434d5b9 commit df5b56c

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

app/src/components/main/Canvas.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,24 @@ function Canvas(props): JSX.Element {
2929
let id = (parentId) ? parentId : null;
3030
if (child.typeId < 1000){
3131
masterArr.push({
32-
type: "HTML Element",
33-
typeId: child.typeId,
32+
type: "HTML Element",
33+
typeId: child.typeId,
3434
childId: id
3535
})
3636
if (child.children.length) {
3737
deepChildCopy(child.children, child.childId);
38-
}
38+
}
3939
}
4040
}
4141
}
4242
deepChildCopy(children, null);
4343
setCopiedChildrenArr(masterArr);
4444
}
45-
45+
4646
const components = state.components
4747

4848
// find the ID of the newly created component
49-
const newId = components[components.length -1]['id']
49+
const newId = components[components.length -1]['id']
5050
dispatch({
5151
type: 'ADD CHILD',
5252
payload: {
@@ -56,8 +56,8 @@ function Canvas(props): JSX.Element {
5656
}
5757
});
5858
}
59-
setNewComp(false)
60-
}, [newComp])
59+
setNewComp(false) // initially set to false
60+
}, [newComp])
6161

6262
// Caret start
6363
Arrow.deleteLines();
@@ -73,7 +73,7 @@ function Canvas(props): JSX.Element {
7373
// onClickHandler is responsible for changing the focused component and child component
7474
function onClickHandler(event) {
7575
event.stopPropagation();
76-
// note: a null value for the child id means that we are focusing on the top-level component rather than any child
76+
// note: a null value for the child id means that we are focusing on the top-level component rather than any child
7777
changeFocus(state.canvasFocus.componentId, null);
7878
};
7979

@@ -150,7 +150,7 @@ function Canvas(props): JSX.Element {
150150

151151
// able to duplicate a component in dev only does not work for prod
152152
// create a new component
153-
153+
154154
// let name = prompt("Component already has a parent. \nDo you want to create a new component and import its elements?", "Enter component name here");
155155
// while (components.some(comp => comp.name === name)) {
156156
// name = prompt(`${name} component already exists. \nPlease pick a new name.`);
@@ -160,20 +160,20 @@ function Canvas(props): JSX.Element {
160160
// type: 'ADD COMPONENT',
161161
// payload: { componentName: name, root: false }
162162
// });
163-
163+
164164
// setNewComp(true);
165165
// setNewComp(!newComp)
166166
// }
167-
167+
168168
}
169-
169+
170170
}
171171
},
172172
collect: monitor => ({
173173
isOver: !!monitor.isOver()
174174
})
175175
});
176-
176+
177177
// Styling for Canvas
178178
const defaultCanvasStyle = {
179179
width: '100%',
@@ -198,7 +198,7 @@ function Canvas(props): JSX.Element {
198198
// Combine the default styles of the canvas with the custom styles set by the user for that component
199199
// The render children function renders all direct children of a given component
200200
// Direct children are draggable/clickable
201-
201+
202202
// const canvasStyle = combineStyles(defaultCanvasStyle, currentComponent.style);
203203
const canvasStyle = combineStyles(defaultCanvasStyle, currentComponent.style);
204204
const darkCombinedCanvasStyle = combineStyles(darkCanvasStyle, currentComponent.style);

0 commit comments

Comments
 (0)