diff --git a/packages/core/src/editor/Editor.ts b/packages/core/src/editor/Editor.ts index 4be1f2ec0b..ea860ea77e 100644 --- a/packages/core/src/editor/Editor.ts +++ b/packages/core/src/editor/Editor.ts @@ -47,14 +47,14 @@ import MaxLog from '../gui/MaxLog'; import { isNode } from '../util/domUtils'; import { getViewXml, getXml } from '../util/xmlUtils'; import { load, post, submit } from '../util/MaxXmlRequest'; -import PopupMenuHandler from '../view/handler/PopupMenuHandler'; -import RubberBandHandler from '../view/handler/RubberBandHandler'; +import type PopupMenuHandler from '../view/plugins/PopupMenuHandler'; +import RubberBandHandler from '../view/plugins/RubberBandHandler'; import InternalEvent from '../view/event/InternalEvent'; import InternalMouseEvent from '../view/event/InternalMouseEvent'; import { CellStateStyle, MouseListenerSet } from '../types'; -import ConnectionHandler from '../view/handler/ConnectionHandler'; +import type ConnectionHandler from '../view/plugins/ConnectionHandler'; import { show } from '../util/printUtils'; -import PanningHandler from '../view/handler/PanningHandler'; +import type PanningHandler from '../view/plugins/PanningHandler'; import { cloneCell } from '../util/cellArrayUtils'; import { TranslationsConfig } from '../i18n/config'; import type MaxPopupMenu from '../gui/MaxPopupMenu'; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index acfcadb3b2..6b5925dfcd 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -48,19 +48,12 @@ export { Editor } from './editor/Editor'; export { default as CellHighlight } from './view/cell/CellHighlight'; export { default as CellMarker } from './view/cell/CellMarker'; export { default as CellTracker } from './view/cell/CellTracker'; -export { default as ConnectionHandler } from './view/handler/ConnectionHandler'; export { default as ConstraintHandler } from './view/handler/ConstraintHandler'; export { default as EdgeHandler } from './view/handler/EdgeHandler'; export { default as EdgeSegmentHandler } from './view/handler/EdgeSegmentHandler'; export { default as ElbowEdgeHandler } from './view/handler/ElbowEdgeHandler'; -export { default as SelectionHandler } from './view/handler/SelectionHandler'; export { default as VertexHandle } from './view/cell/VertexHandle'; export { default as KeyHandler } from './view/handler/KeyHandler'; -export { default as PanningHandler } from './view/handler/PanningHandler'; -export { default as PopupMenuHandler } from './view/handler/PopupMenuHandler'; -export { default as RubberBandHandler } from './view/handler/RubberBandHandler'; -export { default as SelectionCellsHandler } from './view/handler/SelectionCellsHandler'; -export { default as TooltipHandler } from './view/handler/TooltipHandler'; export { default as VertexHandler } from './view/handler/VertexHandler'; export * from './view/handler/config'; @@ -201,7 +194,6 @@ export { default as UndoableEdit } from './view/undoable_changes/UndoableEdit'; export { default as UndoManager } from './view/undoable_changes/UndoManager'; export { Cell } from './view/cell/Cell'; -export { default as CellEditorHandler } from './view/handler/CellEditorHandler'; export { default as CellOverlay } from './view/cell/CellOverlay'; export { default as CellPath } from './view/cell/CellPath'; export { default as CellRenderer } from './view/cell/CellRenderer'; diff --git a/packages/core/src/view/Graph.ts b/packages/core/src/view/Graph.ts index 03c0ee114c..04b85da7b5 100644 --- a/packages/core/src/view/Graph.ts +++ b/packages/core/src/view/Graph.ts @@ -22,7 +22,7 @@ import EventSource from './event/EventSource'; import InternalEvent from './event/InternalEvent'; import Rectangle from './geometry/Rectangle'; import Client from '../Client'; -import type PanningHandler from './handler/PanningHandler'; +import type PanningHandler from './plugins/PanningHandler'; import GraphView from './GraphView'; import CellRenderer from './cell/CellRenderer'; import Point from './geometry/Point'; diff --git a/packages/core/src/view/GraphView.ts b/packages/core/src/view/GraphView.ts index 7983ac9874..99043d75df 100644 --- a/packages/core/src/view/GraphView.ts +++ b/packages/core/src/view/GraphView.ts @@ -38,12 +38,12 @@ import CurrentRootChange from './undoable_changes/CurrentRootChange'; import Shape from './geometry/Shape'; import Geometry from './geometry/Geometry'; import ConnectionConstraint from './other/ConnectionConstraint'; -import PopupMenuHandler from './handler/PopupMenuHandler'; +import type PopupMenuHandler from './plugins/PopupMenuHandler'; import { getClientX, getClientY, getSource, isConsumed } from '../util/EventUtils'; import { clone } from '../util/cloneUtils'; import type { Graph } from './Graph'; import StyleRegistry from './style/StyleRegistry'; -import type TooltipHandler from './handler/TooltipHandler'; +import type TooltipHandler from './plugins/TooltipHandler'; import type { EdgeStyleFunction, MouseEventListener } from '../types'; import { TranslationsConfig } from '../i18n/config'; diff --git a/packages/core/src/view/cell/CellRenderer.ts b/packages/core/src/view/cell/CellRenderer.ts index e0c1e425b3..c0477c239d 100644 --- a/packages/core/src/view/cell/CellRenderer.ts +++ b/packages/core/src/view/cell/CellRenderer.ts @@ -47,7 +47,7 @@ import CellOverlay from './CellOverlay'; import { getClientX, getClientY, getSource } from '../../util/EventUtils'; import { isNode } from '../../util/domUtils'; import { CellStateStyle } from '../../types'; -import SelectionCellsHandler from '../handler/SelectionCellsHandler'; +import type SelectionCellsHandler from '../plugins/SelectionCellsHandler'; const placeholderStyleValues = ['inherit', 'swimlane', 'indicated']; const placeholderStyleProperties: (keyof CellStateStyle)[] = [ @@ -1380,6 +1380,9 @@ class CellRenderer { state.shape = null; } + const selectionCellsHandler = graph.getPlugin( + 'SelectionCellsHandler' + ); if ( state.shape == null && graph.container != null && @@ -1398,9 +1401,6 @@ class CellRenderer { this.installListeners(state); // Forces a refresh of the handler if one exists - const selectionCellsHandler = graph.getPlugin( - 'SelectionCellsHandler' - ); selectionCellsHandler?.updateHandler(state); } } else if ( @@ -1412,9 +1412,6 @@ class CellRenderer { state.shape.resetStyles(); this.configureShape(state); // LATER: Ignore update for realtime to fix reset of current gesture - const selectionCellsHandler = graph.getPlugin( - 'SelectionCellsHandler' - ); selectionCellsHandler?.updateHandler(state); force = true; } diff --git a/packages/core/src/view/handler/EdgeHandler.ts b/packages/core/src/view/handler/EdgeHandler.ts index 2d2f8b8ea9..0eab6cabcf 100644 --- a/packages/core/src/view/handler/EdgeHandler.ts +++ b/packages/core/src/view/handler/EdgeHandler.ts @@ -61,7 +61,7 @@ import InternalMouseEvent from '../event/InternalMouseEvent'; import Cell from '../cell/Cell'; import ImageBox from '../image/ImageBox'; import EventSource from '../event/EventSource'; -import SelectionHandler from './SelectionHandler'; +import type SelectionHandler from '../plugins/SelectionHandler'; import { equalPoints } from '../../util/arrayUtils'; import { EdgeHandlerConfig, HandleConfig } from './config'; diff --git a/packages/core/src/view/handler/KeyHandler.ts b/packages/core/src/view/handler/KeyHandler.ts index 64d722a018..a5ea97e3dd 100644 --- a/packages/core/src/view/handler/KeyHandler.ts +++ b/packages/core/src/view/handler/KeyHandler.ts @@ -26,7 +26,7 @@ import { isControlDown as _isControlDown, isShiftDown, } from '../../util/EventUtils'; -import CellEditorHandler from './CellEditorHandler'; +import type CellEditorHandler from '../plugins/CellEditorHandler'; /** * Event handler that listens to keystroke events. This is not a singleton, diff --git a/packages/core/src/view/handler/VertexHandler.ts b/packages/core/src/view/handler/VertexHandler.ts index 2b1e8a6806..94ba729daf 100644 --- a/packages/core/src/view/handler/VertexHandler.ts +++ b/packages/core/src/view/handler/VertexHandler.ts @@ -35,8 +35,8 @@ import Shape from '../geometry/Shape'; import InternalMouseEvent from '../event/InternalMouseEvent'; import EdgeHandler from './EdgeHandler'; import EventSource from '../event/EventSource'; -import SelectionHandler from './SelectionHandler'; -import SelectionCellsHandler from './SelectionCellsHandler'; +import type SelectionHandler from '../plugins/SelectionHandler'; +import type SelectionCellsHandler from '../plugins/SelectionCellsHandler'; import { HandleConfig, VertexHandlerConfig } from './config'; /** @@ -235,8 +235,7 @@ class VertexHandler { this.selectionBorder.setCursor(CURSOR.MOVABLE_VERTEX); } - const selectionHandler = this.graph.getPlugin('SelectionHandler'); - + const selectionHandler = this.getSelectionHandler(); // Adds the sizer handles if ( selectionHandler && @@ -337,11 +336,15 @@ class VertexHandler { (this.state.view.graph).addListener(InternalEvent.ESCAPE, this.escapeHandler); } + private getSelectionHandler(): SelectionHandler | undefined { + return this.graph.getPlugin('SelectionHandler'); + } + /** * Returns `true` if the rotation handle should be showing. */ isRotationHandleVisible() { - const selectionHandler = this.graph.getPlugin('SelectionHandler'); + const selectionHandler = this.getSelectionHandler(); const selectionHandlerCheck = selectionHandler ? selectionHandler.maxCells <= 0 || this.graph.getSelectionCount() < selectionHandler.maxCells diff --git a/packages/core/src/view/mixins/ConnectionsMixin.ts b/packages/core/src/view/mixins/ConnectionsMixin.ts index e04f061fe8..ae51139a24 100644 --- a/packages/core/src/view/mixins/ConnectionsMixin.ts +++ b/packages/core/src/view/mixins/ConnectionsMixin.ts @@ -23,7 +23,7 @@ import EventObject from '../event/EventObject'; import InternalEvent from '../event/InternalEvent'; import Dictionary from '../../util/Dictionary'; import type { Graph } from '../Graph'; -import type ConnectionHandler from '../handler/ConnectionHandler'; +import type ConnectionHandler from '../plugins/ConnectionHandler'; type PartialGraph = Pick; type PartialConnections = Pick< diff --git a/packages/core/src/view/mixins/EditingMixin.ts b/packages/core/src/view/mixins/EditingMixin.ts index 28f5d5d154..9e4772f196 100644 --- a/packages/core/src/view/mixins/EditingMixin.ts +++ b/packages/core/src/view/mixins/EditingMixin.ts @@ -18,7 +18,7 @@ import { isMultiTouchEvent } from '../../util/EventUtils'; import EventObject from '../event/EventObject'; import InternalEvent from '../event/InternalEvent'; import type { Graph } from '../Graph'; -import type CellEditorHandler from '../handler/CellEditorHandler'; +import type CellEditorHandler from '../plugins/CellEditorHandler'; type PartialGraph = Pick< Graph, diff --git a/packages/core/src/view/mixins/EventsMixin.ts b/packages/core/src/view/mixins/EventsMixin.ts index a38f1246eb..80901e531b 100644 --- a/packages/core/src/view/mixins/EventsMixin.ts +++ b/packages/core/src/view/mixins/EventsMixin.ts @@ -34,15 +34,15 @@ import { } from '../../util/EventUtils'; import CellState from '../cell/CellState'; import Cell from '../cell/Cell'; -import type PanningHandler from '../handler/PanningHandler'; -import type ConnectionHandler from '../handler/ConnectionHandler'; +import type PanningHandler from '../plugins/PanningHandler'; +import type ConnectionHandler from '../plugins/ConnectionHandler'; import Point from '../geometry/Point'; import { convertPoint } from '../../util/styleUtils'; import { NONE } from '../../util/Constants'; import Client from '../../Client'; -import type CellEditorHandler from '../handler/CellEditorHandler'; +import type CellEditorHandler from '../plugins/CellEditorHandler'; import type { Graph } from '../Graph'; -import type TooltipHandler from '../handler/TooltipHandler'; +import type TooltipHandler from '../plugins/TooltipHandler'; type PartialGraph = Pick< Graph, diff --git a/packages/core/src/view/mixins/PanningMixin.ts b/packages/core/src/view/mixins/PanningMixin.ts index 1e0683a14e..5c25ae483a 100644 --- a/packages/core/src/view/mixins/PanningMixin.ts +++ b/packages/core/src/view/mixins/PanningMixin.ts @@ -17,11 +17,11 @@ limitations under the License. import { hasScrollbars } from '../../util/styleUtils'; import EventObject from '../event/EventObject'; import InternalEvent from '../event/InternalEvent'; -import type PanningHandler from '../handler/PanningHandler'; +import type PanningHandler from '../plugins/PanningHandler'; import { Graph } from '../Graph'; import Rectangle from '../geometry/Rectangle'; import Point from '../geometry/Point'; -import type SelectionCellsHandler from '../handler/SelectionCellsHandler'; +import type SelectionCellsHandler from '../plugins/SelectionCellsHandler'; type PartialGraph = Pick; type PartialPanning = Pick< diff --git a/packages/core/src/view/mixins/TooltipMixin.ts b/packages/core/src/view/mixins/TooltipMixin.ts index d18cec9488..fc9a46bc30 100644 --- a/packages/core/src/view/mixins/TooltipMixin.ts +++ b/packages/core/src/view/mixins/TooltipMixin.ts @@ -19,8 +19,8 @@ import Translations from '../../i18n/Translations'; import type Shape from '../geometry/Shape'; import type Cell from '../cell/Cell'; import type { Graph } from '../Graph'; -import type SelectionCellsHandler from '../handler/SelectionCellsHandler'; -import type TooltipHandler from '../handler/TooltipHandler'; +import type SelectionCellsHandler from '../plugins/SelectionCellsHandler'; +import type TooltipHandler from '../plugins/TooltipHandler'; type PartialGraph = Pick< Graph, diff --git a/packages/core/src/view/other/DragSource.ts b/packages/core/src/view/other/DragSource.ts index 9f00a17d9c..35d2413b0c 100644 --- a/packages/core/src/view/other/DragSource.ts +++ b/packages/core/src/view/other/DragSource.ts @@ -42,7 +42,7 @@ import EventSource from '../event/EventSource'; import EventObject from '../event/EventObject'; import { Graph } from '../Graph'; import Cell from '../cell/Cell'; -import SelectionHandler from '../handler/SelectionHandler'; +import type SelectionHandler from '../plugins/SelectionHandler'; export type DropHandler = ( graph: Graph, diff --git a/packages/core/src/view/handler/CellEditorHandler.ts b/packages/core/src/view/plugins/CellEditorHandler.ts similarity index 99% rename from packages/core/src/view/handler/CellEditorHandler.ts rename to packages/core/src/view/plugins/CellEditorHandler.ts index b9ec098ae3..cb1673a8f6 100644 --- a/packages/core/src/view/handler/CellEditorHandler.ts +++ b/packages/core/src/view/plugins/CellEditorHandler.ts @@ -50,7 +50,7 @@ import EventSource from '../event/EventSource'; import type { Graph } from '../Graph'; import type { GraphPlugin } from '../../types'; -import TooltipHandler from './TooltipHandler'; +import type TooltipHandler from './TooltipHandler'; /** * In-place editor for the graph. To control this editor, use diff --git a/packages/core/src/view/handler/ConnectionHandler.ts b/packages/core/src/view/plugins/ConnectionHandler.ts similarity index 99% rename from packages/core/src/view/handler/ConnectionHandler.ts rename to packages/core/src/view/plugins/ConnectionHandler.ts index 6b99e04417..aa2b52fc11 100644 --- a/packages/core/src/view/handler/ConnectionHandler.ts +++ b/packages/core/src/view/plugins/ConnectionHandler.ts @@ -40,7 +40,7 @@ import { convertPoint, getOffset } from '../../util/styleUtils'; import InternalMouseEvent from '../event/InternalMouseEvent'; import ImageShape from '../geometry/node/ImageShape'; import CellMarker from '../cell/CellMarker'; -import ConstraintHandler from './ConstraintHandler'; +import ConstraintHandler from '../handler/ConstraintHandler'; import PolylineShape from '../geometry/edge/PolylineShape'; import EventSource from '../event/EventSource'; import Rectangle from '../geometry/Rectangle'; diff --git a/packages/core/src/view/handler/PanningHandler.ts b/packages/core/src/view/plugins/PanningHandler.ts similarity index 100% rename from packages/core/src/view/handler/PanningHandler.ts rename to packages/core/src/view/plugins/PanningHandler.ts diff --git a/packages/core/src/view/handler/PopupMenuHandler.ts b/packages/core/src/view/plugins/PopupMenuHandler.ts similarity index 99% rename from packages/core/src/view/handler/PopupMenuHandler.ts rename to packages/core/src/view/plugins/PopupMenuHandler.ts index cd51f3df35..733b481f24 100644 --- a/packages/core/src/view/handler/PopupMenuHandler.ts +++ b/packages/core/src/view/plugins/PopupMenuHandler.ts @@ -23,7 +23,7 @@ import { getMainEvent, isMultiTouchEvent } from '../../util/EventUtils'; import { Graph } from '../Graph'; import InternalMouseEvent from '../event/InternalMouseEvent'; import { GraphPlugin } from '../../types'; -import TooltipHandler from './TooltipHandler'; +import type TooltipHandler from './TooltipHandler'; import EventSource from '../event/EventSource'; import EventObject from '../event/EventObject'; diff --git a/packages/core/src/view/handler/RubberBandHandler.ts b/packages/core/src/view/plugins/RubberBandHandler.ts similarity index 100% rename from packages/core/src/view/handler/RubberBandHandler.ts rename to packages/core/src/view/plugins/RubberBandHandler.ts diff --git a/packages/core/src/view/handler/SelectionCellsHandler.ts b/packages/core/src/view/plugins/SelectionCellsHandler.ts similarity index 92% rename from packages/core/src/view/handler/SelectionCellsHandler.ts rename to packages/core/src/view/plugins/SelectionCellsHandler.ts index fffc2f1460..a955374a02 100644 --- a/packages/core/src/view/handler/SelectionCellsHandler.ts +++ b/packages/core/src/view/plugins/SelectionCellsHandler.ts @@ -25,25 +25,26 @@ import { Graph } from '../Graph'; import Cell from '../cell/Cell'; import CellState from '../cell/CellState'; import { GraphPlugin } from '../../types'; -import EdgeHandler from './EdgeHandler'; -import VertexHandler from './VertexHandler'; +import type EdgeHandler from '../handler/EdgeHandler'; +import type VertexHandler from '../handler/VertexHandler'; import InternalMouseEvent from '../event/InternalMouseEvent'; +type Handler = EdgeHandler | VertexHandler; + /** - * An event handler that manages cell handlers and invokes their mouse event - * processing functions. + * An event handler that manages cell handlers and invokes their mouse event processing functions. * - * Group: Events + * ### Events * - * Event: mxEvent.ADD + * #### InternalEvent.ADD * - * Fires if a cell has been added to the selection. The state - * property contains the that has been added. + * Fires if a cell has been added to the selection. + * The `state` property contains the {@link CellState} that has been added. * - * Event: mxEvent.REMOVE + * #### InternalEvent.REMOVE * - * Fires if a cell has been remove from the selection. The state - * property contains the that has been removed. + * Fires if a cell has been remove from the selection. + * The `state` property contains the {@link CellState} that has been removed. * * @category Plugin */ @@ -97,7 +98,7 @@ class SelectionCellsHandler extends EventSource implements GraphPlugin { /** * {@link Dictionary} that maps from cells to handlers. */ - handlers: Dictionary; + handlers: Dictionary; /** * Returns . @@ -206,7 +207,7 @@ class SelectionCellsHandler extends EventSource implements GraphPlugin { /** * Returns true if the given handler is active and should not be redrawn. */ - isHandlerActive(handler: EdgeHandler | VertexHandler) { + isHandlerActive(handler: Handler) { return handler.index !== null; } diff --git a/packages/core/src/view/handler/SelectionHandler.ts b/packages/core/src/view/plugins/SelectionHandler.ts similarity index 97% rename from packages/core/src/view/handler/SelectionHandler.ts rename to packages/core/src/view/plugins/SelectionHandler.ts index 6271e7370f..1efe8f77c0 100644 --- a/packages/core/src/view/handler/SelectionHandler.ts +++ b/packages/core/src/view/plugins/SelectionHandler.ts @@ -44,14 +44,14 @@ import { Graph } from '../Graph'; import Guide from '../other/Guide'; import Shape from '../geometry/Shape'; import InternalMouseEvent from '../event/InternalMouseEvent'; -import SelectionCellsHandler from './SelectionCellsHandler'; +import type SelectionCellsHandler from './SelectionCellsHandler'; import Cell from '../cell/Cell'; -import PopupMenuHandler from './PopupMenuHandler'; +import type PopupMenuHandler from './PopupMenuHandler'; import EventSource from '../event/EventSource'; import CellState from '../cell/CellState'; import EventObject from '../event/EventObject'; -import ConnectionHandler from './ConnectionHandler'; -import CellEditorHandler from './CellEditorHandler'; +import type ConnectionHandler from './ConnectionHandler'; +import type CellEditorHandler from './CellEditorHandler'; import type { ColorValue, GraphPlugin } from '../../types'; @@ -125,13 +125,9 @@ class SelectionHandler implements GraphPlugin { this.updateHint(); if (this.livePreviewUsed) { - const selectionCellsHandler = this.graph.getPlugin( - 'SelectionCellsHandler' - ); - // Forces update to ignore last visible state this.setHandlesVisibleForCells( - selectionCellsHandler?.getHandledSelectionCells() ?? [], + this.getSelectionCellsHandler()?.getHandledSelectionCells() ?? [], false, true ); @@ -472,9 +468,7 @@ class SelectionHandler implements GraphPlugin { isDelayedSelection(cell: Cell, me: InternalMouseEvent) { let c: Cell | null = cell; - const selectionCellsHandler = this.graph.getPlugin( - 'SelectionCellsHandler' - ); + const selectionCellsHandler = this.getSelectionCellsHandler(); if (!this.graph.isToggleEvent(me.getEvent()) || !isAltDown(me.getEvent())) { while (c) { @@ -1057,12 +1051,8 @@ class SelectionHandler implements GraphPlugin { updatePreview(remote = false) { if (this.livePreviewUsed && !remote) { if (this.cells) { - const selectionCellsHandler = this.graph.getPlugin( - 'SelectionCellsHandler' - ); - this.setHandlesVisibleForCells( - selectionCellsHandler?.getHandledSelectionCells() ?? [], + this.getSelectionCellsHandler()?.getHandledSelectionCells() ?? [], false ); this.updateLivePreview(this.currentDx, this.currentDy); @@ -1258,9 +1248,7 @@ class SelectionHandler implements GraphPlugin { * Redraws the preview shape for the given states array. */ redrawHandles(states: CellState[][]) { - const selectionCellsHandler = this.graph.getPlugin( - 'SelectionCellsHandler' - ); + const selectionCellsHandler = this.getSelectionCellsHandler(); for (let i = 0; i < states.length; i += 1) { const handler = selectionCellsHandler?.getHandler(states[i][0].cell); @@ -1363,9 +1351,9 @@ class SelectionHandler implements GraphPlugin { } /** - * Sets wether the handles attached to the given cells are visible. + * Sets whether the handles attached to the given cells are visible. * - * @param cells Array of {@link Cells}. + * @param cells Array of {@link Cell}s. * @param visible Boolean that specifies if the handles should be visible. * @param force Forces an update of the handler regardless of the last used value. */ @@ -1373,9 +1361,7 @@ class SelectionHandler implements GraphPlugin { if (force || this.handlesVisible !== visible) { this.handlesVisible = visible; - const selectionCellsHandler = this.graph.getPlugin( - 'SelectionCellsHandler' - ); + const selectionCellsHandler = this.getSelectionCellsHandler(); for (let i = 0; i < cells.length; i += 1) { const handler = selectionCellsHandler?.getHandler(cells[i]); @@ -1480,12 +1466,8 @@ class SelectionHandler implements GraphPlugin { if (this.livePreviewUsed) { this.resetLivePreview(); - const selectionCellsHandler = this.graph.getPlugin( - 'SelectionCellsHandler' - ); - this.setHandlesVisibleForCells( - selectionCellsHandler?.getHandledSelectionCells() ?? [], + this.getSelectionCellsHandler()?.getHandledSelectionCells() ?? [], true ); } @@ -1672,6 +1654,10 @@ class SelectionHandler implements GraphPlugin { this.destroyShapes(); this.removeHint(); } + + private getSelectionCellsHandler(): SelectionCellsHandler | undefined { + return this.graph.getPlugin('SelectionCellsHandler'); + } } export default SelectionHandler; diff --git a/packages/core/src/view/handler/TooltipHandler.ts b/packages/core/src/view/plugins/TooltipHandler.ts similarity index 99% rename from packages/core/src/view/handler/TooltipHandler.ts rename to packages/core/src/view/plugins/TooltipHandler.ts index 5c6fff1f70..784861eb42 100644 --- a/packages/core/src/view/handler/TooltipHandler.ts +++ b/packages/core/src/view/plugins/TooltipHandler.ts @@ -24,7 +24,7 @@ import { isNode } from '../../util/domUtils'; import { Graph } from '../Graph'; import CellState from '../cell/CellState'; import InternalMouseEvent from '../event/InternalMouseEvent'; -import PopupMenuHandler from './PopupMenuHandler'; +import type PopupMenuHandler from './PopupMenuHandler'; import type { GraphPlugin } from '../../types'; import EventSource from '../event/EventSource'; diff --git a/packages/core/src/view/plugins/index.ts b/packages/core/src/view/plugins/index.ts index 4881513426..5fe539029d 100644 --- a/packages/core/src/view/plugins/index.ts +++ b/packages/core/src/view/plugins/index.ts @@ -15,17 +15,25 @@ limitations under the License. */ import type { GraphPluginConstructor } from '../../types'; -import CellEditorHandler from '../handler/CellEditorHandler'; -import TooltipHandler from '../handler/TooltipHandler'; -import SelectionCellsHandler from '../handler/SelectionCellsHandler'; -import PopupMenuHandler from '../handler/PopupMenuHandler'; -import ConnectionHandler from '../handler/ConnectionHandler'; -import SelectionHandler from '../handler/SelectionHandler'; -import PanningHandler from '../handler/PanningHandler'; +import CellEditorHandler from './CellEditorHandler'; +import TooltipHandler from './TooltipHandler'; +import SelectionCellsHandler from './SelectionCellsHandler'; +import PopupMenuHandler from './PopupMenuHandler'; +import ConnectionHandler from './ConnectionHandler'; +import SelectionHandler from './SelectionHandler'; +import PanningHandler from './PanningHandler'; import { FitPlugin } from './FitPlugin'; -// Export all plugins to have them in the root barrel file +// Export all plugins and types to have them in the root barrel file +export { default as CellEditorHandler } from './CellEditorHandler'; +export { default as ConnectionHandler } from './ConnectionHandler'; export * from './FitPlugin'; +export { default as PanningHandler } from './PanningHandler'; +export { default as PopupMenuHandler } from './PopupMenuHandler'; +export { default as RubberBandHandler } from './RubberBandHandler'; +export { default as SelectionCellsHandler } from './SelectionCellsHandler'; +export { default as SelectionHandler } from './SelectionHandler'; +export { default as TooltipHandler } from './TooltipHandler'; /** * Returns the list of plugins used by default in `maxGraph`.