jomarko commented on code in PR #2130: URL: https://github.com/apache/incubator-kie-tools/pull/2130#discussion_r1472517283
########## packages/dmn-editor/src/autolayout/AutolayoutButton.tsx: ########## @@ -0,0 +1,561 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { generateUuid } from "@kie-tools/boxed-expression-component/dist/api"; +import { DC__Bounds } from "@kie-tools/dmn-marshaller/dist/schemas/dmn-1_5/ts-gen/types"; +import OptimizeIcon from "@patternfly/react-icons/dist/js/icons/optimize-icon"; +import ELK, * as Elk from "elkjs/lib/elk.bundled.js"; +import * as React from "react"; +import { PositionalNodeHandleId } from "../diagram/connections/PositionalNodeHandles"; +import { EdgeType, NodeType } from "../diagram/connections/graphStructure"; +import { getAdjMatrix, traverse } from "../diagram/graph/graph"; +import { getContainmentRelationship } from "../diagram/maths/DmnMaths"; +import { DEFAULT_NODE_SIZES, MIN_NODE_SIZES } from "../diagram/nodes/DefaultSizes"; +import { NODE_TYPES } from "../diagram/nodes/NodeTypes"; +import { useExternalModels } from "../includedModels/DmnEditorDependenciesContext"; +import { addEdge } from "../mutations/addEdge"; +import { repositionNode } from "../mutations/repositionNode"; +import { resizeNode } from "../mutations/resizeNode"; +import { updateDecisionServiceDividerLine } from "../mutations/updateDecisionServiceDividerLine"; +import { useDmnEditorStoreApi } from "../store/StoreContext"; + +const elk = new ELK(); + +export const ELK_OPTIONS = { + "elk.algorithm": "layered", + "elk.direction": "UP", + // By making width a lot bigger than height, we make sure disjoint graph components are placed horizontally, never vertically + "elk.aspectRatio": "9999999999", + // spacing + "elk.spacing.nodeNode": "60", + "elk.spacing.componentComponent": "200", + "layered.spacing.edgeEdgeBetweenLayers": "0", + "layered.spacing.edgeNodeBetweenLayers": "0", + "layered.spacing.nodeNodeBetweenLayers": "100", + // edges + "elk.edgeRouting": "ORTHOGONAL", + "elk.layered.mergeEdges": "true", // we need this to make sure space is consistent between layers. + "elk.layered.mergeHierarchyEdges": "true", + // positioning + "elk.partitioning.activate": "true", + "elk.nodePlacement.favorStraightEdges": "true", + "elk.nodePlacement.bk.fixedAlignment": "LEFTDOWN", + "elk.nodePlacement.bk.edgeStraightening": "IMPROVE_STRAIGHTNESS", + // + "considerModelOrder.strategy": "PREFER_NODES", + "crossingMinimization.forceNodeModelOrder": "true", + "layering.strategy": "LONGEST_PATH_SOURCE", +}; Review Comment: it is minor comment, however for readability and clarity I think we could unify naming of elk options to all start as `elk.` what do you think? I think it would make easier to understand if all options are some elk option or some are custom introduced by ourselves. I think similar change would be applicable also on the line 152 -- 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]
