From c86409f02a23f3203ac60f0a11edd9fb4f00b846 Mon Sep 17 00:00:00 2001 From: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com> Date: Tue, 29 Jul 2025 19:44:32 +0200 Subject: [PATCH 1/4] refactor: fix most problems in the Wires story The labels are now at the right position. Restore the original background specific to this story (dot instead of grid) The terminal points of the R1 shape displays when hovering a edge in construction. Let switch to a dark theme by using the Storybook controls. Add a documentation page taking the technical explanations from the mxGraph example and that was previously hidden. Also display a description at the top of the Graph to help understand what the story is doing. Also migrate it to TypeScript. This facilitates maintenance and enables errors to be detected earlier. Some refactoring - no longer override PanningHandler.isPopupTrigger as it does not exist (same in mxGraph). This is a method of InternalEvent - add nullish checks and simplify conditions --- packages/html/stories/Wires.mdx | 2 +- packages/html/stories/Wires.stories.js | 955 ---------------------- packages/html/stories/Wires.stories.ts | 1019 ++++++++++++++++++++++++ 3 files changed, 1020 insertions(+), 956 deletions(-) delete mode 100644 packages/html/stories/Wires.stories.js create mode 100644 packages/html/stories/Wires.stories.ts diff --git a/packages/html/stories/Wires.mdx b/packages/html/stories/Wires.mdx index f186a73aa2..da281ed49a 100644 --- a/packages/html/stories/Wires.mdx +++ b/packages/html/stories/Wires.mdx @@ -17,7 +17,7 @@ and the connection point between the two edges in `GraphView.updateFixedTerminal The orthogonal router, which is implemented as an edge style, computes its result based on the output of `GraphView.updateFixedTerminalPoint`, which computes all connection points for edge-to-edge connections -and constrained ports and vertices and stores them in state.absolutePoints. +and constrained ports and vertices and stores them in `State.absolutePoints`. ## Routing directions diff --git a/packages/html/stories/Wires.stories.js b/packages/html/stories/Wires.stories.js deleted file mode 100644 index b272d22fdd..0000000000 --- a/packages/html/stories/Wires.stories.js +++ /dev/null @@ -1,955 +0,0 @@ -/* -Copyright 2021-present The maxGraph project Contributors -Copyright (c) 2006-2020, JGraph Ltd - -Licensed 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 { - domUtils, - styleUtils, - mathUtils, - cloneUtils, - eventUtils, - Graph, - InternalEvent, - RubberBandHandler, - ConnectionHandler, - ConnectionConstraint, - Point, - CylinderShape, - DomHelpers, - Rectangle, - EdgeHandler, - EdgeStyleRegistry, - EdgeSegmentHandler, - UndoManager, - CellEditorHandler, - ConstraintHandler, - Guide, - ImageBox, - GraphView, - SelectionHandler, - PanningHandler, - TooltipHandler, - SelectionCellsHandler, - PopupMenuHandler, - cellArrayUtils, - StyleDefaultsConfig, - ShapeRegistry, -} from '@maxgraph/core'; - -import { - contextMenuTypes, - contextMenuValues, - globalTypes, - globalValues, - rubberBandTypes, - rubberBandValues, -} from './shared/args.js'; -import { createGraphContainer } from './shared/configure.js'; -import '@maxgraph/core/css/common.css'; // style required by RubberBand - -export default { - title: 'Connections/Wires', - argTypes: { - ...contextMenuTypes, - ...globalTypes, - ...rubberBandTypes, - }, - args: { - ...contextMenuValues, - ...globalValues, - ...rubberBandValues, - }, -}; - -// TODO apply this settings to the container used by the Graph -const HTML_TEMPLATE = ` -
-