Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • mxUtils

Index

Constructors

constructor

Properties

Static closeResource

closeResource: "" | "close"

Specifies the resource key for the label of the close button. If the resource for this key does not exist then the value is used as the label. Default is 'close'.

default

'close'

Static errorImage

errorImage: string

Defines the image used for error dialogs.

Static errorResource

errorResource: "" | "error"

Specifies the resource key for the title of the error window. If the resource for this key does not exist then the value is used as the title. Default is 'error'.

default

'error'

Methods

htmlEntities

  • htmlEntities(s: string, newline: boolean): string
  • Replaces characters (less than, greater than, newlines and quotes) with their HTML entities in the given string and returns the result.

    Parameters

    • s: string

      String that contains the characters to be converted.

    • newline: boolean

      If newlines should be replaced. Default is true.

    Returns string

Static addStylename

  • addStylename(style: string, stylename: string): string
  • Adds the specified stylename to the given style if it does not already contain the stylename.

    author

    鸿则 hungtcs@163.com

    date

    2020-07-17

    static

    Parameters

    • style: string
    • stylename: string

    Returns string

Static addTransparentBackgroundFilter

  • addTransparentBackgroundFilter(node: any): void
  • Adds a transparent background to the filter of the given node. This background can be used in IE8 standards mode (native IE8 only) to pass events through the node.

    Parameters

    • node: any

    Returns void

Static alert

  • alert(message: string): void
  • Displays the given alert in a new dialog. This implementation uses the built-in alert function. This is used to display validation errors when connections cannot be changed or created.

    Parameters

    • message: string

      The message to be displayed.

    Returns void

Static animateChanges

  • animateChanges(graph: any, changes: any): void

Static arcToCurves

  • arcToCurves(x0: number, y0: number, r1: number, r2: number, angle: number, largeArcFlag: number, sweepFlag: number, x: number, y: number): any[]
  • Converts the given arc to a series of curves.

    Parameters

    • x0: number
    • y0: number
    • r1: number
    • r2: number
    • angle: number
    • largeArcFlag: number
    • sweepFlag: number
    • x: number
    • y: number

    Returns any[]

Static bind

  • bind<T>(scope: any, func: T): T
  • Returns a wrapper function that locks the execution scope of the given function to the specified scope. Inside funct, the “this” keyword becomes a reference to that scope.

    Type parameters

    • T: Function

    Parameters

    • scope: any
    • func: T

    Returns T

Static br

  • br(parent: Node, count: number): Node
  • Appends a linebreak to the given parent and returns the linebreak.

    Parameters

    • parent: Node

      DOM node to append the linebreak to.

    • count: number

    Returns Node

Static button

  • button(label: string, funct: Function, doc?: Document): Element
  • Returns a new button with the given level and function as an onclick event handler.

    example
    document.body.appendChild(mxUtils.button('Test', function(evt)
    {
      alert('Hello, World!');
    }));
    

    Parameters

    • label: string

      String that represents the label of the button.

    • funct: Function

      Function to be called if the button is pressed.

    • Optional doc: Document

    Returns Element

Static cascadeOpacity

  • cascadeOpacity(graph: any, cell: any, opacity: any): void

Static clearSelection

  • clearSelection(): void

Static clone

  • clone(obj: any, transients?: string[], shallow?: boolean): any
  • Recursively clones the specified object ignoring all field names in the given array of transient fields. mxObjectIdentity.FIELD_NAME is always ignored by this function.

    Parameters

    • obj: any

      Object to be cloned.

    • Optional transients: string[]
    • Optional shallow: boolean

    Returns any

Static confirm

  • confirm(message: string): boolean
  • Displays the given message in a confirm dialog. This implementation uses the built-in confirm function.

    Parameters

    • message: string

      String specifying the message to be displayed.

    Returns boolean

Static contains

  • contains(bounds: mxRectangle, x: number, y: number): boolean
  • Returns true if the specified point (x, y) is contained in the given rectangle.

    Parameters

    • bounds: mxRectangle

      mxRectangle that represents the area

    • x: number

      X-coordinate of the point.

    • y: number

      Y-coordinate of the point.

    Returns boolean

Static convertPoint

  • convertPoint(container: HTMLElement, x: number, y: number): mxPoint
  • Converts the specified point (x, y) using the offset of the specified container and returns a new mxPoint with the result.

    Parameters

    • container: HTMLElement

      DOM node to use for the offset.

    • x: number

      X-coordinate of the point to be converted.

    • y: number

      Y-coordinate of the point to be converted.

    Returns mxPoint

Static createImage

  • createImage(src: string): HTMLImageElement
  • Creates and returns an image (IMG node) or VML image (v:image) in IE6 in quirks mode.

    static

    Parameters

    • src: string

      URL that points to the image to be displayed.

    Returns HTMLImageElement

