ljmotta commented on code in PR #2254:
URL:
https://github.com/apache/incubator-kie-tools/pull/2254#discussion_r1576111003
##########
packages/dmn-editor/src/propertiesPanel/ShapeOptions.tsx:
##########
@@ -105,17 +110,36 @@ export function ShapeOptions({
const onChangeWidth = useCallback(
(newWidth: string) => {
- setBounds((bounds) => {
- bounds["@_width"] = +parseFloat(newWidth).toFixed(2);
+ setBounds((bounds, state) => {
+ const node =
state.computed(state).getDiagramData(externalModelsByNamespace).nodesById.get(nodeIds[0]);
+ const minNodeSize = MIN_NODE_SIZES[node?.type as NodeType]({
+ snapGrid: state.diagram.snapGrid,
+ isAlternativeInputDataShape:
state.computed(state).isAlternativeInputDataShape(),
+ });
+
+ if (parseFloat(newWidth) < minNodeSize["@_width"]) {
+ bounds["@_width"] = minNodeSize["@_width"];
+ } else {
+ bounds["@_width"] = +parseFloat(newWidth).toFixed(2);
+ }
});
},
[setBounds]
);
const onChangeHeight = useCallback(
(newHeight: string) => {
- setBounds((bounds) => {
- bounds["@_height"] = +parseFloat(newHeight).toFixed(2);
+ setBounds((bounds, state) => {
+ const node =
state.computed(state).getDiagramData(externalModelsByNamespace).nodesById.get(nodeIds[0]);
+ const minNodeSize = MIN_NODE_SIZES[node?.type as NodeType]({
+ snapGrid: state.diagram.snapGrid,
+ isAlternativeInputDataShape:
state.computed(state).isAlternativeInputDataShape(),
+ });
+ if (parseFloat(newHeight) < minNodeSize["@_height"]) {
+ bounds["@_height"] = minNodeSize["@_height"];
+ } else {
+ bounds["@_height"] = +parseFloat(newHeight).toFixed(2);
+ }
});
},
[setBounds]
Review Comment:
Missing dependencies
##########
packages/dmn-editor/src/propertiesPanel/ShapeOptions.tsx:
##########
@@ -105,17 +110,36 @@ export function ShapeOptions({
const onChangeWidth = useCallback(
(newWidth: string) => {
- setBounds((bounds) => {
- bounds["@_width"] = +parseFloat(newWidth).toFixed(2);
+ setBounds((bounds, state) => {
+ const node =
state.computed(state).getDiagramData(externalModelsByNamespace).nodesById.get(nodeIds[0]);
+ const minNodeSize = MIN_NODE_SIZES[node?.type as NodeType]({
+ snapGrid: state.diagram.snapGrid,
+ isAlternativeInputDataShape:
state.computed(state).isAlternativeInputDataShape(),
+ });
+
+ if (parseFloat(newWidth) < minNodeSize["@_width"]) {
+ bounds["@_width"] = minNodeSize["@_width"];
+ } else {
+ bounds["@_width"] = +parseFloat(newWidth).toFixed(2);
+ }
});
},
[setBounds]
Review Comment:
Missing dependencies
##########
packages/dmn-editor/src/propertiesPanel/ShapeOptions.tsx:
##########
@@ -250,6 +274,17 @@ export function ShapeOptions({
shape!["di:Style"]!["dmndi:StrokeColor"]["@_red"] =
DEFAULT_STROKE_COLOR["@_red"];
shape!["di:Style"]!["dmndi:StrokeColor"]["@_green"] =
DEFAULT_STROKE_COLOR["@_green"];
shape!["di:Style"]!["dmndi:StrokeColor"]["@_blue"] =
DEFAULT_STROKE_COLOR["@_blue"];
+
+ for (const node of
state.computed(state).getDiagramData(externalModelsByNamespace).nodesById.values())
{
+ if (node.data.shape["@_id"] === shape["@_id"]) {
+ const minNodeSize = MIN_NODE_SIZES[node?.type as NodeType]({
+ snapGrid: state.diagram.snapGrid,
+ isAlternativeInputDataShape:
state.computed(state).isAlternativeInputDataShape(),
+ });
+ shape["dc:Bounds"]!["@_width"] = minNodeSize["@_width"];
+ shape["dc:Bounds"]!["@_height"] = minNodeSize["@_height"];
+ }
+ }
});
});
}, [setShapeStyles]);
Review Comment:
Missing dependencies
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]