use for..of instead of forEach
This commit is contained in:
@@ -90,14 +90,14 @@ function ResizeControl({
|
||||
changes.push(dimensionChange);
|
||||
}
|
||||
|
||||
childChanges.forEach((childChange) => {
|
||||
for (const childChange of childChanges) {
|
||||
const positionChange: NodePositionChange = {
|
||||
...childChange,
|
||||
type: 'position',
|
||||
};
|
||||
|
||||
changes.push(positionChange);
|
||||
});
|
||||
}
|
||||
|
||||
triggerNodeChanges(changes);
|
||||
},
|
||||
|
||||
@@ -77,12 +77,12 @@
|
||||
? { x: change.x, y: change.y }
|
||||
: node.position;
|
||||
|
||||
childChanges.forEach((childChange) => {
|
||||
for (const childChange of childChanges) {
|
||||
const childNode = $nodeLookup.get(childChange.id);
|
||||
if (childNode) {
|
||||
childNode.position = childChange.position;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$nodes = $nodes;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ export function XYResizer({ domNode, nodeId, getStoreItems, onChange }: XYResize
|
||||
// Determine largest minimal extent the parent node is allowed to resize to
|
||||
childNodes = [];
|
||||
childExtent = undefined;
|
||||
nodeLookup.forEach((child, childId) => {
|
||||
for (const [childId, child] of nodeLookup) {
|
||||
if (child.parentNode === nodeId) {
|
||||
childNodes.push({
|
||||
id: childId,
|
||||
@@ -163,7 +163,7 @@ export function XYResizer({ domNode, nodeId, getStoreItems, onChange }: XYResize
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onResizeStart?.(event, { ...prevValues });
|
||||
}
|
||||
@@ -222,13 +222,13 @@ export function XYResizer({ domNode, nodeId, getStoreItems, onChange }: XYResize
|
||||
if (childNodes.length > 0) {
|
||||
const xChange = x - prevX;
|
||||
const yChange = y - prevY;
|
||||
childNodes.forEach((childNode) => {
|
||||
for (const childNode of childNodes) {
|
||||
childNode.position = {
|
||||
x: childNode.position.x - xChange,
|
||||
y: childNode.position.y - yChange,
|
||||
};
|
||||
childChanges.push(childNode);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user