Static createMsXmlDocument

  • createMsXmlDocument(): any
  • Returns a new, empty Microsoft.XMLDOM document using ActiveXObject.

    Returns any

Static createXmlDocument

  • createXmlDocument(): XMLDocument

Static equalEntries

  • equalEntries(a: {}, b: {}): boolean
  • Returns true if all properties of the given objects are equal. Values with NaN are equal to NaN and unequal to any other value.

    Parameters

    • a: {}

      First object to be compared.

    • b: {}

      Second object to be compared.

    Returns boolean

Static equalPoints

  • Compares all mxPoints in the given lists.

    Parameters

    • a: mxPoint[]

      Array of {@link mxPoints} to be compared.

    • b: mxPoint[]

      Array of {@link mxPoints} to be compared.

    Returns boolean

Static error

  • error(message: string, width: number, close?: boolean, icon?: string): void
  • Displays the given error message in a new of the given width. If close is true then an additional close button is added to the window. The optional icon specifies the icon to be used for the window. Default is mxUtils.errorImage.

    Parameters

    • message: string

      The message to be displayed.

    • width: number

      The width of the window.

    • Optional close: boolean
    • Optional icon: string

    Returns void

Static eval

  • eval(expr: string): any
  • Evaluates the given expression using eval and returns the JavaScript object that represents the expression result. Supports evaluation of expressions that define functions and returns the function object for these expressions.

    Parameters

    • expr: string

      A string that represents a JavaScript expression.

    Returns any

Static extend

  • extend(ctor: Function, superCtor: Function): void
  • Assigns a copy of the superclass prototype to the subclass prototype. Note that this does not call the constructor of the superclass at this point, the superclass constructor should be called explicitely in the subclass constructor.

    example
    MyGraph = function(container, model, renderHint, stylesheet)
    {
      mxGraph.call(this, container, model, renderHint, stylesheet);
    }
    
    mxUtils.extend(MyGraph, mxGraph);
    

    Parameters

    • ctor: Function

      Constructor of the subclass.

    • superCtor: Function

      Constructor of the superclass.

    Returns void

Static extractTextWithWhitespace

  • extractTextWithWhitespace(elems: any): string
  • Returns the text content of the specified node.

    Parameters

    • elems: any

      DOM nodes to return the text for.

    Returns string

Static fadeOut

  • fadeOut(node: Node, from: any, remove: any, step: any, delay: any, isEnabled: boolean): void
  • See mxEffects.fadeOut. This is for backwards compatibility and will be removed later.

    Parameters

    • node: Node
    • from: any
    • remove: any
    • step: any
    • delay: any
    • isEnabled: boolean

    Returns void

Static findNearestSegment

  • findNearestSegment(state: any, x: number, y: number): number
  • Finds the index of the nearest segment on the given cell state for the specified coordinate pair.

    Parameters

    • state: any
    • x: number
    • y: number

    Returns number

Static findNode

  • findNode(node: any, attr: any, value: any): null
  • Returns the first node where attr equals value. This implementation does not use XPath.

    Parameters

    • node: any
    • attr: any
    • value: any

    Returns null

Static fit

  • fit(node: Node): void
  • Makes sure the given node is inside the visible area of the window. This is done by setting the left and top in the style.

    Parameters

    • node: Node

    Returns void

Static forEach

  • forEach(array: any[], fn: Function): any[]
  • Calls the given function for each element of the given array and returns the array.

    Parameters

    • array: any[]

      Array that contains the elements.

    • fn: Function

      Function to be called for each object.

    Returns any[]

Static get

  • Loads the specified URL asynchronously and invokes the given functions depending on the request status. Returns the mxXmlRequest in use. Both functions take the mxXmlRequest as the only parameter. See mxUtils.load for a synchronous implementation.

    Parameters

    Returns any

Static getAlignmentAsPoint

  • getAlignmentAsPoint(align: any, valign: any): mxPoint
  • Returns an mxPoint that represents the horizontal and vertical alignment for numeric computations. X is -0.5 for center, -1 for right and 0 for left alignment. Y is -0.5 for middle, -1 for bottom and 0 for top alignment. Default values for missing arguments is top, left.

    Parameters

    • align: any
    • valign: any

    Returns mxPoint

Static getAll

  • Loads the URLs in the given array asynchronously and invokes the given function if all requests returned with a valid 2xx status. The error handler is invoked once on the first error or invalid response.

    Parameters

    Returns void

Static getBoundingBox

Static getChildNodes

  • getChildNodes(node: Node, nodeType?: any): Node[]
  • Returns an array of child nodes that are of the given node type.

    Parameters

    • node: Node

      Parent DOM node to return the children from.

    • Optional nodeType: any

    Returns Node[]

