fix(modeling): use stroke color for labels when setting color (#1655)
Closes #1653
This commit is contained in:
parent
7478388070
commit
5eaf74e91b
|
@ -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 {
|
||||
|
|
|
@ -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"/>
|
||||
|
|
|
@ -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);
|
||||
}));
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue