various bugfixes

development
mcyph 2021-04-25 20:47:53 +10:00
parent b7c46c06a7
commit 2bcacecc7e
19 changed files with 43 additions and 24 deletions

View File

@ -4694,7 +4694,7 @@ HoverIcons.prototype.getState = function(state)
// Uses connectable parent vertex if child is not connectable
if (cell.isVertex() && !cell.isConnectable())
{
let parent = this.cell.getParent();
let parent = cell.getParent();
if (parent.isVertex() && parent.isConnectable())
{
@ -9616,7 +9616,7 @@ if (typeof mxVertexHandler != 'undefined')
this.graph.setSelectionCell(cell);
// Enables focus outline for edges and edge labels
let parent = this.cell.getParent();
let parent = cell.getParent();
let geo = cell.getGeometry();
if ((parent.isEdge() && geo != null && geo.relative) ||

View File

@ -3447,7 +3447,7 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
if (cell != null && !cell.isConnectable() &&
!cell.isEdge())
{
let parent = this.cell.getParent();
let parent = cell.getParent();
if (parent.isVertex() &&
parent.isConnectable())

View File

@ -206,7 +206,7 @@ class mxConstraintHandler {
// Uses connectable parent vertex if one exists
if (cell != null && !cell.isConnectable()) {
const parent = this.cell.getParent();
const parent = cell.getParent();
if (
parent.isVertex() &&

View File

@ -602,7 +602,7 @@ class mxEdgeHandler {
// Uses connectable parent vertex if one exists
if (cell != null && !cell.isConnectable()) {
const parent = this.cell.getParent();
const parent = cell.getParent();
if (
parent.isVertex() &&

View File

@ -424,7 +424,7 @@ class mxGraphLayout {
}
if (this.parent != null) {
const parent = this.cell.getParent();
const parent = cell.getParent();
geo = geo.clone();
if (parent != null && parent !== this.parent) {

View File

@ -12,7 +12,19 @@ import mxCell from '../view/cell/mxCell';
import mxLog from '../util/gui/mxLog';
import { getFunctionName } from '../util/mxStringUtils';
import { importNode, isNode } from '../util/mxDomUtils';
import { createXmlDocument } from '../util/mxXmlUtils';
const createXmlDocument = () => {
// Put here from '../util/mxXmlUtils' to eliminate circular dependency
let doc = null;
if (document.implementation && document.implementation.createDocument) {
doc = document.implementation.createDocument('', '', null);
} else if ('ActiveXObject' in window) {
doc = mxUtils.createMsXmlDocument();
}
return doc;
};
/**
* XML codec for JavaScript object graphs. See {@link mxObjectCodec} for a

View File

@ -205,7 +205,7 @@ class mxMorphing extends mxAnimation {
let result = null;
if (cell != null) {
const parent = this.cell.getParent();
const parent = cell.getParent();
const geo = cell.getGeometry();
result = this.getOriginForCell(parent);

View File

@ -15,6 +15,7 @@ import mxConstants from '../mxConstants';
import { br, write } from '../mxDomUtils';
import mxResources from '../mxResources';
import { getClientX, getClientY } from '../mxEventUtils';
import { htmlEntities } from '../mxStringUtils';
/**
* Basic window inside a document.

View File

@ -908,7 +908,7 @@ class mxCell {
getOrigin(): mxPoint {
let result = null;
if (this != null) {
if (this != null && this.getParent()) {
result = (<mxCell>this.getParent()).getOrigin();
if (!this.isEdge()) {

View File

@ -22,12 +22,9 @@ const Template = ({ label, ...args }) => {
mxGraph,
mxEvent,
mxRubberband,
mxConnectionHandler,
mxConnectionConstraint,
mxGeometry,
mxPolyline,
mxPoint,
mxConstants
mxConstants,
mxUtils
} = mxgraph;
const container = document.createElement('div');

View File

@ -43,7 +43,7 @@ const Template = ({ label, ...args }) => {
getInitialCellForEvent(me) {
let cell = super.getInitialCellForEvent(me);
if (this.graph.isPart(cell)) {
cell = this.cell.getParent();
cell = cell.getParent();
}
return cell;
}

View File

@ -13,6 +13,7 @@ const Template = ({ label, ...args }) => {
const {
mxGraph,
mxText,
mxEffects,
mxEvent,
mxConstants,
mxPerimeter,
@ -108,7 +109,7 @@ const Template = ({ label, ...args }) => {
}
// Merges the response model with the client model
graph.getModel().mergeChildren(model.getRoot().getChildAt(0), parent);
graph.getModel().mergeChildren(graph.getModel().getRoot().getChildAt(0), parent);
// Moves the given cell to the center
let geo = cell.getGeometry();

View File

@ -64,7 +64,7 @@ const Template = ({ label, ...args }) => {
!this.graph.isValidRoot(parent)
) {
cell = parent;
parent = this.cell.getParent();
parent = cell.getParent();
}
}

View File

@ -1,4 +1,5 @@
import mxgraph from '@mxgraph/core';
import { popup } from '@mxgraph/core/src/util/gui/mxWindow';
import { globalTypes } from '../.storybook/preview';
@ -89,7 +90,7 @@ const Template = ({ label, ...args }) => {
mxDomHelpers.button('Show JSON', function() {
const encoder = new mxCodec();
const node = encoder.encode(graph.getModel());
mxWindow.popup(mxUtils.getXml(node), true);
popup(mxUtils.getXml(node), true);
})
);

View File

@ -31,8 +31,8 @@ const Template = ({ label, ...args }) => {
graph.centerZoom = false;
// Links level of detail to zoom level but can be independent of zoom
const isVisible = function(cell) {
return cell.lod == null || cell.lod / 2 < this.view.scale;
const isVisible = function() {
return this.lod == null || this.lod / 2 < graph.view.scale;
};
// Gets the default parent for inserting new cells. This

View File

@ -20,6 +20,7 @@ export default {
const Template = ({ label, ...args }) => {
const {
mxGraph,
mxRectangle,
mxRubberband,
mxDomHelpers,
mxEvent

View File

@ -1,4 +1,5 @@
import mxgraph from '@mxgraph/core';
import { load } from "@mxgraph/core/src/util/network/mxXmlRequest";
import { globalTypes } from '../.storybook/preview';
@ -23,11 +24,15 @@ const Template = ({ label, ...args }) => {
mxConnectionHandler,
mxDomHelpers,
mxEdgeHandler,
mxEvent,
mxPoint,
mxCellHighlight,
mxConstants,
mxVertexHandler,
mxRubberband,
mxShape,
mxStencil,
mxStencilRegistry,
mxCellRenderer,
mxUtils
} = mxgraph;
@ -120,7 +125,7 @@ const Template = ({ label, ...args }) => {
mxCellRenderer.registerShape('customShape', CustomShape);
// Loads the stencils into the registry
const req = mxUtils.load('stencils.xml');
const req = load('stencils.xml');
const root = req.getDocumentElement();
let shape = root.firstChild;

View File

@ -224,7 +224,7 @@ const Template = ({ label, ...args }) => {
// TODO super cannot be used here
// let style = super.getStyle();
let style;
if (this.isCellCollapsed()) {
if (this.isCollapsed()) {
if (style != null) {
style += ';';
} else {
@ -286,7 +286,7 @@ const Template = ({ label, ...args }) => {
};
// Adds cells to the model in a single step
model.batchUpdate(() => {
graph.batchUpdate(() => {
const pool1 = insertVertex({
parent,
value: 'Pool 1',

View File

@ -1,4 +1,5 @@
import mxgraph from '@mxgraph/core';
import { popup } from '@mxgraph/core/src/util/gui/mxWindow';
import { globalTypes } from '../.storybook/preview';
@ -168,7 +169,7 @@ const Template = ({ label, ...args }) => {
mxDomHelpers.button('View XML', function() {
const encoder = new mxCodec();
const node = encoder.encode(graph.getModel());
mxWindow.popup(mxUtils.getPrettyXml(node), true);
popup(mxUtils.getPrettyXml(node), true);
})
);