Static getColor

  • getColor(array: any[], key: any, defaultValue: any): any
  • Returns the color value for the given key in the given associative array or the given default value if the value is null. If the value is mxConstants.NONE then null is returned.

    Parameters

    • array: any[]

      Associative array that contains the value for the key whose value should be returned.

    • key: any

      Key whose value should be returned.

    • defaultValue: any

      Value to be returned if the value for the given key is null. Default is null.

    Returns any

Static getCurrentStyle

  • getCurrentStyle(): any

Static getDirectedBounds

  • getDirectedBounds(rect: any, m: any, style: any, flipH: any, flipV: any): mxRectangle
  • Adds the given margins to the given rectangle and rotates and flips the rectangle according to the respective styles in style.

    Parameters

    • rect: any
    • m: any
    • style: any
    • flipH: any
    • flipV: any

    Returns mxRectangle

Static getDocumentScrollOrigin

  • getDocumentScrollOrigin(doc: Document): mxPoint
  • Returns the scroll origin of the given document or the current document if no document is given.

    Parameters

    • doc: Document

    Returns mxPoint

Static getDocumentSize

Static getFunctionName

  • getFunctionName(f: {}): string
  • Returns the name for the given function.

    Parameters

    • f: {}

      JavaScript object that represents a function.

    Returns string

Static getInnerHtml

  • getInnerHtml(): string
  • Returns the inner HTML for the given node as a string or an empty string if no node was specified. The inner HTML is the text representing all children of the node, but not the node itself.

    Returns string

Static getNumber

  • getNumber(array: any[], key: string, defaultValue: number): number
  • Returns the numeric value for the given key in the given associative array or the given default value (or 0) if the value is null. The value is converted to a numeric value using the Number function.

    Parameters

    • array: any[]

      Associative array that contains the value for the key.

    • key: string

      Key whose value should be returned.

    • defaultValue: number

    Returns number

Static getOffset

  • getOffset(container: HTMLElement, scrollOffset?: boolean): mxPoint
  • Returns the offset for the specified container as an mxPoint. The offset is the distance from the top left corner of the container to the top left corner of the document.

    author

    鸿则 hungtcs@163.com

    date

    2020-01-09

    static

    Parameters

    • container: HTMLElement
    • Optional scrollOffset: boolean

    Returns mxPoint

Static getOuterHtml

  • getOuterHtml(): string
  • Returns the outer HTML for the given node as a string or an empty string if no node was specified. The outer HTML is the text representing all children of the node including the node itself.

    Returns string

Static getPerimeterPoint

  • getPerimeterPoint(pts: any, center: any, point: any): any
  • Returns the intersection between the polygon defined by the array of points and the line between center and point.

    Parameters

    • pts: any
    • center: any
    • point: any

    Returns any

Static getPortConstraints

  • Returns an integer mask of the port constraints of the given map

    Parameters

    • terminal: mxCellState

      mxCellState that represents the terminal.

    • edge: mxCellState

      mxCellState that represents the edge.

    • source: boolean

      Boolean that specifies if the terminal is the source terminal.

    • defaultValue: any

      Default value to be returned.

    Returns any

Static getPrettyXml

  • getPrettyXml(node: XMLDocument, tab?: string, indent?: string, newline?: string, ns?: any): string
  • Returns a pretty printed string that represents the XML tree for the given node. This method should only be used to print XML for reading, use getXml instead to obtain a string for processing.

    Parameters

    • node: XMLDocument

      DOM node to return the XML for.

    • Optional tab: string
    • Optional indent: string
    • Optional newline: string
    • Optional ns: any

    Returns string

Static getRotatedPoint

  • getRotatedPoint(pt: any, cos: number, sin: number, c: any): mxPoint
  • Rotates the given point by the given cos and sin.

    Parameters

    • pt: any
    • cos: number
    • sin: number
    • c: any

    Returns mxPoint

Static getScaleForPageCount

  • getScaleForPageCount(pageCount: number, graph: mxGraph, pageFormat: mxRectangle, border: number): number
  • Returns the scale to be used for printing the graph with the given bounds across the specifies number of pages with the given format. The scale is always computed such that it given the given amount or fewer pages in the print output. See mxPrintPreview for an example.

    Parameters

    Returns number

Static getScrollOrigin

  • getScrollOrigin(node: HTMLElement, includeAncestors?: boolean, includeDocument?: boolean): mxPoint
  • Returns the top, left corner of the viewrect as an mxPoint.

    author

    鸿则 hungtcs@163.com

    date

    2020-01-09

    static

    Parameters

    • node: HTMLElement
    • Optional includeAncestors: boolean
    • Optional includeDocument: boolean

    Returns mxPoint

