chore(draw/BpmnRenderer): make instance of ids global

Closes #716
This commit is contained in:
Philipp Fromme 2017-10-04 10:36:45 +02:00 committed by Nico Rehwaldt
parent a74c87af3f
commit 28871bcdaf
1 changed files with 6 additions and 5 deletions

View File

@ -7,8 +7,6 @@ var inherits = require('inherits'),
every = require('lodash/collection/every'), every = require('lodash/collection/every'),
some = require('lodash/collection/some'); some = require('lodash/collection/some');
var Ids = require('ids');
var BaseRenderer = require('diagram-js/lib/draw/BaseRenderer'), var BaseRenderer = require('diagram-js/lib/draw/BaseRenderer'),
TextUtil = require('diagram-js/lib/util/Text'), TextUtil = require('diagram-js/lib/util/Text'),
DiUtil = require('../util/DiUtil'); DiUtil = require('../util/DiUtil');
@ -32,6 +30,9 @@ var rotate = require('diagram-js/lib/util/SvgTransformUtil').rotate,
transform = require('diagram-js/lib/util/SvgTransformUtil').transform, transform = require('diagram-js/lib/util/SvgTransformUtil').transform,
translate = require('diagram-js/lib/util/SvgTransformUtil').translate; translate = require('diagram-js/lib/util/SvgTransformUtil').translate;
var Ids = require('ids'),
RENDERER_IDS = new Ids();
var TASK_BORDER_RADIUS = 10; var TASK_BORDER_RADIUS = 10;
var INNER_OUTER_DIST = 3; var INNER_OUTER_DIST = 3;
@ -45,7 +46,7 @@ function BpmnRenderer(eventBus, styles, pathMap, canvas, priority) {
BaseRenderer.call(this, eventBus, priority); BaseRenderer.call(this, eventBus, priority);
var randomId = new Ids().next(); var rendererId = RENDERER_IDS.next();
var textUtil = new TextUtil({ var textUtil = new TextUtil({
style: LABEL_STYLE, style: LABEL_STYLE,
@ -104,7 +105,7 @@ function BpmnRenderer(eventBus, styles, pathMap, canvas, priority) {
} }
function marker(type, fill, stroke) { function marker(type, fill, stroke) {
var id = type + '-' + fill + '-' + stroke + '-' + randomId; var id = type + '-' + fill + '-' + stroke + '-' + rendererId;
if (!markers[id]) { if (!markers[id]) {
createMarker(type, fill, stroke); createMarker(type, fill, stroke);
@ -114,7 +115,7 @@ function BpmnRenderer(eventBus, styles, pathMap, canvas, priority) {
} }
function createMarker(type, fill, stroke) { function createMarker(type, fill, stroke) {
var id = type + '-' + fill + '-' + stroke + '-' + randomId; var id = type + '-' + fill + '-' + stroke + '-' + rendererId;
if (type === 'sequenceflow-end') { if (type === 'sequenceflow-end') {
var sequenceflowEnd = svgCreate('path'); var sequenceflowEnd = svgCreate('path');