fix(draw): do not create multiple markers per (type-stoke-fill)
This commit is contained in:
parent
e2211766eb
commit
27d65a6503
|
@ -5,7 +5,6 @@ var inherits = require('inherits'),
|
|||
assign = require('lodash/object/assign'),
|
||||
forEach = require('lodash/collection/forEach'),
|
||||
every = require('lodash/collection/every'),
|
||||
includes = require('lodash/collection/includes'),
|
||||
some = require('lodash/collection/some');
|
||||
|
||||
var BaseRenderer = require('diagram-js/lib/draw/BaseRenderer'),
|
||||
|
@ -103,7 +102,7 @@ function BpmnRenderer(eventBus, styles, pathMap, canvas, priority) {
|
|||
function marker(type, fill, stroke) {
|
||||
var id = type + '-' + fill + '-' + stroke;
|
||||
|
||||
if (!includes(markers, id)) {
|
||||
if (!markers[id]) {
|
||||
createMarker(type, fill, stroke);
|
||||
}
|
||||
|
||||
|
@ -1701,7 +1700,7 @@ function BpmnRenderer(eventBus, styles, pathMap, canvas, priority) {
|
|||
function attachTaskMarkers(parentGfx, element, taskMarkers) {
|
||||
var obj = getSemantic(element);
|
||||
|
||||
var subprocess = includes(taskMarkers, 'SubProcessMarker');
|
||||
var subprocess = taskMarkers && taskMarkers.indexOf('SubProcessMarker') !== -1;
|
||||
var position;
|
||||
|
||||
if (subprocess) {
|
||||
|
|
|
@ -221,6 +221,27 @@ describe('draw - bpmn renderer', function() {
|
|||
});
|
||||
|
||||
|
||||
it('should properly render colored markers', function(done) {
|
||||
|
||||
var xml = require('../../fixtures/bpmn/draw/colors.bpmn');
|
||||
bootstrapViewer(xml)(function(err) {
|
||||
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
|
||||
inject(function(canvas) {
|
||||
var svg = canvas._svg;
|
||||
var markers = svg.querySelectorAll('marker');
|
||||
|
||||
expect(markers).to.have.length(5);
|
||||
})();
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('path', function() {
|
||||
|
||||
var diagramXML = require('../../fixtures/bpmn/simple-cropping.bpmn');
|
||||
|
|
Loading…
Reference in New Issue