Static getSizeForString

  • getSizeForString(text: string, fontSize: number, fontFamily: string, textWidth?: number, fontStyle?: string): mxRectangle
  • Returns an mxRectangle with the size (width and height in pixels) of the given string. The string may contain HTML markup. Newlines should be converted to
    before calling this method. The caller is responsible for sanitizing the HTML markup.

    example
    var label = graph.getLabel(cell).replace(/\n/g, "<br>");
    var size = graph.getSizeForString(label);
    

    Parameters

    • text: string

      String whose size should be returned.

    • fontSize: number

      Integer that specifies the font size in pixels. Default is <mxConstants.DEFAULT_FONTSIZE>.

    • fontFamily: string

      String that specifies the name of the font family. Default is <mxConstants.DEFAULT_FONTFAMILY>.

    • Optional textWidth: number
    • Optional fontStyle: string

    Returns mxRectangle

Static getStylename

  • getStylename(style: string): string
  • Returns the stylename in a style of the form [(stylename|key=value);] or an empty string if the given style does not contain a stylename.

    author

    鸿则 hungtcs@163.com

    date

    2020-07-17

    static

    Parameters

    • style: string

      String of the form [(stylename|key=value);]

    Returns string

Static getStylenames

  • getStylenames(style: string): string[]
  • Returns the stylenames in a style of the form [(stylename|key=value);] or an empty array if the given style does not contain any stylenames.

    author

    鸿则 hungtcs@163.com

    date

    2020-07-17

    static

    Parameters

    • style: string

      String of the form [(stylename|key=value);]

    Returns string[]

Static getTextContent

  • getTextContent(node: Node): string
  • Returns the text content of the specified node.

    Parameters

    • node: Node

      DOM node to return the text content for.

    Returns string

Static getValue

  • getValue(array: undefined | Record<string | number | symbol, any>, key: string | number | symbol, defaultValue: any): any
  • Returns the value for the given key in the given associative array or the given default value if the value is null.

    Parameters

    • array: undefined | Record<string | number | symbol, any>

      Associative array that contains the value for the key.

    • key: string | number | symbol

      Key whose value should be returned.

    • defaultValue: any

      Value to be returned if the value for the given key is null.

    Returns any

Static getViewXml

  • getViewXml(graph: any, scale: any, cells: any, x0: number, y0: number): any
  • Parameters

    • graph: any
    • scale: any
    • cells: any
    • x0: number
    • y0: number

    Returns any

Static getXml

  • getXml(node: XMLDocument, linefeed?: string): string
  • Returns the XML content of the specified node. For Internet Explorer, all \r\n\t[\t]* are removed from the XML string and the remaining \r\n are replaced by \n. All \n are then replaced with linefeed, or if no linefeed is defined.

    author

    鸿则 hungtcs@163.com

    date

    2019-12-27

    static

    Parameters

    • node: XMLDocument

      DOM node to return the XML for.

    • Optional linefeed: string

    Returns string

Static hasScrollbars

  • hasScrollbars(node: Node): boolean
  • Returns true if the overflow CSS property of the given node is either scroll or auto.

    Parameters

    • node: Node

      DOM node whose style should be checked for scrollbars.

    Returns boolean

Static importNode

  • importNode(doc: any, node: any, allChildren: any): any
  • Cross browser implementation for document.importNode. Uses document.importNode in all browsers but IE, where the node is cloned by creating a new node and copying all attributes and children into it using importNode, recursively.

    Parameters

    • doc: any

      Document to import the node into.

    • node: any

      Node to be imported.

    • allChildren: any

      If all children should be imported.

    Returns any

Static importNodeImplementation

  • importNodeImplementation(doc: any, node: Node, allChildren: boolean): any
  • Full DOM API implementation for importNode without using importNode API call.

    Parameters

    • doc: any

      Document to import the node into.

    • node: Node

      Node to be imported.

    • allChildren: boolean

      If all children should be imported.

    Returns any

Static indexOf

  • indexOf(array: any[], obj: {}): number
  • Returns the index of obj in array or -1 if the array does not contain the given object.

    Parameters

    • array: any[]

      Array to check for the given obj.

    • obj: {}

      Object to find in the given array.

    Returns number

Static indexOfStylename

  • indexOfStylename(style: string, stylename: string): number
  • Returns the index of the given stylename in the given style. This returns -1 if the given stylename does not occur (as a stylename) in the given style, otherwise it returns the index of the first character.

    author

    鸿则 hungtcs@163.com

    date

    2020-07-17

    static

    Parameters

    • style: string
    • stylename: string

    Returns number

Static intersection

  • intersection(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): null | mxPoint
  • Returns the intersection of two lines as an mxPoint.

    Parameters

    • x0: number

      X-coordinate of the first line's startpoint.

    • y0: number

      X-coordinate of the first line's startpoint.

    • x1: number

      X-coordinate of the first line's endpoint.

    • y1: number

      Y-coordinate of the first line's endpoint.

    • x2: number

      X-coordinate of the second line's startpoint.

    • y2: number

      Y-coordinate of the second line's startpoint.

    • x3: number

      X-coordinate of the second line's endpoint.

    • y3: number

      Y-coordinate of the second line's endpoint.

    Returns null | mxPoint

