Comparing version 0.0.3 to 0.1.0
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ # Project Setup |
@@ -0,0 +0,0 @@ (function(BpmnJS, $) { |
@@ -0,0 +0,0 @@ module.exports = function(grunt) { |
@@ -0,0 +0,0 @@ var _ = require('lodash'); |
@@ -0,0 +0,0 @@ var Module = require('didi').Module; |
@@ -128,2 +128,42 @@ var bpmnModule = require('../di').defaultModule; | ||
})); | ||
addMarker('conditional-flow-marker', | ||
paper | ||
.path('M 0,0 7.089123,3.1832974 0.00383366,6.1129516 -7.0814464,3.1832966 z') | ||
.attr({ | ||
'fill': 'White', | ||
'stroke': 'Black' | ||
}) | ||
.marker(0, 0, 15, 15, 0, 0) | ||
.attr({ | ||
markerUnits: 'strokeWidth', | ||
markerWidth: 14.296, | ||
markerHeight: 7.238, | ||
orient: 'auto', | ||
overflow: 'visible', | ||
'stroke-width': 1, | ||
'stroke-dasharray': '1,0', | ||
'refX': -8, | ||
'refY': 3.15 | ||
})); | ||
addMarker('conditional-default-flow-marker', | ||
paper | ||
.path('M 3,0 10,11') | ||
.attr({ | ||
'fill': 'Black', | ||
'stroke': 'Black' | ||
}) | ||
.marker(0, 0, 15, 15, 0, 0) | ||
.attr({ | ||
markerUnits: 'strokeWidth', | ||
markerWidth: 14.296, | ||
markerHeight: 7.238, | ||
orient: 'auto', | ||
overflow: 'visible', | ||
'stroke-width': 1, | ||
'stroke-dasharray': '1,0', | ||
'refX': -4, | ||
'refY': 5.5 | ||
})); | ||
} | ||
@@ -148,6 +188,2 @@ | ||
var x, y; | ||
x = y = offset; | ||
return p.rect(offset, offset, width - offset * 2, height - offset * 2, r).attr({ | ||
@@ -188,3 +224,3 @@ 'stroke': 'Black', | ||
var path = p.path(d).attr(styles.style([ 'no-fill' ],{ | ||
'stroke-width': 2, | ||
'stroke-width': 1, | ||
'stroke': 'Black', | ||
@@ -209,4 +245,2 @@ 'fill': fillColor | ||
var path; | ||
var event = bpmnRegistry.getSemantic(data); | ||
@@ -232,3 +266,3 @@ var isThrowing = isThrowEvent(event); | ||
if (isTypedEvent(event, 'bpmn:CancelEventDefinition') && | ||
isTypedEvent(event, 'bpmn:TerminateEventDefinition', { parallelMultiple: false })) { | ||
isTypedEvent(event, 'bpmn:TerminateEventDefinition', { parallelMultiple: false })) { | ||
return renderer('bpmn:MultipleEventDefinition')(p, data, isThrowing); | ||
@@ -238,3 +272,3 @@ } | ||
if (isTypedEvent(event, 'bpmn:CancelEventDefinition') && | ||
isTypedEvent(event, 'bpmn:TerminateEventDefinition', { parallelMultiple: true })) { | ||
isTypedEvent(event, 'bpmn:TerminateEventDefinition', { parallelMultiple: true })) { | ||
return renderer('bpmn:ParallelMultipleEventDefinition')(p, data, isThrowing); | ||
@@ -291,3 +325,2 @@ } | ||
var bbox = textBox.getBBox(); | ||
var top = -1 * data.height; | ||
@@ -300,5 +333,14 @@ textBox.transform( | ||
function createPathFromWaypoints(waypoints) { | ||
var linePathData = 'm ' + waypoints[0].x + ',' + waypoints[0].y; | ||
for (var i = 1; i < waypoints.length; i++) { | ||
linePathData += 'L' + waypoints[i].x + ',' + waypoints[i].y + ' '; | ||
} | ||
return linePathData; | ||
} | ||
var handlers = { | ||
'bpmn:Event': function(p, data) { | ||
var circle = drawCircle(p, data.width, data.height); | ||
return circle; | ||
@@ -309,2 +351,5 @@ }, | ||
if(!bpmnRegistry.getSemantic(data.id).isInterrupting) { | ||
circle.attr('stroke-dasharray', '5,2'); | ||
} | ||
renderEventContent(data, p); | ||
@@ -612,20 +657,250 @@ | ||
renderEmbeddedLabel(p, data, 'center-middle'); | ||
attachTaskMarkers(p, data); | ||
return rect; | ||
}, | ||
'bpmn:ServiceTask': as('bpmn:Task'), | ||
'bpmn:UserTask': as('bpmn:Task'), | ||
'bpmn:ManualTask': as('bpmn:Task'), | ||
'bpmn:SendTask': as('bpmn:Task'), | ||
'bpmn:ReceiveTask': as('bpmn:Task'), | ||
'bpmn:ScriptTask': as('bpmn:Task'), | ||
'bpmn:BusinessRuleTask': as('bpmn:Task'), | ||
'bpmn:ServiceTask': function(p, data) { | ||
var task = renderer('bpmn:Task')(p, data); | ||
var pathDataBG = pathMap.getScaledPath('TASK_TYPE_SERVICE', { | ||
abspos: { | ||
x: 12, | ||
y: 18 | ||
} | ||
}); | ||
var servicePathBG = drawPath(p, pathDataBG); | ||
servicePathBG.attr({ | ||
'stroke-width': 1, | ||
'fill': 'None' | ||
}); | ||
var fillPathData = pathMap.getScaledPath('TASK_TYPE_SERVICE_FILL', { | ||
abspos: { | ||
x: 17.2, | ||
y: 18 | ||
} | ||
}); | ||
var serviceFillPath = drawPath(p, fillPathData); | ||
serviceFillPath.attr({ | ||
'stroke-width': 0, | ||
'stroke': 'none', | ||
'fill': 'White' | ||
}); | ||
var pathData = pathMap.getScaledPath('TASK_TYPE_SERVICE', { | ||
abspos: { | ||
x: 17, | ||
y: 22 | ||
} | ||
}); | ||
var servicePath = drawPath(p, pathData); | ||
servicePath.attr({ | ||
'stroke-width': 1, | ||
'fill': 'White' | ||
}); | ||
return task; | ||
}, | ||
'bpmn:UserTask': function(p, data) { | ||
var task = renderer('bpmn:Task')(p, data); | ||
var x = 15; | ||
var y = 12; | ||
var pathData = pathMap.getScaledPath('TASK_TYPE_USER_1', { | ||
abspos: { | ||
x: x, | ||
y: y | ||
} | ||
}); | ||
var userPath = drawPath(p, pathData); | ||
userPath.attr({ | ||
'stroke-width': 0.5, | ||
'fill': 'None' | ||
}); | ||
var pathData2 = pathMap.getScaledPath('TASK_TYPE_USER_2', { | ||
abspos: { | ||
x: x, | ||
y: y | ||
} | ||
}); | ||
var userPath2 = drawPath(p, pathData2); | ||
userPath2.attr({ | ||
'stroke-width': 0.5, | ||
'fill': 'None' | ||
}); | ||
var pathData3 = pathMap.getScaledPath('TASK_TYPE_USER_3', { | ||
abspos: { | ||
x: x, | ||
y: y | ||
} | ||
}); | ||
var userPath3 = drawPath(p, pathData3); | ||
userPath3.attr({ | ||
'stroke-width': 0.5, | ||
'fill': 'Black' | ||
}); | ||
return task; | ||
}, | ||
'bpmn:ManualTask': function(p, data) { | ||
var task = renderer('bpmn:Task')(p, data); | ||
var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', { | ||
abspos: { | ||
x: 17, | ||
y: 15 | ||
} | ||
}); | ||
var userPath = drawPath(p, pathData); | ||
userPath.attr({ | ||
'stroke-width': 0.25, | ||
'fill': 'None', | ||
'stroke': 'Black' | ||
}); | ||
return task; | ||
}, | ||
'bpmn:SendTask': function(p, data) { | ||
var task = renderer('bpmn:Task')(p, data); | ||
var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', { | ||
xScaleFactor: 1, | ||
yScaleFactor: 1, | ||
containerWidth: 21, | ||
containerHeight: 14, | ||
position: { | ||
mx: 0.285, | ||
my: 0.357 | ||
} | ||
}); | ||
var sendPath = drawPath(p, pathData); | ||
sendPath.attr({ | ||
'stroke-width': 1, | ||
'fill': 'Black', | ||
'stroke': 'White' | ||
}); | ||
return task; | ||
}, | ||
'bpmn:ReceiveTask' : function(p, data) { | ||
var task = renderer('bpmn:Task')(p, data); | ||
var pathData; | ||
if(!!bpmnRegistry.getSemantic(data.id).instantiate) { | ||
drawCircle(p, 28, 28, 20 * 0.22); | ||
pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', { | ||
abspos: { | ||
x: 7.77, | ||
y: 9.52 | ||
} | ||
}); | ||
} else { | ||
pathData = pathMap.getScaledPath('TASK_TYPE_SEND', { | ||
xScaleFactor: 0.9, | ||
yScaleFactor: 0.9, | ||
containerWidth: 21, | ||
containerHeight: 14, | ||
position: { | ||
mx: 0.3, | ||
my: 0.4 | ||
} | ||
}); | ||
} | ||
var sendPath = drawPath(p, pathData); | ||
sendPath.attr({ | ||
'stroke-width': 1 | ||
}); | ||
return task; | ||
}, | ||
'bpmn:ScriptTask': function(p, data) { | ||
var task = renderer('bpmn:Task')(p, data); | ||
var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', { | ||
abspos: { | ||
x: 15, | ||
y: 20 | ||
} | ||
}); | ||
var scriptPath = drawPath(p, pathData); | ||
scriptPath.attr({ | ||
'stroke-width': 1 | ||
}); | ||
return task; | ||
}, | ||
'bpmn:BusinessRuleTask': function(p, data) { | ||
var task = renderer('bpmn:Task')(p, data); | ||
var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', { | ||
abspos: { | ||
x: 8, | ||
y: 8 | ||
} | ||
}); | ||
var businessHeaderPath = drawPath(p, headerPathData); | ||
businessHeaderPath.attr({ | ||
'stroke-width': 1, | ||
'fill': 'AAA' | ||
}); | ||
var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', { | ||
abspos: { | ||
x: 8, | ||
y: 8 | ||
} | ||
}); | ||
var businessPath = drawPath(p, headerData); | ||
businessPath.attr({ | ||
'stroke-width': 1 | ||
}); | ||
return task; | ||
}, | ||
'bpmn:SubProcess': function(p, data) { | ||
var rect = renderer('bpmn:Activity')(p, data); | ||
var isEventSubProcess = !!(bpmnRegistry.getSemantic(data.id).triggeredByEvent); | ||
if(isEventSubProcess) { | ||
rect.attr({ | ||
'stroke-dasharray': '1,2', | ||
'stroke-width': 1 | ||
}); | ||
} | ||
var di = bpmnRegistry.getDi(data); | ||
renderEmbeddedLabel(p, data, di.isExpanded ? 'center-top' : 'center-middle'); | ||
if(di.isExpanded) { | ||
attachTaskMarkers(p, data); | ||
} else { | ||
attachTaskMarkers(p, data, ['SubProcessMarker']); | ||
} | ||
return rect; | ||
}, | ||
'bpmn:AdHocSubProcess': as('bpmn:SubProcess'), | ||
'bpmn:AdHocSubProcess': function(p, data) { | ||
var process = renderer('bpmn:SubProcess')(p, data); | ||
return process; | ||
}, | ||
'bpmn:Transaction': function(p, data) { | ||
@@ -666,2 +941,8 @@ var outer = renderer('bpmn:SubProcess')(p, data); | ||
var participantMultiplicity = !!(bpmnRegistry.getSemantic(data.id).participantMultiplicity); | ||
if(participantMultiplicity) { | ||
renderer('ParticipantMultiplicityMarker')(p, data); | ||
} | ||
return lane; | ||
@@ -672,2 +953,4 @@ }, | ||
rect.attr('fill', 'None'); | ||
if(bpmnRegistry.getSemantic(data.id).$type === 'bpmn:Lane') { | ||
@@ -832,2 +1115,30 @@ var text = bpmnRegistry.getSemantic(data.id).name; | ||
var sequence = bpmnRegistry.getSemantic(data.id); | ||
// Conditional Flow Marker | ||
if(!!sequence.conditionExpression) { | ||
polyline.attr({ | ||
'marker-start': marker('conditional-flow-marker') | ||
}); | ||
} | ||
// Default Marker | ||
var srcRef = sequence.sourceRef; | ||
if(!!srcRef) { | ||
var source = bpmnRegistry.getSemantic(srcRef); | ||
if(!!source && | ||
(source.$type === 'bpmn:InclusiveGateway' || | ||
source.$type === 'bpmn:ExclusiveGateway')) { | ||
if(!!source.default && | ||
source.default.$type === 'bpmn:SequenceFlow' && | ||
source.default.id === data.id) { | ||
polyline.attr({ | ||
'marker-start': marker('conditional-default-flow-marker') | ||
}); | ||
} | ||
console.log(source); | ||
} | ||
} | ||
return polyline.attr({ | ||
@@ -864,5 +1175,28 @@ 'marker-end': marker('sequenceflow-end') | ||
'bpmn:MessageFlow': function(p, data) { | ||
var polyline = drawLine(p, data.waypoints); | ||
return polyline.attr({ | ||
var flowDi = bpmnRegistry.getDi(data); | ||
var linePathData = createPathFromWaypoints(data.waypoints); | ||
var flowPath = drawPath(p, linePathData); | ||
if(!!flowDi.messageVisibleKind) { | ||
var midPoint = flowPath.getPointAtLength(flowPath.getTotalLength() / 2); | ||
var markerPathData = pathMap.getScaledPath('MESSAGE_FLOW_MARKER', { | ||
abspos: { | ||
x: midPoint.x, | ||
y: midPoint.y | ||
} | ||
}); | ||
var messageMarkerPath = drawPath(p, markerPathData); | ||
var fill = flowDi.messageVisibleKind === 'initiating' ? 'White' : '#888'; | ||
var stroke = flowDi.messageVisibleKind === 'initiating' ? 'Black' : 'White'; | ||
messageMarkerPath.attr({ | ||
'stroke-width': 1, | ||
'fill': fill, | ||
'stroke': stroke | ||
}); | ||
} | ||
return flowPath.attr({ | ||
'marker-end': marker('messageflow-end'), | ||
@@ -991,3 +1325,3 @@ 'marker-start': marker('messageflow-start'), | ||
}); | ||
var textPath = drawPath(p, textPathData); | ||
drawPath(p, textPathData); | ||
@@ -998,6 +1332,164 @@ var text = bpmnRegistry.getSemantic(data.id).text || ''; | ||
return label; | ||
}, | ||
'ParticipantMultiplicityMarker': function(p, data) { | ||
var subProcessPath = pathMap.getScaledPath('MARKER_PARALLEL', { | ||
xScaleFactor: 1, | ||
yScaleFactor: 1, | ||
containerWidth: data.width, | ||
containerHeight: data.height, | ||
position: { | ||
mx: ((data.width / 2) / data.width), | ||
my: (data.height - 15) / data.height | ||
} | ||
}); | ||
var pmm = drawPath(p, subProcessPath); | ||
pmm.attr(''); | ||
}, | ||
'SubProcessMarker': function(p, data) { | ||
var markerRect = drawRect(p, 14, 14, 0); | ||
// Process marker is placed in the middle of the box | ||
// therefore fixed values can be used here | ||
markerRect.transform('translate(' + (data.width / 2 - 7.5) + ',' + (data.height - 20) + ')'); | ||
markerRect.attr({ | ||
'stroke-width': 1 | ||
}); | ||
var subProcessPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', { | ||
xScaleFactor: 1.5, | ||
yScaleFactor: 1.5, | ||
containerWidth: data.width, | ||
containerHeight: data.height, | ||
position: { | ||
mx: (data.width / 2 - 7.5) / data.width, | ||
my: (data.height - 20) / data.height | ||
} | ||
}); | ||
drawPath(p, subProcessPath); | ||
}, | ||
'ParallelMarker': function(p, data, position) { | ||
var subProcessPath = pathMap.getScaledPath('MARKER_PARALLEL', { | ||
xScaleFactor: 1, | ||
yScaleFactor: 1, | ||
containerWidth: data.width, | ||
containerHeight: data.height, | ||
position: { | ||
mx: ((data.width / 2 + position.parallel) / data.width), | ||
my: (data.height - 20) / data.height | ||
} | ||
}); | ||
drawPath(p, subProcessPath); | ||
}, | ||
'SequentialMarker': function(p, data, position) { | ||
var sequentialPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', { | ||
xScaleFactor: 1, | ||
yScaleFactor: 1, | ||
containerWidth: data.width, | ||
containerHeight: data.height, | ||
position: { | ||
mx: ((data.width / 2 + position.seq) / data.width), | ||
my: (data.height - 19) / data.height | ||
} | ||
}); | ||
drawPath(p, sequentialPath); | ||
}, | ||
'CompensationMarker': function(p, data, position) { | ||
var compensationPath = pathMap.getScaledPath('MARKER_COMPENSATION', { | ||
xScaleFactor: 1, | ||
yScaleFactor: 1, | ||
containerWidth: data.width, | ||
containerHeight: data.height, | ||
position: { | ||
mx: ((data.width / 2 + position.compensation) / data.width), | ||
my: (data.height - 13) / data.height | ||
} | ||
}); | ||
drawPath(p, compensationPath); | ||
}, | ||
'LoopMarker': function(p, data, position) { | ||
var loopPath = pathMap.getScaledPath('MARKER_LOOP', { | ||
xScaleFactor: 1, | ||
yScaleFactor: 1, | ||
containerWidth: data.width, | ||
containerHeight: data.height, | ||
position: { | ||
mx: ((data.width / 2 + position.loop) / data.width), | ||
my: (data.height - 7) / data.height | ||
} | ||
}); | ||
var marker = drawPath(p, loopPath); | ||
marker.attr({ | ||
'stroke-width': 1, | ||
'fill': 'None', | ||
'stroke-linecap':'round', | ||
'stroke-miterlimit':0.5 | ||
}); | ||
}, | ||
'AdhocMarker': function(p, data, position) { | ||
console.log(data); | ||
var loopPath = pathMap.getScaledPath('MARKER_ADHOC', { | ||
xScaleFactor: 1, | ||
yScaleFactor: 1, | ||
containerWidth: data.width, | ||
containerHeight: data.height, | ||
position: { | ||
mx: ((data.width / 2 + position.adhoc) / data.width), | ||
my: (data.height - 15) / data.height | ||
} | ||
}); | ||
var marker = drawPath(p, loopPath); | ||
marker.attr({ | ||
'stroke-width': 1, | ||
'fill': 'Black' | ||
}); | ||
} | ||
}; | ||
function attachTaskMarkers(p, data, taskMarkers) { | ||
var obj = bpmnRegistry.getSemantic(data.id); | ||
var subprocess = _.contains(taskMarkers, 'SubProcessMarker'); | ||
var position; | ||
if(subprocess) { | ||
position = { | ||
seq: -21, | ||
parallel: -22, | ||
compensation: -42, | ||
loop: -18, | ||
adhoc: 10 | ||
}; | ||
} else { | ||
position = { | ||
seq: -3, | ||
parallel: -6, | ||
compensation: -27, | ||
loop: 0, | ||
adhoc: 10 | ||
}; | ||
} | ||
_.forEach(taskMarkers, function(marker) { | ||
renderer(marker)(p, data, position); | ||
}); | ||
if(obj.$type === 'bpmn:AdHocSubProcess') { | ||
renderer('AdhocMarker')(p, data, position); | ||
} | ||
if(obj.loopCharacteristics && obj.loopCharacteristics.isSequential === undefined) { | ||
renderer('LoopMarker')(p, data, position); | ||
return; | ||
} | ||
if(obj.loopCharacteristics && | ||
obj.loopCharacteristics.isSequential !== undefined && | ||
!obj.loopCharacteristics.isSequential) { | ||
renderer('ParallelMarker')(p, data, position); | ||
} | ||
if(obj.loopCharacteristics && !!obj.loopCharacteristics.isSequential) { | ||
renderer('SequentialMarker')(p, data, position); | ||
} | ||
if(!!obj.isForCompensation) { | ||
renderer('CompensationMarker')(p, data, position); | ||
} | ||
} | ||
function drawShape(parent, data) { | ||
@@ -1043,3 +1535,3 @@ var type = data.type; | ||
return _.any(event.eventDefinitions, function(definition) { | ||
return definition.$type === eventDefinitionType && matches(definition, filter); | ||
return definition.$type === eventDefinitionType && matches(event, filter); | ||
}); | ||
@@ -1046,0 +1538,0 @@ } |
@@ -207,2 +207,136 @@ /** | ||
widthElements: [10] | ||
}, | ||
'MARKER_SUB_PROCESS': { | ||
d: 'm{mx} {my}, m 7,2 l 0,10 m -5,-5 l 10,0', | ||
height: 10, | ||
width: 10, | ||
heightElements: [], | ||
widthElements: [] | ||
}, | ||
'MARKER_PARALLEL': { | ||
d: 'm{mx} {my}, m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10', | ||
height: 10, | ||
width: 10, | ||
heightElements: [], | ||
widthElements: [] | ||
}, | ||
'MARKER_SEQUENTIAL': { | ||
d: 'm{mx} {my}, m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0', | ||
height: 10, | ||
width: 10, | ||
heightElements: [], | ||
widthElements: [] | ||
}, | ||
'MARKER_COMPENSATION': { | ||
d: 'm {mx},{my} 8,-5 0,10 z m 9,0 8,-5 0,10 z', | ||
height: 10, | ||
width: 21, | ||
heightElements: [], | ||
widthElements: [] | ||
}, | ||
'MARKER_LOOP': { | ||
d: 'm {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 ' + | ||
'-6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 ' + | ||
'0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 ' + | ||
'l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902', | ||
height: 13.9, | ||
width: 13.7, | ||
heightElements: [], | ||
widthElements: [] | ||
}, | ||
'MARKER_ADHOC': { | ||
d: 'm {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 ' + | ||
'3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 ' + | ||
'1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 ' + | ||
'-3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 ' + | ||
'-2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z', | ||
height: 4, | ||
width: 15, | ||
heightElements: [], | ||
widthElements: [] | ||
}, | ||
'TASK_TYPE_SEND': { | ||
d: 'm {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}', | ||
height: 14, | ||
width: 21, | ||
heightElements: [6, 14], | ||
widthElements: [10.5, 21] | ||
}, | ||
'TASK_TYPE_SCRIPT': { | ||
d: 'm {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 ' + | ||
'c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z ' + | ||
'm -7,-12 l 5,0 ' + | ||
'm -4.5,3 l 4.5,0 ' + | ||
'm -3,3 l 5,0' + | ||
'm -4,3 l 5,0', | ||
height: 15, | ||
width: 12.6, | ||
heightElements: [6, 14], | ||
widthElements: [10.5, 21] | ||
}, | ||
'TASK_TYPE_USER_1': { | ||
d: 'm {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 ' + | ||
'-4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 ' + | ||
'0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 ' + | ||
'h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 z' + | ||
'm -8,6 l 0,5.5 m 11,0 l 0,-5' | ||
}, | ||
'TASK_TYPE_USER_2': { | ||
d: 'm {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 ' + | ||
'-2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 ' | ||
}, | ||
'TASK_TYPE_USER_3': { | ||
d: 'm {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 ' + | ||
'4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 ' + | ||
'-4.20799998,3.36699999 -4.20699998,4.34799999 z' | ||
}, | ||
'TASK_TYPE_MANUAL': { | ||
d: 'm {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 ' + | ||
'-0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 ' + | ||
'0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 ' + | ||
'-1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 ' + | ||
'0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 ' + | ||
'-10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 ' + | ||
'2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 ' + | ||
'-0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 ' + | ||
'-1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 ' + | ||
'-0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 ' + | ||
'0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 ' + | ||
'-5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z' | ||
}, | ||
'TASK_TYPE_INSTANTIATING_SEND': { | ||
d: 'm {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6' | ||
}, | ||
'TASK_TYPE_SERVICE': { | ||
d: 'm {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 ' + | ||
'0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 ' + | ||
'-1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 ' + | ||
'v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 ' + | ||
'-0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 ' + | ||
'-1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 ' + | ||
'h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 ' + | ||
'-0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 ' + | ||
'c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 ' + | ||
'l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 ' + | ||
'0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 ' + | ||
'c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z ' + | ||
'm 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 ' + | ||
'0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 ' + | ||
'0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z' | ||
}, | ||
'TASK_TYPE_SERVICE_FILL': { | ||
d: 'm {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 ' + | ||
'0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 ' + | ||
'0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z' | ||
}, | ||
'TASK_TYPE_BUSINESS_RULE_HEADER': { | ||
d: 'm {mx},{my} 0,4 20,0 0,-4 z' | ||
}, | ||
'TASK_TYPE_BUSINESS_RULE_MAIN': { | ||
d: 'm {mx},{my} 0,12 20,0 0,-12 z' + | ||
'm 0,8 l 20,0 ' + | ||
'm -13,-4 l 0,8' | ||
}, | ||
'MESSAGE_FLOW_MARKER': { | ||
d: 'm {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6' | ||
} | ||
@@ -269,21 +403,31 @@ }; | ||
// compute the start point of the path | ||
var mx = param.containerWidth * param.position.mx; | ||
var my = param.containerHeight * param.position.my; | ||
var mx, my; | ||
// path | ||
var heightRatio = (param.containerHeight / rawPath.height) * param.yScaleFactor; | ||
var widthRatio = (param.containerWidth / rawPath.width) * param.xScaleFactor; | ||
if(!!param.abspos) { | ||
mx = param.abspos.x; | ||
my = param.abspos.y; | ||
} else { | ||
mx = param.containerWidth * param.position.mx; | ||
my = param.containerHeight * param.position.my; | ||
} | ||
var coordinates = {}; //map for the scaled coordinates | ||
if(param.position) { | ||
//Apply height ratio | ||
for(var heightIndex = 0; heightIndex < rawPath.heightElements.length; heightIndex++) { | ||
coordinates['y' + heightIndex] = rawPath.heightElements[heightIndex] * heightRatio; | ||
} | ||
// path | ||
var heightRatio = (param.containerHeight / rawPath.height) * param.yScaleFactor; | ||
var widthRatio = (param.containerWidth / rawPath.width) * param.xScaleFactor; | ||
//Apply width ratio | ||
for(var widthIndex = 0; widthIndex < rawPath.widthElements.length; widthIndex++) { | ||
coordinates['x' + widthIndex] = rawPath.widthElements[widthIndex] * widthRatio; | ||
//Apply height ratio | ||
for (var heightIndex = 0; heightIndex < rawPath.heightElements.length; heightIndex++) { | ||
coordinates['y' + heightIndex] = rawPath.heightElements[heightIndex] * heightRatio; | ||
} | ||
//Apply width ratio | ||
for (var widthIndex = 0; widthIndex < rawPath.widthElements.length; widthIndex++) { | ||
coordinates['x' + widthIndex] = rawPath.widthElements[widthIndex] * widthRatio; | ||
} | ||
} | ||
//Apply value to raw path | ||
@@ -290,0 +434,0 @@ var path = Snap.format( |
@@ -0,0 +0,0 @@ var $ = require('jquery'); |
@@ -0,0 +0,0 @@ var mousewheel = require('./mousewheel'); |
@@ -0,0 +0,0 @@ var $ = require('jquery'); |
@@ -0,0 +0,0 @@ var _ = require('lodash'); |
@@ -0,1 +1,3 @@ | ||
'use strict'; | ||
var _ = require('lodash'); | ||
@@ -17,2 +19,6 @@ | ||
function isCollapsed(element, di) { | ||
return di && !di.isExpanded; | ||
} | ||
function getWaypointsMid(waypoints) { | ||
@@ -32,2 +38,6 @@ | ||
/** | ||
* Returns the bounds of an elements label, parsed from the elements DI or | ||
* generated from its bounds. | ||
*/ | ||
function getLabelBounds(di, data) { | ||
@@ -111,2 +121,5 @@ | ||
var collapsed = isCollapsed(element, di); | ||
var hidden = parent && (parent.hidden || parent.collapsed); | ||
shape = { | ||
@@ -116,2 +129,4 @@ id: element.id, type: element.$type, | ||
width: bounds.width, height: bounds.height, | ||
collapsed: collapsed, | ||
hidden: hidden, | ||
parent: parent | ||
@@ -118,0 +133,0 @@ }; |
@@ -0,0 +0,0 @@ var Viewer = require('./Viewer'), |
@@ -0,0 +0,0 @@ var Diagram = require('diagram-js'); |
@@ -0,0 +0,0 @@ var _ = require('lodash'); |
@@ -0,0 +0,0 @@ var Diagram = require('diagram-js'), |
{ | ||
"name": "bpmn-js", | ||
"version": "0.0.3", | ||
"version": "0.1.0", | ||
"description": "A bpmn 2.0 toolkit and web modeler", | ||
@@ -70,3 +70,3 @@ "scripts": { | ||
"moddle": "~0.0.5", | ||
"diagram-js": "~0.0.3" | ||
"diagram-js": "~0.1.0" | ||
}, | ||
@@ -73,0 +73,0 @@ "peerDependencies": { |
@@ -0,0 +0,0 @@ # bpmn-js - BPMN 2.0 diagrams for the web |
@@ -0,0 +0,0 @@ module.exports = function(karma) { |
@@ -19,3 +19,46 @@ var fs = require('fs'); | ||
it('should render message flow message marker', function(done) { | ||
var xml = fs.readFileSync(__dirname + '/../../../fixtures/bpmn/render/message-marker.bpmn', 'utf8'); | ||
var renderer = new Viewer(container); | ||
renderer.importXML(xml, function(err) { | ||
done(err); | ||
}); | ||
}); | ||
it('should render pool collection marker', function(done) { | ||
var xml = fs.readFileSync(__dirname + '/../../../fixtures/bpmn/render/pools-with-collection-marker.bpmn', 'utf8'); | ||
var renderer = new Viewer(container); | ||
renderer.importXML(xml, function(err) { | ||
done(err); | ||
}); | ||
}); | ||
it('should render conditional default flows', function(done) { | ||
var xml = fs.readFileSync(__dirname + '/../../../fixtures/bpmn/render/conditional-default-flow.bpmn', 'utf8'); | ||
var renderer = new Viewer(container); | ||
renderer.importXML(xml, function(err) { | ||
done(err); | ||
}); | ||
}); | ||
it('should render conditional flows', function(done) { | ||
var xml = fs.readFileSync(__dirname + '/../../../fixtures/bpmn/render/conditional-flow.bpmn', 'utf8'); | ||
var renderer = new Viewer(container); | ||
renderer.importXML(xml, function(err) { | ||
done(err); | ||
}); | ||
}); | ||
it('should render text annotations', function(done) { | ||
@@ -32,3 +75,35 @@ | ||
it('should render task types', function(done) { | ||
var xml = fs.readFileSync(__dirname + '/../../../fixtures/bpmn/render/task-types.bpmn', 'utf8'); | ||
var renderer = new Viewer(container); | ||
renderer.importXML(xml, function(err) { | ||
done(err); | ||
}); | ||
}); | ||
it('should render activity marker', function(done) { | ||
var xml = fs.readFileSync(__dirname + '/../../../fixtures/bpmn/render/activity-marker-combination.bpmn', 'utf8'); | ||
var renderer = new Viewer(container); | ||
renderer.importXML(xml, function(err) { | ||
done(err); | ||
}); | ||
}); | ||
it('should render activity marker', function(done) { | ||
var xml = fs.readFileSync(__dirname + '/../../../fixtures/bpmn/render/activity-marker.bpmn', 'utf8'); | ||
var renderer = new Viewer(container); | ||
renderer.importXML(xml, function(err) { | ||
done(err); | ||
}); | ||
}); | ||
it('should render data objects', function(done) { | ||
@@ -35,0 +110,0 @@ |
@@ -0,1 +1,3 @@ | ||
'use strict'; | ||
var fs = require('fs'), | ||
@@ -12,4 +14,6 @@ Diagram = require('diagram-js/lib/Diagram'); | ||
var Matchers = require('../../Matchers'); | ||
describe('import/Importer', function() { | ||
@@ -42,2 +46,3 @@ | ||
it('should fire <bpmn.element.add> during import', function(done) { | ||
@@ -57,2 +62,3 @@ | ||
// when | ||
BpmnModel.fromXML(xml, function(err, definitions) { | ||
@@ -59,0 +65,0 @@ if (err) { |
@@ -0,0 +0,0 @@ var BpmnModel = require('bpmn-moddle'); |
@@ -0,0 +0,0 @@ var fs = require('fs'); |
@@ -0,0 +0,0 @@ var fs = require('fs'); |
@@ -0,0 +0,0 @@ var logger = require('moddle').util.Logger; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
788550
73
3424
8
1
+ Addeddiagram-js@0.1.0(transitive)
- Removeddiagram-js@0.0.3(transitive)
Updateddiagram-js@~0.1.0