Trying to run HelloWorld...

development
Junsik Shim 2021-09-07 21:21:22 +09:00
parent bdc50a9f48
commit 2482ec10e9
47 changed files with 145 additions and 135 deletions

View File

@ -72,7 +72,7 @@ export { default as CircleLayout } from './view/layout/layout/CircleLayout';
export { default as CompactTreeLayout } from './view/layout/layout/CompactTreeLayout'; export { default as CompactTreeLayout } from './view/layout/layout/CompactTreeLayout';
export { default as CompositeLayout } from './view/layout/layout/CompositeLayout'; export { default as CompositeLayout } from './view/layout/layout/CompositeLayout';
export { default as EdgeLabelLayout } from './view/layout/layout/EdgeLabelLayout'; export { default as EdgeLabelLayout } from './view/layout/layout/EdgeLabelLayout';
export { default as MxFastOrganicLayout } from './view/layout/layout/FastOrganicLayout'; export { default as FastOrganicLayout } from './view/layout/layout/FastOrganicLayout';
export { default as GraphLayout } from './view/layout/layout/GraphLayout'; export { default as GraphLayout } from './view/layout/layout/GraphLayout';
export { default as ParallelEdgeLayout } from './view/layout/layout/ParallelEdgeLayout'; export { default as ParallelEdgeLayout } from './view/layout/layout/ParallelEdgeLayout';
export { default as PartitionLayout } from './view/layout/layout/PartitionLayout'; export { default as PartitionLayout } from './view/layout/layout/PartitionLayout';
@ -113,7 +113,7 @@ export { default as mxStylesheetCodec } from './util/serialization/mxStylesheetC
export { default as mxTerminalChangeCodec } from './util/serialization/mxTerminalChangeCodec'; export { default as mxTerminalChangeCodec } from './util/serialization/mxTerminalChangeCodec';
export { default as Actor } from './view/geometry/shape/Actor'; export { default as Actor } from './view/geometry/shape/Actor';
export { default as Label } from './view/geometry/shape/node/LabelShape'; export { default as LabelShape } from './view/geometry/shape/node/LabelShape';
export { default as Shape } from './view/geometry/shape/Shape'; export { default as Shape } from './view/geometry/shape/Shape';
export { default as SwimlaneShape } from './view/geometry/shape/node/SwimlaneShape'; export { default as SwimlaneShape } from './view/geometry/shape/node/SwimlaneShape';
export { default as TextShape } from './view/geometry/shape/node/TextShape'; export { default as TextShape } from './view/geometry/shape/node/TextShape';

View File