Static intersects

Static intersectsHotspot

  • intersectsHotspot(state: mxCellState, x: number, y: number, hotspot?: number, min?: number, max?: number): boolean
  • Returns true if the state and the hotspot intersect.

    Parameters

    • state: mxCellState
    • x: number

      X-coordinate.

    • y: number

      Y-coordinate.

    • Optional hotspot: number
    • Optional min: number
    • Optional max: number

    Returns boolean

Static isAncestorNode

  • isAncestorNode(ancestor: Node, child: Node): boolean
  • Returns true if the given ancestor is an ancestor of the given DOM node in the DOM. This also returns true if the child is the ancestor.

    author

    鸿则 hungtcs@163.com

    date

    2020-01-07

    static

    Parameters

    • ancestor: Node

      DOM node that represents the ancestor.

    • child: Node

      DOM node that represents the child.

    Returns boolean

Static isInteger

  • isInteger(n: string): boolean
  • Returns true if the given value is an valid integer number.

    Parameters

    • n: string

      String representing the possibly numeric value.

    Returns boolean

Static isNaN

  • isNaN(value: any): boolean
  • Returns true if the given value is of type number and isNaN returns true.

    Parameters

    • value: any

    Returns boolean

Static isNode

  • isNode(value: {}, nodeName: string, attributeName?: string, attributeValue?: any): boolean
  • Returns true if the given value is an XML node with the node name and if the optional attribute has the specified value.

    This implementation assumes that the given value is a DOM node if the nodeType property is numeric, that is, if isNaN returns false for value.nodeType.

    Parameters

    • value: {}

      Object that should be examined as a node.

    • nodeName: string

      String that specifies the node name.

    • Optional attributeName: string
    • Optional attributeValue: any

    Returns boolean

Static isNumeric

  • isNumeric(n: string): boolean
  • Returns true if the specified value is numeric, that is, if it is not null, not an empty string, not a HEX number and isNaN returns false.

    Parameters

    • n: string

      String representing the possibly numeric value.

    Returns boolean

Static isVml

  • isVml(node: any): boolean
  • Returns true if the given node is in the VML namespace.

    Parameters

    • node: any

      DOM node whose tag urn should be checked.

    Returns boolean

Static link

  • link(parent: Node, text: string, funct: Function, pad?: number): HTMLElement
  • Parameters

    • parent: Node

      DOM node to contain the new link.

    • text: string

      String that is used as the link label.

    • funct: Function

      Function to execute when the link is clicked.

    • Optional pad: number

    Returns HTMLElement

Static linkAction

  • linkAction(parent: Node, text: string, editor: mxEditor, action: string, pad?: number): HTMLElement
  • Adds a hyperlink to the specified parent that invokes action on the specified editor.

    Parameters

    • parent: Node

      DOM node to contain the new link.

    • text: string

      String that is used as the link label.

    • editor: mxEditor

      mxEditor that will execute the action.

    • action: string

      String that defines the name of the action to be executed.

    • Optional pad: number

    Returns HTMLElement

Static linkInvoke

  • linkInvoke(parent: Node, text: string, editor: mxEditor, functName: string, arg: {}, pad?: number): HTMLElement
  • Adds a hyperlink to the specified parent that invokes the specified function on the editor passing along the specified argument. The function name is the name of a function of the editor instance, not an action name.

    Parameters

    • parent: Node

      DOM node to contain the new link.

    • text: string

      String that is used as the link label.

    • editor: mxEditor

      mxEditor instance to execute the function on.

    • functName: string

      String that represents the name of the function.

    • arg: {}

      Object that represents the argument to the function.

    • Optional pad: number

    Returns HTMLElement

Static load

  • Loads the specified URL synchronously and returns the mxXmlRequest. Throws an exception if the file cannot be loaded. See mxUtils.get for an asynchronous implementation.

    Parameters

    • url: string

      URL to get the data from.

    Returns mxXmlRequest

Static loadInto

  • loadInto(url: string, doc: Document, onload: (req: mxXmlRequest) => void): void
  • Loads the specified URL asynchronously into the specified document, invoking onload after the document has been loaded. This implementation does not use mxXmlRequest, but the document.load method.

    Parameters

    • url: string

      URL to get the data from.

    • doc: Document

      The document to load the URL into.

    • onload: (req: mxXmlRequest) => void

      Function to execute when the URL has been loaded.

    Returns void

Static ltrim

  • ltrim(str: string, chars: string): null | string
  • Strips all whitespaces from the beginning of the string. Without the second parameter, this will trim these characters:

    • " " (ASCII 32 (0x20)), an ordinary space
    • "\t" (ASCII 9 (0x09)), a tab
    • "\n" (ASCII 10 (0x0A)), a new line (line feed)
    • "\r" (ASCII 13 (0x0D)), a carriage return
    • "\0" (ASCII 0 (0x00)), the NUL-byte
    • "\x0B" (ASCII 11 (0x0B)), a vertical tab

    Parameters

    • str: string
    • chars: string

    Returns null | string

