How to use the bpmn-js/lib/util/LabelUtil.isLabel function in bpmn-js

To help you get started, we’ve selected a few bpmn-js 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 zeebe-io / zeebe-modeler / client / src / app / tabs / bpmn / custom / CustomRules.js View on Github external
}

    // disallow appending as boundary event
    if (source) {
      return false;
    }

    // only (re-)attach one element at a time
    if (elements.length !== 1) {
      return false;
    }

    const element = elements[0];

    // do not attach labels
    if (isLabel(element)) {
      return false;
    }

    // only handle boundary events
    if (!isBoundaryCandidate(element)) {
      return false;
    }

    // allow default move operation
    if (!target) {
      return true;
    }

    // disallow drop on event sub processes
    if (isEventSubProcess(target)) {
      return false;
github WPS / domain-story-modeler / app / domain-story-modeler / features / labeling / DSLabelEditingProvider.js View on Github external
x: mid.x - width / 2,
      y: bbox.y - paddingTop
    });

    assign(style, {
      fontSize: externalFontSize + 'px',
      lineHeight: externalLineHeight,
      paddingTop: paddingTop + 'px',
      paddingBottom: paddingBottom + 'px'
    });
  }

  // external label not yet created
  if (isLabelExternal(target)
    && !hasExternalLabel(target)
    && !isLabel(target)) {

    let externalLabelMid = getExternalLabelMid(element);

    let absoluteBBox = canvas.getAbsoluteBBox({
      x: externalLabelMid.x,
      y: externalLabelMid.y,
      width: 0,
      height: 0
    });

    let height = externalFontSize + paddingTop + paddingBottom;

    assign(bounds, {
      width: width,
      height: height,
      x: absoluteBBox.x - width / 2,
github WPS / domain-story-modeler / app / domain-story-modeler / features / labeling / DSUpdateLabelHandler.js View on Github external
this.preExecute = function(ctx) {
      var element = ctx.element,
          businessObject = element.businessObject,
          newLabel = ctx.newLabel,
          newNumber=ctx.newNumber;

      if (!isLabel(element)
        && isLabelExternal(element)
        && !hasExternalLabel(element)
        && (newLabel !== '' || newNumber!=='')) {

        // create label
        var paddingTop = 7;

        var labelCenter = getExternalLabelMid(element);

        labelCenter = {
          x: labelCenter.x,
          y: labelCenter.y + paddingTop
        };

        modeling.createLabel(element, labelCenter, {
          id: businessObject.id + '_label',
github zeebe-io / zeebe-modeler / client / src / app / tabs / bpmn / custom / CustomRules.js View on Github external
function isBoundaryEvent(element) {
      return !isLabel(element) && is(element, 'bpmn:BoundaryEvent');
    }
github bptlab / chor-js / lib / util / DiagramWalkerUtil.js View on Github external
export function isAnyAndNotLabel(shape, var_args) {
  if (isLabel(shape)) {
    return false;
  }
  for (let i = 1; i < arguments.length; i++) {
    if (is(shape, arguments[i])) {
      return true;
    }
  }
  return false;
}