How to use the @antv/x6.util.getBoolean function in @antv/x6

To help you get started, we’ve selected a few @antv/x6 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github antvis / x6 / examples / x6-example-drawio / src / pages / graph / commands / util.ts View on Github external
cells.forEach(cell => {
        const state = graph.view.getState(cell)
        if (state != null) {
          let label = graph.getLabel(state.cell)
          if (typeof label === 'string') {
            if (graph.isHtmlLabel(cell)) {
              if (util.getBoolean(state.style, 'nl2Br', true)) {
                label = label.replace(/\n/g, '').replace(//g, '\n')
                // Removes HTML tags
                const temp = document.createElement('div')
                temp.innerHTML = label
                label = util.extractTextWithWhitespace(temp.childNodes as any)
              }
            } else {
              // Converts HTML tags to text
              label = util.escape(label)
              if (util.getBoolean(state.style, 'nl2Br', true)) {
                // Converts newlines in plain text to breaks in HTML
                // to match the plain text output
                label = label.replace(/\n/g, '<br>')
              }
            }
            graph.updateLabel(cell, label)
github antvis / x6 / examples / x6-example-drawio / src / pages / graph / shape / tape.ts View on Github external
getLabelMargins(rect: Rectangle) {
    if (util.getBoolean(this.style, 'boundedLbl', false)) {
      const w = rect.width
      const h = rect.height

      if (
        this.direction == null ||
        this.direction === 'east' ||
        this.direction === 'west'
      ) {
        const dy = getFactor(this.style, this.factor, h)
        return new Rectangle(rect.x, rect.y + dy, w, h - 2 * dy)
      }

      const dx = getFactor(this.style, this.factor, w)

      return new Rectangle(rect.x + dx, rect.y, w - 2 * dx, h)
    }
github antvis / x6 / examples / x6-example-drawio / src / pages / graph / shape / document.ts View on Github external
getLabelMargins(rect: Rectangle) {
    if (util.getBoolean(this.style, 'boundedLbl', false)) {
      const dy = getFactor(this.style, this.factor, rect.height)
      return new Rectangle(0, 0, 0, dy)
    }

    return null
  }
github antvis / x6 / examples / x6-example-drawio / src / pages / graph / shape / cube.ts View on Github external
getLabelMargins(rect: Rectangle) {
    if (util.getBoolean(this.style, 'boundedLbl', false)) {
      const s = util.getNumber(this.style, 'factor', this.factor) * this.scale
      return new Rectangle(s, s, 0, 0)
    }

    return null
  }