Static makeDraggable

  • makeDraggable(element: HTMLElement, graphF: mxGraph, funct: Function, dragElement?: Node, dx?: number, dy?: number, autoscroll?: boolean, scalePreview?: boolean, highlightDropTargets?: boolean, getDropTarget?: (graph: mxGraph, x: number, y: number, evt: PointerEvent) => mxCell): mxDragSource
  • Configures the given DOM element to act as a drag source for the specified graph. Returns a a new mxDragSource. If {@link mxDragSource.guideEnabled} is enabled then the x and y arguments must be used in funct to match the preview location.

    Parameters

    • element: HTMLElement

      DOM element to make draggable.

    • graphF: mxGraph

      mxGraph that acts as the drop target or a function that takes a mouse event and returns the current mxGraph.

    • funct: Function

      Function to execute on a successful drop.

    • Optional dragElement: Node
    • Optional dx: number
    • Optional dy: number
    • Optional autoscroll: boolean
    • Optional scalePreview: boolean
    • Optional highlightDropTargets: boolean
    • Optional getDropTarget: (graph: mxGraph, x: number, y: number, evt: PointerEvent) => mxCell
        • (graph: mxGraph, x: number, y: number, evt: PointerEvent): mxCell
        • Parameters

          • graph: mxGraph
          • x: number
          • y: number
          • evt: PointerEvent

          Returns mxCell

    Returns mxDragSource

Static mod

  • mod(n: number, m: number): number
  • Returns the remainder of division of n by m. You should use this instead of the built-in operation as the built-in operation does not properly handle negative numbers.

    Parameters

    • n: number
    • m: number

    Returns number

Static para

  • para(parent: Node, text: string): Element
  • Appends a new paragraph with the given text to the specified parent and returns the paragraph.

    Parameters

    • parent: Node

      DOM node to append the text node to.

    • text: string

      String representing the text for the new paragraph.

    Returns Element

Static parseCssNumber

  • parseCssNumber(value: string): number
  • Parses the given CSS numeric value adding handling for the values thin, medium and thick (2, 4 and 6).

    Parameters

    • value: string

    Returns number

Static parseXml

  • parseXml(xml: string): XMLDocument
  • Parses the specified XML string into a new XML document and returns the new document.

    author

    鸿则 hungtcs@163.com

    date

    2019-12-27

    static

    Parameters

    • xml: string

    Returns XMLDocument

Static popup

  • popup(content: string, isInternalWindow: boolean): void
  • Shows the specified text content in a new mxWindow or a new browser window if isInternalWindow is false.

    Parameters

    • content: string

      String that specifies the text to be displayed.

    • isInternalWindow: boolean

    Returns void

Static post

  • Posts the specified params to the given URL asynchronously and invokes the given functions depending on the request status. Returns the in use. Both functions take the as the only parameter. Make sure to use encodeURIComponent for the parameter values.

    example
    mxUtils.post(url, 'key=value', function(req)
    {
        mxUtils.alert('Ready: '+req.isReady()+' Status: '+req.getStatus());
     // Process req.getDocumentElement() using DOM API if OK...
    });
    

    Parameters

    Returns mxXmlRequest

Static printScreen

  • printScreen(graph: mxGraph): void
  • Prints the specified graph using a new window and the built-in print dialog. This function should be called from within the document with the graph.

    Parameters

    Returns void

Static prompt

  • prompt(message: string, defaultValue: string): string
  • Displays the given message in a prompt dialog. This implementation uses the built-in prompt function.

    Parameters

    • message: string

      String specifying the message to be displayed.

    • defaultValue: string

    Returns string

Static ptLineDist

  • ptLineDist(x1: number, y1: number, x2: number, y2: number, px: number, py: number): number
  • Returns the distance between a line defined by two points and a point. To get the distance between a point and a segment (with a specific length) use {@link mxUtils.ptSeqDistSq}.

    Parameters

    • x1: number

      X-coordinate of point 1 of the line.

    • y1: number

      Y-coordinate of point 1 of the line.

    • x2: number

      X-coordinate of point 1 of the line.

    • y2: number

      Y-coordinate of point 1 of the line.

    • px: number

      X-coordinate of the point.

    • py: number

      Y-coordinate of the point.

    Returns number

Static ptSegDistSq

  • ptSegDistSq(x1: number, y1: number, x2: number, y2: number, px: number, py: number): number
  • Returns the square distance between a segment and a point. To get the distance between a point and a line (with infinite length) use mxUtils.ptLineDist.

    Parameters

    • x1: number

      X-coordinate of the startpoint of the segment.

    • y1: number

      Y-coordinate of the startpoint of the segment.

    • x2: number

      X-coordinate of the endpoint of the segment.

    • y2: number

      Y-coordinate of the endpoint of the segment.

    • px: number

      X-coordinate of the point.

    • py: number

      Y-coordinate of the point.

    Returns number

