How to use the diagram-js/lib/draw/BaseRenderer.call function in diagram-js

To help you get started, we’ve selected a few diagram-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 bptlab / chor-js / lib / draw / ChoreoRenderer.js View on Github external
export default function ChoreoRenderer(eventBus, styles, textRenderer, pathMap) {

  BaseRenderer.call(this, eventBus, 2000); // Because of the priority this does not work with the injector

  function getLabel(caption, options) {
    var text = textRenderer.createText(caption || '', options);
    svgClasses(text).add('djs-label');
    return text;
  }

  function getBoxedLabel(caption, box, align) {
    let label = getLabel(caption, {
      box: box,
      align: align,
      padding: align === 'center-middle' ? 0 : 5,
      style: {
        fill: 'black'
      }
    });
github WPS / domain-story-modeler / app / domain-story-modeler / language / DomainStoryRenderer.js View on Github external
export default function DomainStoryRenderer(eventBus, styles, canvas, textRenderer, pathMap, commandStack) {

  BaseRenderer.call(this, eventBus, 2000);

  let rendererId = RENDERER_IDS.next();
  let markers = {};
  let computeStyle = styles.computeStyle;

  // generate the automatic Number for an activity origintaing from an actor
  function generateActivityNumber(parentGfx, element, box) {

    // whenever we want to edit an activity, it gets redrawn as a new object
    // and the custom information is lost,
    // so we stash it before the editing occurs and set the value here

    let numberStash = getNumberStash();
    let semantic = element.businessObject;

    if (numberStash.use) {
github bpmn-io / bpmn-js / test / integration / custom-elements / CustomRenderer.js View on Github external
export default function CustomRenderer(eventBus, styles) {

  BaseRenderer.call(this, eventBus, 2000);

  this._styles = styles;

  var self = this;

  var computeStyle = styles.computeStyle;

  this.handlers = {
    'custom:triangle': function(parentGfx, element) {
      return self.drawTriangle(parentGfx, element.width);
    },
    'custom:circle': function(parentGfx, element, attrs) {
      return self.drawCircle(parentGfx, element.width, element.height, attrs);
    }
  };
github bpmn-io / bpmn-js / lib / draw / BpmnRenderer.js View on Github external
export default function BpmnRenderer(
    config, eventBus, styles, pathMap,
    canvas, textRenderer, priority) {

  BaseRenderer.call(this, eventBus, priority);

  var defaultFillColor = config && config.defaultFillColor,
      defaultStrokeColor = config && config.defaultStrokeColor;

  var rendererId = RENDERER_IDS.next();

  var markers = {};

  var computeStyle = styles.computeStyle;

  function addMarker(id, options) {
    var attrs = assign({
      fill: 'black',
      strokeWidth: 1,
      strokeLinecap: 'round',
      strokeDasharray: 'none'
github bpmn-io / bpmn-js-nyan / lib / nyan / draw / NyanRenderer.js View on Github external
export default function NyanRender(eventBus) {
  BaseRenderer.call(this, eventBus, 1500);

  this.canRender = function(element) {
    return is(element, 'bpmn:ServiceTask');
  };


  this.drawShape = function(parent, shape) {
    var url = Cat.dataURL;

    var catGfx = svgCreate('image', {
      x: 0,
      y: 0,
      width: shape.width,
      height: shape.height,
      href: url
    });
github bpmn-io / dmn-js / packages / dmn-js-drd / src / draw / DrdRenderer.js View on Github external
export default function DrdRenderer(eventBus, pathMap, styles) {

  BaseRenderer.call(this, eventBus);

  var LABEL_STYLE = {
    fontFamily: 'Arial, sans-serif',
    fontSize: '12px'
  };

  var textUtil = new TextUtil({
    style: LABEL_STYLE,
    size: { width: 100 }
  });

  var markers = {};

  function addMarker(id, element) {
    markers[id] = element;
  }
github bpmn-io / bpmn-js-examples / custom-elements / app / custom-modeler / custom / CustomRenderer.js View on Github external
export default function CustomRenderer(eventBus, styles) {

  BaseRenderer.call(this, eventBus, 2000);

  var computeStyle = styles.computeStyle;

  this.drawTriangle = function(p, side) {
    var halfSide = side / 2,
        points,
        attrs;

    points = [ halfSide, 0, side, side, 0, side ];

    attrs = computeStyle(attrs, {
      stroke: '#3CAA82',
      strokeWidth: 2,
      fill: '#3CAA82'
    });
github bpmn-io / bpmn-js-example-custom-elements / app / emoji / EmojiRenderer.js View on Github external
export default function EmojiRenderer(eventBus) {
  BaseRenderer.call(this, eventBus, 2000);
}
github camunda-consulting / code / snippets / bpmnjs-custom-modeler / app / custom-modeler / custom / CustomRenderer.js View on Github external
function CustomRenderer(eventBus, styles) {

  BaseRenderer.call(this, eventBus, 2000);

  var computeStyle = styles.computeStyle;

  this.drawCustomSoftware = function (p, width, height, r, offset, attrs) {
    //TODO for now nothing fancy, just task
    offset = offset || 0;

    attrs = computeStyle(attrs, {
      stroke: 'black',
      strokeWidth: 2,
      fill: 'white'
    });

    return p.rect(offset, offset, width - offset * 2, height - offset * 2, 10).attr(attrs);
  };
github Activiti / activiti-modeling-app / src / app / process-editor / services / bpmn-js / renderers / decision-table.renderer.ts View on Github external
export function DecisionTableRender(eventBus, bpmnRenderer) {
  BaseRenderer.call(this, eventBus, 1500);

  this.canRender = function(element) {
    return is(element, 'bpmn:ServiceTask') && element.businessObject.get('implementation') === DECISION_TASK_IMPLEMENTATION;
  };

  this.drawShape = function(parentGfx, element) {
    return bpmnRenderer.handlers['bpmn:BusinessRuleTask'](parentGfx, element);
  };
}