Skip to content

Commit

Permalink
chore(types): correct renderer types
Browse files Browse the repository at this point in the history
  • Loading branch information
nikku committed Sep 9, 2024
1 parent da59558 commit c840a9f
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions lib/draw/BpmnRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ var DEFAULT_OPACITY = 0.95,

/**
* @typedef { import('../model/Types').Element } Element
* @typedef { import('../model/Types').Shape } Shape
* @typedef { import('../model/Types').Connection } Connection
*/

/**
Expand Down Expand Up @@ -2266,57 +2268,57 @@ BpmnRenderer.prototype.canRender = function(element) {
* Draw shape into parentGfx.
*
* @param {SVGElement} parentGfx
* @param {Element} element
* @param {Shape} shape
* @param {Attrs} [attrs]
*
* @return {SVGElement} mainGfx
*/
BpmnRenderer.prototype.drawShape = function(parentGfx, element, attrs = {}) {
var { type } = element;
BpmnRenderer.prototype.drawShape = function(parentGfx, shape, attrs = {}) {
var { type } = shape;

var handler = this._renderer(type);

return handler(parentGfx, element, attrs);
return handler(parentGfx, shape, attrs);
};

/**
* Draw connection into parentGfx.
*
* @param {SVGElement} parentGfx
* @param {Element} element
* @param {Connection} connection
* @param {Attrs} [attrs]
*
* @return {SVGElement} mainGfx
*/
BpmnRenderer.prototype.drawConnection = function(parentGfx, element, attrs = {}) {
var { type } = element;
BpmnRenderer.prototype.drawConnection = function(parentGfx, connection, attrs = {}) {
var { type } = connection;

var handler = this._renderer(type);

return handler(parentGfx, element, attrs);
return handler(parentGfx, connection, attrs);
};

/**
* Get shape path.
*
* @param {Element} element
* @param {Shape} shape
*
* @return {string} path
*/
BpmnRenderer.prototype.getShapePath = function(element) {
if (is(element, 'bpmn:Event')) {
return getCirclePath(element);
BpmnRenderer.prototype.getShapePath = function(shape) {
if (is(shape, 'bpmn:Event')) {
return getCirclePath(shape);
}

if (is(element, 'bpmn:Activity')) {
return getRoundRectPath(element, TASK_BORDER_RADIUS);
if (is(shape, 'bpmn:Activity')) {
return getRoundRectPath(shape, TASK_BORDER_RADIUS);
}

if (is(element, 'bpmn:Gateway')) {
return getDiamondPath(element);
if (is(shape, 'bpmn:Gateway')) {
return getDiamondPath(shape);
}

return getRectPath(element);
return getRectPath(shape);
};

/**
Expand Down

0 comments on commit c840a9f

Please sign in to comment.