Static rectangleIntersectsSegment

Static relativeCcw

  • relativeCcw(x1: number, y1: number, x2: number, y2: number, px: number, py: number): number
  • Returns 1 if the given point on the right side of the segment, 0 if its on the segment, and -1 if the point is on the left side of the segment.

    Parameters

    • x1: number

      X-coordinate of the startpoint of the segment.

    • y1: number

      Y-coordinate of the startpoint of the segment.

    • x2: number

      X-coordinate of the endpoint of the segment.

    • y2: number

      Y-coordinate of the endpoint of the segment.

    • px: number

      X-coordinate of the point.

    • py: number

      Y-coordinate of the point.

    Returns number

Static remove

  • remove(obj: {}, array: any[]): {}
  • Removes all occurrences of the given object in the given array or object. If there are multiple occurrences of the object, be they associative or as an array entry, all occurrences are removed from the array or deleted from the object. By removing the object from the array, all elements following the removed element are shifted by one step towards the beginning of the array.

    The length of arrays is not modified inside this function.

    Parameters

    • obj: {}

      Object to find in the given array.

    • array: any[]

      Array to check for the given obj.

    Returns {}

Static removeAllStylenames

  • removeAllStylenames(style: string): string
  • Removes all stylenames from the given style and returns the updated style.

    author

    鸿则 hungtcs@163.com

    date

    2020-07-17

    static

    Parameters

    • style: string

    Returns string

Static removeCursors

  • removeCursors(element: Node): void
  • Removes the cursors from the style of the given DOM node and its descendants.

    Parameters

    • element: Node

      DOM node to remove the cursor style from.

    Returns void

Static removeDuplicates

  • removeDuplicates<T>(arr: T[]): T[]
  • Removes all duplicates from the given array.

    Type parameters

    • T

    Parameters

    • arr: T[]

    Returns T[]

Static removeStylename

  • removeStylename(style: string, stylename: string): string
  • Removes all occurrences of the specified stylename in the given style and returns the updated style. Trailing semicolons are not preserved.

    author

    鸿则 hungtcs@163.com

    date

    2020-07-17

    static

    Parameters

    • style: string
    • stylename: string

    Returns string

Static removeWhitespace

  • removeWhitespace(node: Node, before: boolean): void
  • Removes the sibling text nodes for the given node that only consists of tabs, newlines and spaces.

    Parameters

    • node: Node

      DOM node whose siblings should be removed.

    • before: boolean

    Returns void

Static replaceTrailingNewlines

  • replaceTrailingNewlines(str: string, pattern: string): string
  • Replaces each trailing newline with the given pattern.

    Parameters

    • str: string
    • pattern: string

    Returns string

Static reversePortConstraints

  • reversePortConstraints(constraint: any): any
  • Reverse the port constraint bitmask. For example, north | east becomes south | west

    Parameters

    • constraint: any

    Returns any

Static rtrim

  • rtrim(str: string, chars: string): null | string
  • Strips all whitespaces from the end of the string. Without the second parameter, this will trim these characters:

    • " " (ASCII 32 (0x20)), an ordinary space
    • "\t" (ASCII 9 (0x09)), a tab
    • "\n" (ASCII 10 (0x0A)), a new line (line feed)
    • "\r" (ASCII 13 (0x0D)), a carriage return
    • "\0" (ASCII 0 (0x00)), the NUL-byte
    • "\x0B" (ASCII 11 (0x0B)), a vertical tab

    Parameters

    • str: string
    • chars: string

    Returns null | string

Static setCellStyleFlags

  • setCellStyleFlags(model: mxGraphModel, cells: mxCell[], key: string, flag: number, value?: boolean): void
  • Sets or toggles the flag bit for the given key in the cell's styles. If value is null then the flag is toggled.

    example
    var cells = graph.getSelectionCells();
    mxUtils.setCellStyleFlags(graph.model,
                cells,
                mxConstants.STYLE_FONTSTYLE,
                mxConstants.FONT_BOLD);
    

    Toggles the bold font style.

    Parameters

    • model: mxGraphModel

      mxGraphModel that contains the cells.

    • cells: mxCell[]

      Array of mxCell to change the style for.

    • key: string

      Key of the style to be changed.

    • flag: number

      Integer for the bit to be changed.

    • Optional value: boolean

    Returns void

Static setCellStyles

  • setCellStyles(model: mxGraphModel, cells: mxCell[], key: string, value: null | string | number): void
  • Assigns the value for the given key in the styles of the given cells, or removes the key from the styles if the value is null.

    author

    鸿则 hungtcs@163.com

    date

    2020-07-17

    static

    Parameters

    • model: mxGraphModel

      mxGraphModel to execute the transaction in.

    • cells: mxCell[]

      Array of to be updated.

    • key: string

      Key of the style to be changed.

    • value: null | string | number

      New value for the given key.

    Returns void