@ -5,7 +5,7 @@
* Type definitions from the typed-mxgraph project * Type definitions from the typed-mxgraph project
*/ */
import graph from '../../view/Graph'; import { Graph } from '../../view/Graph';
import mxCodecRegistry from './mxCodecRegistry'; import mxCodecRegistry from './mxCodecRegistry';
import mxObjectCodec from './mxObjectCodec'; import mxObjectCodec from './mxObjectCodec';
@ -28,7 +28,7 @@ import mxObjectCodec from './mxObjectCodec';
*/ */
class mxGraphCodec extends mxObjectCodec { class mxGraphCodec extends mxObjectCodec {
constructor() { constructor() {
super(new graph(), [ super(new Graph(), [
'graphListeners', 'graphListeners',
'eventListeners', 'eventListeners',
'view', 'view',

View File

@ -1205,7 +1205,7 @@ class Shape {
* Returns the rotation from the style. * Returns the rotation from the style.
*/ */
getRotation() { getRotation() {
return this.rotation; return this.rotation ?? 0;
} }
/** /**
@ -1230,7 +1230,7 @@ class Shape {
*/ */
getShapeRotation() { getShapeRotation() {
let rot = this.getRotation(); let rot = this.getRotation();
console.log('rot', rot, this, this.rotation);
if (this.direction === DIRECTION_NORTH) { if (this.direction === DIRECTION_NORTH) {
rot += 270; rot += 270;
} else if (this.direction === DIRECTION_WEST) { } else if (this.direction === DIRECTION_WEST) {

View File

@ -1,7 +1,7 @@
import { import {
Graph, Graph,
InternalEvent, InternalEvent,
Rubberband, RubberBand,
ConnectionHandler, ConnectionHandler,
ConnectionConstraint, ConnectionConstraint,
Geometry, Geometry,
@ -91,7 +91,7 @@ const Template = ({ label, ...args }) => {
graph.getStylesheet().getDefaultEdgeStyle().edgeStyle = 'orthogonalEdgeStyle'; graph.getStylesheet().getDefaultEdgeStyle().edgeStyle = 'orthogonalEdgeStyle';
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -1,6 +1,6 @@
import { import {
Graph, Graph,
Rubberband, RubberBand,
InternalEvent, InternalEvent,
CellRenderer, CellRenderer,
EdgeHandler, EdgeHandler,
@ -88,7 +88,7 @@ const Template = ({ label, ...args }) => {
graph.view.setTranslate(20, 20); graph.view.setTranslate(20, 20);
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -1,7 +1,7 @@
import { import {
Graph, Graph,
InternalEvent, InternalEvent,
Rubberband, RubberBand,
Point, Point,
GraphHandler, GraphHandler,
utils, utils,
@ -172,7 +172,7 @@ const Template = ({ label, ...args }) => {
}; };
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -1,14 +1,14 @@
import { import {
Graph, Graph,
InternalEvent, InternalEvent,
Rubberband, RubberBand,
mxClipboard, Clipboard,
utils, utils,
EventUtils, EventUtils,
mxClient, mxClient,
mxCodec, mxCodec,
Model, Model,
mxStringUtils, StringUtils,
} from '@maxgraph/core'; } from '@maxgraph/core';
import { globalTypes } from '../.storybook/preview'; import { globalTypes } from '../.storybook/preview';
@ -44,7 +44,7 @@ const Template = ({ label, ...args }) => {
const graph = new Graph(container); const graph = new Graph(container);
// Public helper method for shared clipboard. // Public helper method for shared clipboard.
mxClipboard.cellsToString = function (cells) { Clipboard.cellsToString = function (cells) {
const codec = new mxCodec(); const codec = new mxCodec();
const model = new Model(); const model = new Model();
const parent = model.getRoot().getChildAt(0); const parent = model.getRoot().getChildAt(0);
@ -142,7 +142,7 @@ const Template = ({ label, ...args }) => {
} }
} }
textInput.value = mxClipboard.cellsToString(clones); textInput.value = Clipboard.cellsToString(clones);
} }
textInput.select(); textInput.select();
@ -228,7 +228,7 @@ const Template = ({ label, ...args }) => {
// Parses and inserts XML into graph // Parses and inserts XML into graph
const pasteText = function (text) { const pasteText = function (text) {
const xml = mxStringUtils.trim(text); const xml = StringUtils.trim(text);
const x = graph.container.scrollLeft / graph.view.scale - graph.view.translate.x; const x = graph.container.scrollLeft / graph.view.scale - graph.view.translate.x;
const y = graph.container.scrollTop / graph.view.scale - graph.view.translate.y; const y = graph.container.scrollTop / graph.view.scale - graph.view.translate.y;
@ -294,7 +294,7 @@ const Template = ({ label, ...args }) => {
}); });
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -1,4 +1,4 @@
import { Graph, InternalEvent, GraphHandler, Rubberband } from '@maxgraph/core'; import { Graph, InternalEvent, GraphHandler, RubberBand } from '@maxgraph/core';
import { globalTypes } from '../.storybook/preview'; import { globalTypes } from '../.storybook/preview';
@ -69,7 +69,7 @@ const Template = ({ label, ...args }) => {
const graph = new MyCustomGraph(container); const graph = new MyCustomGraph(container);
// Enables rubberband selection // Enables rubberband selection
new Rubberband(graph); new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -1,7 +1,7 @@
import { import {
Graph, Graph,
InternalEvent, InternalEvent,
Rubberband, RubberBand,
EventUtils, EventUtils,
utils, utils,
VertexHandler, VertexHandler,
@ -168,7 +168,7 @@ const Template = ({ label, ...args }) => {
// graph.setResizeContainer(true); // graph.setResizeContainer(true);
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -1,7 +1,7 @@
import { import {
Graph, Graph,
InternalEvent, InternalEvent,
Rubberband, RubberBand,
mxDomHelpers, mxDomHelpers,
ImageShape, ImageShape,
Rectangle, Rectangle,
@ -128,7 +128,7 @@ const Template = ({ label, ...args }) => {
// graph.setResizeContainer(true); // graph.setResizeContainer(true);
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -1,7 +1,7 @@
import { import {
Graph, Graph,
mxDomUtils, DomUtils,
Rubberband, RubberBand,
DragSource, DragSource,
utils, utils,
GestureUtils, GestureUtils,
@ -87,7 +87,7 @@ const Template = ({ label, ...args }) => {
// graph.setResizeContainer(true); // graph.setResizeContainer(true);
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).
@ -124,7 +124,7 @@ const Template = ({ label, ...args }) => {
const elt = document.elementFromPoint(x, y); const elt = document.elementFromPoint(x, y);
for (const graph of graphs) { for (const graph of graphs) {
if (mxDomUtils.isAncestorNode(graph.container, elt)) { if (DomUtils.isAncestorNode(graph.container, elt)) {
return graph; return graph;
} }
} }

View File

@ -1,6 +1,6 @@
import { import {
Graph, Graph,
Rubberband, RubberBand,
utils, utils,
EventUtils, EventUtils,
InternalEvent, InternalEvent,
@ -53,7 +53,7 @@ const Template = ({ label, ...args }) => {
const graph = new Graph(container); const graph = new Graph(container);
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
InternalEvent.addListener(container, 'dragover', function (evt) { InternalEvent.addListener(container, 'dragover', function (evt) {
if (graph.isEnabled()) { if (graph.isEnabled()) {

View File

@ -1,13 +1,13 @@
import { import {
Graph, Graph,
Text, TextShape,
mxEffects, mxEffects,
InternalEvent, InternalEvent,
Constants, Constants,
Perimeter, Perimeter,
mxCodec, mxCodec,
utils, utils,
mxXmlUtils, XmlUtils,
} from '@maxgraph/core'; } from '@maxgraph/core';
import { globalTypes } from '../.storybook/preview'; import { globalTypes } from '../.storybook/preview';
@ -31,7 +31,7 @@ const Template = ({ label, ...args }) => {
let requestId = 0; let requestId = 0;
// Speedup the animation // Speedup the animation
Text.prototype.enableBoundingBox = false; TextShape.prototype.enableBoundingBox = false;
// Creates the graph inside the given container // Creates the graph inside the given container
const graph = new Graph(container); const graph = new Graph(container);
@ -85,7 +85,7 @@ const Template = ({ label, ...args }) => {
graph.getModel().beginUpdate(); graph.getModel().beginUpdate();
try { try {
const xml = server(cell.id); const xml = server(cell.id);
const doc = mxXmlUtils.parseXml(xml); const doc = XmlUtils.parseXml(xml);
const dec = new mxCodec(doc); const dec = new mxCodec(doc);
const model = dec.decode(doc.documentElement); const model = dec.decode(doc.documentElement);

View File

@ -1,4 +1,4 @@
import { Graph, utils, Constants, Rubberband } from '@maxgraph/core'; import { Graph, utils, Constants, RubberBand } from '@maxgraph/core';
import { globalTypes } from '../.storybook/preview'; import { globalTypes } from '../.storybook/preview';
@ -29,7 +29,7 @@ const Template = ({ label, ...args }) => {
graph.edgeLabelsMovable = false; graph.edgeLabelsMovable = false;
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Needs to set a flag to check for dynamic style changes, // Needs to set a flag to check for dynamic style changes,
// that is, changes to styles on cells where the style was // that is, changes to styles on cells where the style was

View File

@ -1,6 +1,6 @@
import { import {
Graph, Graph,
Rubberband, RubberBand,
ConnectionHandler, ConnectionHandler,
ImageBox, ImageBox,
mxToolbar, mxToolbar,
@ -74,7 +74,7 @@ const Template = ({ label, ...args }) => {
// Stops editing on enter or escape keypress // Stops editing on enter or escape keypress
const keyHandler = new mxKeyHandler(graph); const keyHandler = new mxKeyHandler(graph);
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
addVertex('/images/rectangle.gif', 100, 40, ''); addVertex('/images/rectangle.gif', 100, 40, '');
addVertex('/images/rounded.gif', 100, 40, 'shape=rounded'); addVertex('/images/rounded.gif', 100, 40, 'shape=rounded');

View File

@ -2,7 +2,7 @@ import {
Graph, Graph,
mxKeyHandler, mxKeyHandler,
utils, utils,
mxDomUtils, DomUtils,
CloneUtils, CloneUtils,
EventUtils, EventUtils,
} from '@maxgraph/core'; } from '@maxgraph/core';
@ -48,14 +48,14 @@ const Template = ({ label, ...args }) => {
td1.style.textAlign = 'center'; td1.style.textAlign = 'center';
td1.style.fontSize = '12px'; td1.style.fontSize = '12px';
td1.style.color = '#774400'; td1.style.color = '#774400';
mxDomUtils.write(td1, cell.value.first); DomUtils.write(td1, cell.value.first);
const tr2 = document.createElement('tr'); const tr2 = document.createElement('tr');
const td2 = document.createElement('td'); const td2 = document.createElement('td');
td2.style.textAlign = 'center'; td2.style.textAlign = 'center';
td2.style.fontSize = '12px'; td2.style.fontSize = '12px';
td2.style.color = '#774400'; td2.style.color = '#774400';
mxDomUtils.write(td2, cell.value.second); DomUtils.write(td2, cell.value.second);
tr1.appendChild(td1); tr1.appendChild(td1);
tr2.appendChild(td2); tr2.appendChild(td2);

View File

@ -1,10 +1,10 @@
import { import {
Graph, Graph,
InternalEvent, InternalEvent,
Rubberband, RubberBand,
ConnectionHandler, ConnectionHandler,
LayoutManager, LayoutManager,
mxParallelEdgeLayout, ParallelEdgeLayout,
ImageBox, ImageBox,
mxKeyHandler, mxKeyHandler,
Constants, Constants,
@ -62,7 +62,7 @@ const Template = ({ label, ...args }) => {
// Optionally you can enable panning, tooltips and connections // Optionally you can enable panning, tooltips and connections
// using graph.setPanning(), setTooltips() & setConnectable(). // using graph.setPanning(), setTooltips() & setConnectable().
// To enable rubberband selection and basic keyboard events, // To enable rubberband selection and basic keyboard events,
// use new Rubberband(graph) and new mxKeyHandler(graph). // use new RubberBand(graph) and new mxKeyHandler(graph).
const graph = new MyCustomGraph(container); const graph = new MyCustomGraph(container);
// Enables tooltips, new connections and panning // Enables tooltips, new connections and panning
@ -71,7 +71,7 @@ const Template = ({ label, ...args }) => {
graph.setConnectable(true); graph.setConnectable(true);
// Automatically handle parallel edges // Automatically handle parallel edges
const layout = new mxParallelEdgeLayout(graph); const layout = new ParallelEdgeLayout(graph);
const layoutMgr = new LayoutManager(graph); const layoutMgr = new LayoutManager(graph);
layoutMgr.getLayout = function (cell) { layoutMgr.getLayout = function (cell) {
@ -82,7 +82,7 @@ const Template = ({ label, ...args }) => {
// Enables rubberband (marquee) selection and a handler // Enables rubberband (marquee) selection and a handler
// for basic keystrokes (eg. return, escape during editing). // for basic keystrokes (eg. return, escape during editing).
const rubberband = new Rubberband(graph); const rubberband = new RubberBand(graph);
const keyHandler = new mxKeyHandler(graph); const keyHandler = new mxKeyHandler(graph);
// Changes the default style for edges "in-place" and assigns // Changes the default style for edges "in-place" and assigns

View File

@ -1,7 +1,7 @@
import { import {
Graph, Graph,
InternalEvent, InternalEvent,
Rubberband, RubberBand,
Rectangle, Rectangle,
Point, Point,
utils, utils,
@ -195,7 +195,7 @@ const Template = ({ label, ...args }) => {
}; };
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -1,4 +1,11 @@
import { Graph, Rubberband, Rectangle, Constants, utils, mxLabel } from '@maxgraph/core'; import {
Graph,
RubberBand,
Rectangle,
Constants,
utils,
LabelShape,
} from '@maxgraph/core';
import { globalTypes } from '../.storybook/preview'; import { globalTypes } from '../.storybook/preview';
@ -23,7 +30,7 @@ const Template = ({ label, ...args }) => {
container.style.cursor = 'default'; container.style.cursor = 'default';
// Overrides the image bounds code to change the position // Overrides the image bounds code to change the position
mxLabel.prototype.getImageBounds = function (x, y, w, h) { LabelShape.prototype.getImageBounds = function (x, y, w, h) {
const iw = utils.getValue(this.style, 'imageWidth', Constants.DEFAULT_IMAGESIZE); const iw = utils.getValue(this.style, 'imageWidth', Constants.DEFAULT_IMAGESIZE);
const ih = utils.getValue(this.style, 'imageHeight', Constants.DEFAULT_IMAGESIZE); const ih = utils.getValue(this.style, 'imageHeight', Constants.DEFAULT_IMAGESIZE);
@ -45,7 +52,7 @@ const Template = ({ label, ...args }) => {
// graph.setResizeContainer(true); // graph.setResizeContainer(true);
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -1,6 +1,6 @@
import { import {
Graph, Graph,
Rubberband, RubberBand,
ConnectionHandler, ConnectionHandler,
ConnectionConstraint, ConnectionConstraint,
ConstraintHandler, ConstraintHandler,
@ -142,7 +142,7 @@ const Template = ({ label, ...args }) => {
graph.setConnectable(true); graph.setConnectable(true);
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -1,7 +1,7 @@
import { import {
Graph, Graph,
InternalEvent, InternalEvent,
Rubberband, RubberBand,
mxLog, mxLog,
GraphView, GraphView,
Point, Point,
@ -45,7 +45,7 @@ const Template = ({ label, ...args }) => {
graph.setPanning(true); graph.setPanning(true);
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
let repaintGrid; let repaintGrid;

View File

@ -1,4 +1,4 @@
import { Graph, Rubberband, GraphHandler, mxPopupMenuHandler } from '@maxgraph/core'; import { Graph, RubberBand, GraphHandler, PopupMenuHandler } from '@maxgraph/core';
import { globalTypes } from '../.storybook/preview'; import { globalTypes } from '../.storybook/preview';
@ -106,7 +106,7 @@ const Template = ({ label, ...args }) => {
}; };
// Returns last selected ancestor // Returns last selected ancestor
mxPopupMenuHandler.prototype.getCellForPopupEvent = function (me) { PopupMenuHandler.prototype.getCellForPopupEvent = function (me) {
let cell = me.getCell(); let cell = me.getCell();
const model = this.graph.getModel(); const model = this.graph.getModel();
let parent = cell.getParent(); let parent = cell.getParent();
@ -133,7 +133,7 @@ const Template = ({ label, ...args }) => {
// graph.setResizeContainer(true); // graph.setResizeContainer(true);
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -5,7 +5,7 @@ import {
Constants, Constants,
EdgeHandler, EdgeHandler,
EdgeStyle, EdgeStyle,
Rubberband, RubberBand,
} from '@maxgraph/core'; } from '@maxgraph/core';
import { globalTypes } from '../.storybook/preview'; import { globalTypes } from '../.storybook/preview';
@ -63,7 +63,7 @@ const Template = ({ label, ...args }) => {
graph.alternateEdgeStyle = 'elbow=vertical'; graph.alternateEdgeStyle = 'elbow=vertical';
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -7,7 +7,7 @@ import {
Rectangle, Rectangle,
VertexHandler, VertexHandler,
InternalEvent, InternalEvent,
Rubberband, RubberBand,
utils, utils,
VertexHandle, VertexHandle,
} from '@maxgraph/core'; } from '@maxgraph/core';
@ -205,7 +205,7 @@ const Template = ({ label, ...args }) => {
graph.centerZoom = false; graph.centerZoom = false;
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -1,6 +1,6 @@
import { import {
Graph, Graph,
Rubberband, RubberBand,
EdgeStyle, EdgeStyle,
Point, Point,
Constants, Constants,
@ -72,7 +72,7 @@ const Template = ({ label, ...args }) => {
}; };
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -25,11 +25,11 @@ const Template = ({ label, ...args }) => {
container.style.background = 'url(/images/grid.gif)'; container.style.background = 'url(/images/grid.gif)';
container.style.cursor = 'default'; container.style.cursor = 'default';
if (!args.contextMenu) InternalEvent.disableContextMenu(container); // if (!args.contextMenu) InternalEvent.disableContextMenu(container);
const graph = new Graph(container); const graph = new Graph(container);
// if (args.rubberBand) new Rubberband(graph); // if (args.rubberBand) new RubberBand(graph);
const parent = graph.getDefaultParent(); const parent = graph.getDefaultParent();

View File

@ -1,11 +1,11 @@
import { import {
Graph, Graph,
mxDomUtils, DomUtils,
mxFastOrganicLayout, FastOrganicLayout,
mxHierarchicalLayout, mxHierarchicalLayout,
Perimeter, Perimeter,
InternalEvent, InternalEvent,
Rubberband, RubberBand,
Constants, Constants,
} from '@maxgraph/core'; } from '@maxgraph/core';
@ -42,7 +42,7 @@ const Template = ({ label, ...args }) => {
const graph = new Graph(container); const graph = new Graph(container);
// Adds rubberband selection // Adds rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Changes the default vertex style in-place // Changes the default vertex style in-place
let style = graph.getStylesheet().getDefaultVertexStyle(); let style = graph.getStylesheet().getDefaultVertexStyle();
@ -58,7 +58,7 @@ const Template = ({ label, ...args }) => {
// Creates a layout algorithm to be used // Creates a layout algorithm to be used
// with the graph // with the graph
const layout = new mxHierarchicalLayout(graph); const layout = new mxHierarchicalLayout(graph);
const organic = new mxFastOrganicLayout(graph); const organic = new FastOrganicLayout(graph);
organic.forceConstant = 120; organic.forceConstant = 120;
const parent = graph.getDefaultParent(); const parent = graph.getDefaultParent();
@ -68,7 +68,7 @@ const Template = ({ label, ...args }) => {
// Adds a button to execute the layout // Adds a button to execute the layout
let button = document.createElement('button'); let button = document.createElement('button');
mxDomUtils.write(button, 'Hierarchical'); DomUtils.write(button, 'Hierarchical');
InternalEvent.addListener(button, 'click', function (evt) { InternalEvent.addListener(button, 'click', function (evt) {
layout.execute(parent); layout.execute(parent);
}); });
@ -76,7 +76,7 @@ const Template = ({ label, ...args }) => {
// Adds a button to execute the layout // Adds a button to execute the layout
button = document.createElement('button'); button = document.createElement('button');
mxDomUtils.write(button, 'Organic'); DomUtils.write(button, 'Organic');
InternalEvent.addListener(button, 'click', function (evt) { InternalEvent.addListener(button, 'click', function (evt) {
organic.execute(parent); organic.execute(parent);

View File

@ -1,7 +1,7 @@
import { import {
Graph, Graph,
InternalEvent, InternalEvent,
Rubberband, RubberBand,
ImageBox, ImageBox,
Rectangle, Rectangle,
utils, utils,
@ -104,7 +104,7 @@ const Template = ({ label, ...args }) => {
graph.setConnectable(true); graph.setConnectable(true);
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Defines the tolerance before removing the icons // Defines the tolerance before removing the icons
const ICON_TOLERANCE = 20; const ICON_TOLERANCE = 20;

View File

@ -1,4 +1,4 @@
import { Graph, Constants, Rubberband, CloneUtils } from '@maxgraph/core'; import { Graph, Constants, RubberBand, CloneUtils } from '@maxgraph/core';
import { globalTypes } from '../.storybook/preview'; import { globalTypes } from '../.storybook/preview';
@ -103,7 +103,7 @@ const Template = ({ label, ...args }) => {
}); });
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -6,9 +6,9 @@ import {
InternalEvent, InternalEvent,
mxClient, mxClient,
mxCodec, mxCodec,
mxDomUtils, DomUtils,
utils, utils,
popup, mxWindow,
} from '@maxgraph/core'; } from '@maxgraph/core';
import { globalTypes } from '../.storybook/preview'; import { globalTypes } from '../.storybook/preview';
@ -41,11 +41,11 @@ const Template = ({ label, ...args }) => {
const codec = new mxObjectCodec(new CustomData()); const codec = new mxObjectCodec(new CustomData());
codec.encode = function (enc, obj) { codec.encode = function (enc, obj) {
const node = enc.document.createElement('CustomData'); const node = enc.document.createElement('CustomData');
mxDomUtils.setTextContent(node, JSON.stringify(obj)); DomUtils.setTextContent(node, JSON.stringify(obj));
return node; return node;
}; };
codec.decode = function (dec, node, into) { codec.decode = function (dec, node, into) {
const obj = JSON.parse(mxDomUtils.getTextContent(node)); const obj = JSON.parse(DomUtils.getTextContent(node));
obj.constructor = CustomData; obj.constructor = CustomData;
return obj; return obj;
@ -85,7 +85,7 @@ const Template = ({ label, ...args }) => {
mxDomHelpers.button('Show JSON', function () { mxDomHelpers.button('Show JSON', function () {
const encoder = new mxCodec(); const encoder = new mxCodec();
const node = encoder.encode(graph.getModel()); const node = encoder.encode(graph.getModel());
popup(utils.getXml(node), true); mxWindow.popup(utils.getXml(node), true);
}) })
); );

View File

@ -1,4 +1,4 @@
import { Graph, Rubberband, mxKeyHandler, Constants, Rectangle } from '@maxgraph/core'; import { Graph, RubberBand, mxKeyHandler, Constants, Rectangle } from '@maxgraph/core';
import { globalTypes } from '../.storybook/preview'; import { globalTypes } from '../.storybook/preview';
@ -28,7 +28,7 @@ const Template = ({ label, ...args }) => {
graph.htmlLabels = true; graph.htmlLabels = true;
graph.vertexLabelsMovable = true; graph.vertexLabelsMovable = true;
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
new mxKeyHandler(graph); new mxKeyHandler(graph);

View File

@ -1,4 +1,4 @@
import { Graph, Perimeter, Constants, Rubberband } from '@maxgraph/core'; import { Graph, Perimeter, Constants, RubberBand } from '@maxgraph/core';
import { globalTypes } from '../.storybook/preview'; import { globalTypes } from '../.storybook/preview';
@ -48,7 +48,7 @@ const Template = ({ label, ...args }) => {
style.strokeWidth = 2; style.strokeWidth = 2;
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -2,7 +2,7 @@ import {
Graph, Graph,
EdgeStyle, EdgeStyle,
mxDomHelpers, mxDomHelpers,
mxXmlUtils, XmlUtils,
Perimeter, Perimeter,
utils, utils,
Constants, Constants,
@ -76,7 +76,7 @@ const Template = ({ label, ...args }) => {
'<Cell id="30" value="" edge="1" parent="2" source="27" target="EnterAccountingData"><Geometry relative="1" as="geometry"><Array as="points"><Point x="469" y="40"/></Array></Geometry></Cell>' + '<Cell id="30" value="" edge="1" parent="2" source="27" target="EnterAccountingData"><Geometry relative="1" as="geometry"><Array as="points"><Point x="469" y="40"/></Array></Geometry></Cell>' +
'<Cell id="33" value="" edge="1" parent="2" source="6" target="EnterAccountingData"><Geometry relative="1" as="geometry"><Array as="points"><Point x="255" y="200"/></Array></Geometry></Cell>' + '<Cell id="33" value="" edge="1" parent="2" source="6" target="EnterAccountingData"><Geometry relative="1" as="geometry"><Array as="points"><Point x="255" y="200"/></Array></Geometry></Cell>' +
'</root></Transactions>'; '</root></Transactions>';
const doc = mxXmlUtils.parseXml(xml); const doc = XmlUtils.parseXml(xml);
const codec = new mxCodec(doc); const codec = new mxCodec(doc);
codec.decode(doc.documentElement, graph.getModel()); codec.decode(doc.documentElement, graph.getModel());
@ -101,7 +101,7 @@ const Template = ({ label, ...args }) => {
*/ */
function update(graph, xml) { function update(graph, xml) {
if (xml != null && xml.length > 0) { if (xml != null && xml.length > 0) {
const doc = mxXmlUtils.parseXml(xml); const doc = XmlUtils.parseXml(xml);
if (doc != null && doc.documentElement != null) { if (doc != null && doc.documentElement != null) {
const model = graph.getModel(); const model = graph.getModel();

View File

@ -3,7 +3,7 @@ import {
mxDomHelpers, mxDomHelpers,
mxMorphing, mxMorphing,
InternalEvent, InternalEvent,
Rubberband, RubberBand,
} from '@maxgraph/core'; } from '@maxgraph/core';
import { globalTypes } from '../.storybook/preview'; import { globalTypes } from '../.storybook/preview';
@ -42,7 +42,7 @@ const Template = ({ label, ...args }) => {
const graph = new Graph(container); const graph = new Graph(container);
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -1,6 +1,6 @@
import { import {
Graph, Graph,
Rubberband, RubberBand,
ConnectionHandler, ConnectionHandler,
GraphHandler, GraphHandler,
Guide, Guide,
@ -82,7 +82,7 @@ const Template = ({ label, ...args }) => {
// graph.setResizeContainer(true); // graph.setResizeContainer(true);
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -1,7 +1,7 @@
import { import {
Graph, Graph,
Rectangle, Rectangle,
Rubberband, RubberBand,
mxDomHelpers, mxDomHelpers,
InternalEvent, InternalEvent,
} from '@maxgraph/core'; } from '@maxgraph/core';
@ -57,7 +57,7 @@ const Template = ({ label, ...args }) => {
graph.graphHandler.scaleGrid = true; graph.graphHandler.scaleGrid = true;
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -1,4 +1,4 @@
import { Graph, Rubberband, GraphView, utils } from '@maxgraph/core'; import { Graph, RubberBand, GraphView, utils } from '@maxgraph/core';
import { globalTypes } from '../.storybook/preview'; import { globalTypes } from '../.storybook/preview';
@ -55,7 +55,7 @@ const Template = ({ label, ...args }) => {
// graph.setResizeContainer(true); // graph.setResizeContainer(true);
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -2,7 +2,7 @@ import {
Graph, Graph,
ConnectionHandler, ConnectionHandler,
ImageBox, ImageBox,
Rubberband, RubberBand,
mxKeyHandler, mxKeyHandler,
mxDomHelpers, mxDomHelpers,
} from '@maxgraph/core'; } from '@maxgraph/core';
@ -44,7 +44,7 @@ const Template = ({ label, ...args }) => {
graph.setAllowLoops(true); graph.setAllowLoops(true);
// Enables rubberband selection and key handling // Enables rubberband selection and key handling
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
const keyHandler = new mxKeyHandler(graph); const keyHandler = new mxKeyHandler(graph);

View File

@ -1,6 +1,6 @@
import { import {
Graph, Graph,
Rubberband, RubberBand,
Point, Point,
EdgeHandler, EdgeHandler,
ConstraintHandler, ConstraintHandler,
@ -44,7 +44,7 @@ const Template = ({ label, ...args }) => {
graph.setPortsEnabled(false); graph.setPortsEnabled(false);
// Enables rubberband selection // Enables rubberband selection
new Rubberband(graph); new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -1,8 +1,8 @@
import { import {
Graph, Graph,
Rubberband, RubberBand,
Constants, Constants,
mxRadialTreeLayout, RadialTreeLayout,
Perimeter, Perimeter,
} from '@maxgraph/core'; } from '@maxgraph/core';
@ -32,7 +32,7 @@ const Template = ({ label, ...args }) => {
const graph = new Graph(container); const graph = new Graph(container);
// Adds rubberband selection // Adds rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Changes the default vertex style in-place // Changes the default vertex style in-place
let style = graph.getStylesheet().getDefaultVertexStyle(); let style = graph.getStylesheet().getDefaultVertexStyle();
@ -47,7 +47,7 @@ const Template = ({ label, ...args }) => {
// Creates a layout algorithm to be used // Creates a layout algorithm to be used
// with the graph // with the graph
const layout = new mxRadialTreeLayout(graph); const layout = new RadialTreeLayout(graph);
const parent = graph.getDefaultParent(); const parent = graph.getDefaultParent();

View File

@ -2,7 +2,7 @@ import {
Graph, Graph,
RectangleShape, RectangleShape,
mxDomHelpers, mxDomHelpers,
Text, TextShape,
Point, Point,
Rectangle, Rectangle,
Constants, Constants,
@ -98,7 +98,7 @@ const Template = ({ label, ...args }) => {
const secondLabel = graph.getSecondLabel(state.cell); const secondLabel = graph.getSecondLabel(state.cell);
if (secondLabel != null && state.shape != null && state.secondLabel == null) { if (secondLabel != null && state.shape != null && state.secondLabel == null) {
state.secondLabel = new Text( state.secondLabel = new TextShape(
secondLabel, secondLabel,
new Rectangle(), new Rectangle(),
Constants.ALIGN_LEFT, Constants.ALIGN_LEFT,

View File

@ -8,10 +8,10 @@ import {
CellHighlight, CellHighlight,
Constants, Constants,
VertexHandler, VertexHandler,
Rubberband, RubberBand,
Shape, Shape,
StencilShape, StencilShape,
StencilRegistry, StencilShapeRegistry,
CellRenderer, CellRenderer,
utils, utils,
} from '@maxgraph/core'; } from '@maxgraph/core';
@ -66,7 +66,7 @@ const Template = ({ label, ...args }) => {
// Uses the shape for resize previews // Uses the shape for resize previews
VertexHandler.prototype.createSelectionShape = function (bounds) { VertexHandler.prototype.createSelectionShape = function (bounds) {
const key = this.state.style.shape; const key = this.state.style.shape;
const stencil = StencilRegistry.getStencil(key); const stencil = StencilShapeRegistry.getStencil(key);
let shape = null; let shape = null;
if (stencil != null) { if (stencil != null) {
@ -128,7 +128,10 @@ const Template = ({ label, ...args }) => {
while (shape != null) { while (shape != null) {
if (shape.nodeType === Constants.NODETYPE_ELEMENT) { if (shape.nodeType === Constants.NODETYPE_ELEMENT) {
StencilRegistry.addStencil(shape.getAttribute('name'), new StencilShape(shape)); StencilShapeRegistry.addStencil(
shape.getAttribute('name'),
new StencilShape(shape)
);
} }
shape = shape.nextSibling; shape = shape.nextSibling;
@ -159,7 +162,7 @@ const Template = ({ label, ...args }) => {
style.shadow = '1'; style.shadow = '1';
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -1,6 +1,6 @@
import { import {
Graph, Graph,
Rubberband, RubberBand,
ConnectionHandler, ConnectionHandler,
ImageBox, ImageBox,
mxToolbar, mxToolbar,
@ -84,7 +84,7 @@ const Template = ({ label, ...args }) => {
// Stops editing on enter or escape keypress // Stops editing on enter or escape keypress
const keyHandler = new mxKeyHandler(graph); const keyHandler = new mxKeyHandler(graph);
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
const addVertex = (icon, w, h, style) => { const addVertex = (icon, w, h, style) => {
const vertex = new Cell(null, new Geometry(0, 0, w, h), style); const vertex = new Cell(null, new Geometry(0, 0, w, h), style);

View File

@ -4,12 +4,12 @@ import {
mxDomHelpers, mxDomHelpers,
mxKeyHandler, mxKeyHandler,
InternalEvent, InternalEvent,
mxXmlUtils, XmlUtils,
mxCodec, mxCodec,
Constants, Constants,
utils, utils,
EdgeStyle, EdgeStyle,
mxDomUtils, DomUtils,
mxForm, mxForm,
CellAttributeChange, CellAttributeChange,
} from '@maxgraph/core'; } from '@maxgraph/core';
@ -37,7 +37,7 @@ const Template = ({ label, ...args }) => {
// Note that these XML nodes will be enclosing the // Note that these XML nodes will be enclosing the
// Cell nodes for the model cells in the output // Cell nodes for the model cells in the output
const doc = mxXmlUtils.createXmlDocument(); const doc = XmlUtils.createXmlDocument();
const person1 = doc.createElement('Person'); const person1 = doc.createElement('Person');
person1.setAttribute('firstName', 'Daffy'); person1.setAttribute('firstName', 'Daffy');
@ -72,7 +72,7 @@ const Template = ({ label, ...args }) => {
// Overrides method to provide a cell label in the display // Overrides method to provide a cell label in the display
graph.convertValueToString = function (cell) { graph.convertValueToString = function (cell) {
if (mxDomUtils.isNode(cell.value)) { if (DomUtils.isNode(cell.value)) {
if (cell.value.nodeName.toLowerCase() == 'person') { if (cell.value.nodeName.toLowerCase() == 'person') {
const firstName = cell.getAttribute('firstName', ''); const firstName = cell.getAttribute('firstName', '');
const lastName = cell.getAttribute('lastName', ''); const lastName = cell.getAttribute('lastName', '');
@ -94,7 +94,7 @@ const Template = ({ label, ...args }) => {
// Overrides method to store a cell label in the model // Overrides method to store a cell label in the model
const { cellLabelChanged } = graph; const { cellLabelChanged } = graph;
graph.cellLabelChanged = function (cell, newValue, autoSize) { graph.cellLabelChanged = function (cell, newValue, autoSize) {
if (mxDomUtils.isNode(cell.value) && cell.value.nodeName.toLowerCase() == 'person') { if (DomUtils.isNode(cell.value) && cell.value.nodeName.toLowerCase() == 'person') {
const pos = newValue.indexOf(' '); const pos = newValue.indexOf(' ');
const firstName = pos > 0 ? newValue.substring(0, pos) : newValue; const firstName = pos > 0 ? newValue.substring(0, pos) : newValue;
@ -116,7 +116,7 @@ const Template = ({ label, ...args }) => {
// Overrides method to create the editing value // Overrides method to create the editing value
const { getEditingValue } = graph; const { getEditingValue } = graph;
graph.getEditingValue = function (cell) { graph.getEditingValue = function (cell) {
if (mxDomUtils.isNode(cell.value) && cell.value.nodeName.toLowerCase() == 'person') { if (DomUtils.isNode(cell.value) && cell.value.nodeName.toLowerCase() == 'person') {
const firstName = cell.getAttribute('firstName', ''); const firstName = cell.getAttribute('firstName', '');
const lastName = cell.getAttribute('lastName', ''); const lastName = cell.getAttribute('lastName', '');
@ -218,13 +218,13 @@ const Template = ({ label, ...args }) => {
const cell = graph.getSelectionCell(); const cell = graph.getSelectionCell();
if (cell == null) { if (cell == null) {
mxDomUtils.writeln(div, 'Nothing selected.'); DomUtils.writeln(div, 'Nothing selected.');
} else { } else {
// Writes the title // Writes the title
const center = document.createElement('center'); const center = document.createElement('center');
mxDomUtils.writeln(center, `${cell.value.nodeName} (${cell.id})`); DomUtils.writeln(center, `${cell.value.nodeName} (${cell.id})`);
div.appendChild(center); div.appendChild(center);
mxDomUtils.br(div); DomUtils.br(div);
// Creates the form from the attributes of the user object // Creates the form from the attributes of the user object
const form = new mxForm(); const form = new mxForm();
@ -236,7 +236,7 @@ const Template = ({ label, ...args }) => {
} }
div.appendChild(form.getTable()); div.appendChild(form.getTable());
mxDomUtils.br(div); DomUtils.br(div);
} }
} }

View File

@ -1,7 +1,7 @@
import { import {
Graph, Graph,
Rubberband, RubberBand,
mxXmlUtils, XmlUtils,
Multiplicity, Multiplicity,
mxKeyHandler, mxKeyHandler,
InternalEvent, InternalEvent,
@ -29,7 +29,7 @@ const Template = ({ label, ...args }) => {
container.style.background = 'url(/images/grid.gif)'; container.style.background = 'url(/images/grid.gif)';
container.style.cursor = 'default'; container.style.cursor = 'default';
const xmlDocument = mxXmlUtils.createXmlDocument(); const xmlDocument = XmlUtils.createXmlDocument();
const sourceNode = xmlDocument.createElement('Source'); const sourceNode = xmlDocument.createElement('Source');
const targetNode = xmlDocument.createElement('Target'); const targetNode = xmlDocument.createElement('Target');
const subtargetNode = xmlDocument.createElement('Subtarget'); const subtargetNode = xmlDocument.createElement('Subtarget');
@ -87,7 +87,7 @@ const Template = ({ label, ...args }) => {
); );
// Enables rubberband selection // Enables rubberband selection
new Rubberband(graph); new RubberBand(graph);
// Removes cells when [DELETE] is pressed // Removes cells when [DELETE] is pressed
const keyHandler = new mxKeyHandler(graph); const keyHandler = new mxKeyHandler(graph);

View File

@ -1,4 +1,4 @@
import { Graph, Rubberband, mxDomHelpers } from '@maxgraph/core'; import { Graph, RubberBand, mxDomHelpers } from '@maxgraph/core';
import { globalTypes } from '../.storybook/preview'; import { globalTypes } from '../.storybook/preview';
@ -29,7 +29,7 @@ const Template = ({ label, ...args }) => {
const graph = new Graph(container); const graph = new Graph(container);
// Enables rubberband selection // Enables rubberband selection
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
// Gets the default parent for inserting new cells. This // Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0). // is normally the first child of the root (ie. layer 0).

View File

@ -2,10 +2,10 @@ import {
Graph, Graph,
mxWindow, mxWindow,
mxKeyHandler, mxKeyHandler,
Rubberband, RubberBand,
InternalEvent, InternalEvent,
mxLog, mxLog,
mxDomUtils, DomUtils,
mxClient, mxClient,
} from '@maxgraph/core'; } from '@maxgraph/core';
@ -57,7 +57,7 @@ const Template = ({ label, ...args }) => {
graph.setTooltips(true); graph.setTooltips(true);
graph.setPanning(true); graph.setPanning(true);
if (args.rubberBand) new Rubberband(graph); if (args.rubberBand) new RubberBand(graph);
new mxKeyHandler(graph); new mxKeyHandler(graph);
@ -85,7 +85,7 @@ const Template = ({ label, ...args }) => {
const lorem = const lorem =
'Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. '; 'Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ';
let content = document.createElement('div'); let content = document.createElement('div');
mxDomUtils.write(content, lorem + lorem + lorem); DomUtils.write(content, lorem + lorem + lorem);
wnd = new mxWindow( wnd = new mxWindow(
'Scrollable, resizable, auto height', 'Scrollable, resizable, auto height',