fix(modeling): use stroke color for labels when setting color (#1655)

Closes #1653
This commit is contained in:
Beatriz Mendes 2022-05-19 20:23:05 +02:00 committed by GitHub
parent 7478388070
commit 5eaf74e91b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View File

@ -9,6 +9,10 @@ import {
getDi
} from '../../../util/ModelUtil';
import {
isLabel
} from '../../../util/LabelUtil';
var DEFAULT_COLORS = {
fill: undefined,
stroke: undefined
@ -66,14 +70,14 @@ SetColorHandler.prototype.postExecute = function(context) {
// TODO @barmac: remove once we drop bpmn.io properties
ensureLegacySupport(assignedDi);
if (element.labelTarget) {
if (isLabel(element)) {
// set label colors as bpmndi:BPMNLabel#color
self._commandStack.execute('element.updateModdleProperties', {
element: element,
moddleElement: getDi(element).label,
properties: {
color: di['background-color']
color: di['border-color']
}
});
} else {

View File

@ -28,6 +28,9 @@
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds height="36.0" width="36.0" x="352.0" y="242.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds x="345" y="285" width="55" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_Task_2" bpmnElement="Task_1">
<dc:Bounds height="80.0" width="100.0" x="420.0" y="220.0"/>
@ -38,6 +41,9 @@
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_2" bpmnElement="EndEvent_1">
<dc:Bounds height="36.0" width="36.0" x="650.0" y="212.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds x="645" y="255" width="51" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_SubProcess_2" targetElement="_BPMNShape_EndEvent_2">
<di:waypoint xsi:type="dc:Point" x="600.0" y="230.0"/>

View File

@ -152,13 +152,13 @@ describe('features/modeling - set color', function() {
flowDi = getDi(flowShape);
// when
modeling.setColor(flowLabel, { stroke: 'FUCHSIA', fill: 'FUCHSIA' });
modeling.setColor(flowLabel, { stroke: 'YELLOW', fill: 'FUCHSIA' });
// then
expect(flowDi.get('border-color')).not.to.exist;
expect(flowDi.get('background-color')).not.to.exist;
expect(flowDi.label.get('color')).to.eql(FUCHSIA_HEX);
expect(flowDi.label.get('color')).to.eql(YELLOW_HEX);
}));