Static setOpacity

  • setOpacity(node: HTMLElement, value: number): void
  • Sets the opacity of the specified DOM node to the given value in %.

    Parameters

    • node: HTMLElement

      DOM node to set the opacity for.

    • value: number

      Opacity in %. Possible values are between 0 and 100.

    Returns void

Static setPrefixedStyle

  • setPrefixedStyle(): void
  • Adds the given style with the standard name and an optional vendor prefix for the current browser.

    example
    mxUtils.setPrefixedStyle(node.style, 'transformOrigin', '0% 0%');
    

    Returns void

Static setStyle

  • setStyle(style: string, key: string, value: null | string | number): string
  • Adds or removes the given key, value pair to the style and returns the new style. If value is null or zero length then the key is removed from the style. This is for cell styles, not for CSS styles.

    author

    鸿则 hungtcs@163.com

    date

    2020-07-17

    static

    Parameters

    • style: string

      String of the form [(stylename|key=value);].

    • key: string

      Key of the style to be changed.

    • value: null | string | number

      New value for the given key.

    Returns string

Static setStyleFlag

  • setStyleFlag(style: string, key: string, flag: number, value?: boolean): string
  • Sets or removes the given key from the specified style and returns the new style. If value is null then the flag is toggled.

    Parameters

    • style: string

      String of the form [(stylename|key=value);].

    • key: string

      Key of the style to be changed.

    • flag: number

      Integer for the bit to be changed.

    • Optional value: boolean

    Returns string

Static setTextContent

  • setTextContent(node: Node, text: string): void
  • Sets the text content of the specified node.

    Parameters

    • node: Node

      DOM node to set the text content for.

    • text: string

      String that represents the text content.

    Returns void

Static show

  • show(graph: mxGraph, doc: Document, x0: number, y0: number, w: number, h: number): Document
  • Copies the styles and the markup from the graph's container into the given document and removes all cursor styles. The document is returned.

    This function should be called from within the document with the graph. If you experience problems with missing stylesheets in IE then try adding the domain to the trusted sites.

    Parameters

    • graph: mxGraph

      mxGraph to be copied.

    • doc: Document

      Document where the new graph is created.

    • x0: number
    • y0: number
    • w: number
    • h: number

    Returns Document

Static sortCells

  • Sorts the given cells according to the order in the cell hierarchy. Ascending is optional and defaults to true.

    static

    Parameters

    • cells: mxCell[]
    • Optional ascending: boolean

    Returns mxCell[]

Static submit

  • submit(url: string, params: any, doc: Document, target: any): mxXmlRequest
  • Submits the given parameters to the specified URL using mxXmlRequest.simulate and returns the mxXmlRequest. Make sure to use encodeURIComponent for the parameter values.

    Parameters

    • url: string

      URL to get the data from.

    • params: any

      Parameters for the form.

    • doc: Document

      Document to create the form in.

    • target: any

      Target to send the form result to.

    Returns mxXmlRequest

Static toDegree

  • toDegree(rad: number): number
  • Converts the given radians to degree.

    Parameters

    • rad: number

    Returns number

Static toRadians

  • toRadians(deg: number): number
  • Converts the given degree to radians.

    Parameters

    • deg: number

    Returns number

Static toString

  • toString(obj: {}): string
  • Returns a textual representation of the specified object.

    Parameters

    • obj: {}

      Object to return the string representation for.

    Returns string

Static trim

  • trim(str: string, chars: string): null | string
  • Strips all whitespaces from both end of the string. Without the second parameter, Javascript function will trim these characters:

    • " " (ASCII 32 (0x20)), an ordinary space
    • "\t" (ASCII 9 (0x09)), a tab
    • "\n" (ASCII 10 (0x0A)), a new line (line feed)
    • "\r" (ASCII 13 (0x0D)), a carriage return
    • "\0" (ASCII 0 (0x00)), the NUL-byte
    • "\x0B" (ASCII 11 (0x0B)), a vertical tab

    Parameters

    • str: string
    • chars: string

    Returns null | string

Static write

  • write(parent: Node, text: string): Node
  • Creates a text node for the given string and appends it to the given parent. Returns the text node.

    Parameters

    • parent: Node

      DOM node to append the text node to.

    • text: string

      String representing the text to be added.

    Returns Node

Static writeln

  • writeln(parent: Node, text: string): Node
  • Creates a text node for the given string and appends it to the given parent with an additional linefeed. Returns the text node.

    Parameters

    • parent: Node

      DOM node to append the text node to.

    • text: string

      String representing the text to be added.

    Returns Node

Generated using TypeDoc