cpee 2.1.135 → 2.1.139
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/cockpit/compliance-view.html +11 -19
- data/cockpit/compliance.html +11 -19
- data/cockpit/css/llm.css +3 -3
- data/cockpit/css/llmmodel.css +140 -0
- data/cockpit/css/model.css +0 -1
- data/cockpit/css/ui.css +13 -7
- data/cockpit/css/wfadaptor.css +15 -10
- data/cockpit/edit.html +11 -19
- data/cockpit/graph.html +8 -13
- data/cockpit/index.html +11 -19
- data/cockpit/js/details.js +27 -10
- data/cockpit/js/instance.js +219 -206
- data/cockpit/js/llm-ui-bubble.js +36 -0
- data/cockpit/js/llm-ui-status.js +34 -0
- data/cockpit/js/llm-ui.js +87 -0
- data/cockpit/js/llm.js +469 -121
- data/cockpit/js/parameters.js +45 -14
- data/cockpit/js/wfadaptor.js +402 -77
- data/cockpit/llm.html +16 -21
- data/cockpit/llmmodel.html +17 -23
- data/cockpit/model.html +8 -15
- data/cockpit/only_llm.html +14 -19
- data/cockpit/themes/THEMES.MD +4 -0
- data/cockpit/themes/base.js +1 -1
- data/cockpit/themes/packed/theme.js +3 -0
- data/cockpit/themes/presetlr/rngs/alternative.rng +28 -0
- data/cockpit/themes/presetlr/rngs/call.rng +249 -0
- data/cockpit/themes/presetlr/rngs/callmanipulate.rng +281 -0
- data/cockpit/themes/presetlr/rngs/choose.rng +27 -0
- data/cockpit/themes/presetlr/rngs/closed_loop.rng +62 -0
- data/cockpit/themes/presetlr/rngs/closed_loop_cancel.rng +5 -0
- data/cockpit/themes/presetlr/rngs/closed_loop_control.rng +31 -0
- data/cockpit/themes/presetlr/rngs/closed_loop_measuring.rng +12 -0
- data/cockpit/themes/presetlr/rngs/critical.rng +8 -0
- data/cockpit/themes/presetlr/rngs/escape.rng +5 -0
- data/cockpit/themes/presetlr/rngs/group.rng +3 -0
- data/cockpit/themes/presetlr/rngs/loop.rng +40 -0
- data/cockpit/themes/presetlr/rngs/manipulate.rng +76 -0
- data/cockpit/themes/presetlr/rngs/otherwise.rng +25 -0
- data/cockpit/themes/presetlr/rngs/parallel.rng +24 -0
- data/cockpit/themes/presetlr/rngs/parallel_branch.rng +5 -0
- data/cockpit/themes/presetlr/rngs/scripts.rng +23 -0
- data/cockpit/themes/presetlr/rngs/start.rng +143 -0
- data/cockpit/themes/presetlr/rngs/stop.rng +5 -0
- data/cockpit/themes/presetlr/rngs/terminate.rng +8 -0
- data/cockpit/themes/presetlr/rngs/wait_for_signal.rng +8 -0
- data/cockpit/themes/presetlr/symbols/alternative.svg +19 -0
- data/cockpit/themes/presetlr/symbols/arrow.svg +1 -0
- data/cockpit/themes/presetlr/symbols/call.svg +1 -0
- data/cockpit/themes/presetlr/symbols/call_sensor.svg +1 -0
- data/cockpit/themes/presetlr/symbols/callmanipulate.svg +1 -0
- data/cockpit/themes/presetlr/symbols/callmanipulate_sensor.svg +1 -0
- data/cockpit/themes/presetlr/symbols/callmanipulate_sensor_signal.svg +1 -0
- data/cockpit/themes/presetlr/symbols/callmanipulate_signal.svg +1 -0
- data/cockpit/themes/presetlr/symbols/choose.svg +15 -0
- data/cockpit/themes/presetlr/symbols/choose_exclusive.svg +15 -0
- data/cockpit/themes/presetlr/symbols/choose_exclusive_finish.svg +1 -0
- data/cockpit/themes/presetlr/symbols/choose_inclusive.svg +13 -0
- data/cockpit/themes/presetlr/symbols/choose_inclusive_finish.svg +1 -0
- data/cockpit/themes/presetlr/symbols/closed_loop.svg +1 -0
- data/cockpit/themes/presetlr/symbols/closed_loop_cancel.svg +1 -0
- data/cockpit/themes/presetlr/symbols/closed_loop_control.svg +1 -0
- data/cockpit/themes/presetlr/symbols/closed_loop_measuring.svg +1 -0
- data/cockpit/themes/presetlr/symbols/complex.svg +1 -0
- data/cockpit/themes/presetlr/symbols/critical.svg +1 -0
- data/cockpit/themes/presetlr/symbols/delete.svg +1 -0
- data/cockpit/themes/presetlr/symbols/end.svg +1 -0
- data/cockpit/themes/presetlr/symbols/escape.svg +1 -0
- data/cockpit/themes/presetlr/symbols/event_end.svg +1 -0
- data/cockpit/themes/presetlr/symbols/event_start.svg +1 -0
- data/cockpit/themes/presetlr/symbols/loop.svg +15 -0
- data/cockpit/themes/presetlr/symbols/loop_end.svg +15 -0
- data/cockpit/themes/presetlr/symbols/loop_end_pre.svg +15 -0
- data/cockpit/themes/presetlr/symbols/manipulate.svg +1 -0
- data/cockpit/themes/presetlr/symbols/mark.svg +1 -0
- data/cockpit/themes/presetlr/symbols/otherwise.svg +7 -0
- data/cockpit/themes/presetlr/symbols/parallel.svg +1 -0
- data/cockpit/themes/presetlr/symbols/parallel_branch.svg +7 -0
- data/cockpit/themes/presetlr/symbols/parallel_branch_event.svg +14 -0
- data/cockpit/themes/presetlr/symbols/parallel_branch_event_rev.svg +11 -0
- data/cockpit/themes/presetlr/symbols/parallel_branch_normal.svg +7 -0
- data/cockpit/themes/presetlr/symbols/parallel_eventbased_exclusive.svg +1 -0
- data/cockpit/themes/presetlr/symbols/parallel_eventbased_parallel.svg +1 -0
- data/cockpit/themes/presetlr/symbols/scripts.svg +1 -0
- data/cockpit/themes/presetlr/symbols/start.svg +1 -0
- data/cockpit/themes/presetlr/symbols/start_event.svg +1 -0
- data/cockpit/themes/presetlr/symbols/stop.svg +1 -0
- data/cockpit/themes/presetlr/symbols/terminate.svg +1 -0
- data/cockpit/themes/presetlr/symbols/wait_for_signal.svg +1 -0
- data/cockpit/themes/presetlr/theme.js +54 -0
- data/cockpit/themes/wellformed/rngs/alternative.rng +28 -0
- data/cockpit/themes/wellformed/rngs/call.rng +249 -0
- data/cockpit/themes/wellformed/rngs/callmanipulate.rng +281 -0
- data/cockpit/themes/wellformed/rngs/choose.rng +27 -0
- data/cockpit/themes/wellformed/rngs/closed_loop.rng +62 -0
- data/cockpit/themes/wellformed/rngs/closed_loop_cancel.rng +5 -0
- data/cockpit/themes/wellformed/rngs/closed_loop_control.rng +31 -0
- data/cockpit/themes/wellformed/rngs/closed_loop_measuring.rng +12 -0
- data/cockpit/themes/wellformed/rngs/critical.rng +8 -0
- data/cockpit/themes/wellformed/rngs/escape.rng +5 -0
- data/cockpit/themes/wellformed/rngs/group.rng +3 -0
- data/cockpit/themes/wellformed/rngs/loop.rng +40 -0
- data/cockpit/themes/wellformed/rngs/manipulate.rng +76 -0
- data/cockpit/themes/wellformed/rngs/otherwise.rng +25 -0
- data/cockpit/themes/wellformed/rngs/parallel.rng +24 -0
- data/cockpit/themes/wellformed/rngs/parallel_branch.rng +5 -0
- data/cockpit/themes/wellformed/rngs/scripts.rng +23 -0
- data/cockpit/themes/wellformed/rngs/start.rng +143 -0
- data/cockpit/themes/wellformed/rngs/stop.rng +5 -0
- data/cockpit/themes/wellformed/rngs/terminate.rng +8 -0
- data/cockpit/themes/wellformed/rngs/wait_for_signal.rng +8 -0
- data/cockpit/themes/wellformed/symbols/alternative.svg +1 -0
- data/cockpit/themes/wellformed/symbols/arrow.svg +1 -0
- data/cockpit/themes/wellformed/symbols/call.svg +1 -0
- data/cockpit/themes/wellformed/symbols/call_sensor.svg +1 -0
- data/cockpit/themes/wellformed/symbols/callmanipulate.svg +1 -0
- data/cockpit/themes/wellformed/symbols/callmanipulate_sensor.svg +1 -0
- data/cockpit/themes/wellformed/symbols/callmanipulate_sensor_signal.svg +1 -0
- data/cockpit/themes/wellformed/symbols/callmanipulate_signal.svg +1 -0
- data/cockpit/themes/wellformed/symbols/choose.svg +1 -0
- data/cockpit/themes/wellformed/symbols/choose_exclusive.svg +1 -0
- data/cockpit/themes/wellformed/symbols/choose_exclusive_finish.svg +1 -0
- data/cockpit/themes/wellformed/symbols/choose_inclusive.svg +1 -0
- data/cockpit/themes/wellformed/symbols/choose_inclusive_finish.svg +1 -0
- data/cockpit/themes/wellformed/symbols/closed_loop.svg +1 -0
- data/cockpit/themes/wellformed/symbols/closed_loop_cancel.svg +1 -0
- data/cockpit/themes/wellformed/symbols/closed_loop_control.svg +1 -0
- data/cockpit/themes/wellformed/symbols/closed_loop_measuring.svg +1 -0
- data/cockpit/themes/wellformed/symbols/complex.svg +1 -0
- data/cockpit/themes/wellformed/symbols/critical.svg +1 -0
- data/cockpit/themes/wellformed/symbols/delete.svg +1 -0
- data/cockpit/themes/wellformed/symbols/end.svg +1 -0
- data/cockpit/themes/wellformed/symbols/escape.svg +1 -0
- data/cockpit/themes/wellformed/symbols/event_end.svg +1 -0
- data/cockpit/themes/wellformed/symbols/event_start.svg +6 -0
- data/cockpit/themes/wellformed/symbols/loop.svg +1 -0
- data/cockpit/themes/wellformed/symbols/loop_end.svg +1 -0
- data/cockpit/themes/wellformed/symbols/manipulate.svg +1 -0
- data/cockpit/themes/wellformed/symbols/mark.svg +1 -0
- data/cockpit/themes/wellformed/symbols/otherwise.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel_branch.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel_branch_event.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel_branch_event_rev.svg +11 -0
- data/cockpit/themes/wellformed/symbols/parallel_branch_normal.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel_eventbased_exclusive.svg +1 -0
- data/cockpit/themes/wellformed/symbols/parallel_eventbased_parallel.svg +1 -0
- data/cockpit/themes/wellformed/symbols/scripts.svg +1 -0
- data/cockpit/themes/wellformed/symbols/start.svg +1 -0
- data/cockpit/themes/wellformed/symbols/start_event.svg +1 -0
- data/cockpit/themes/wellformed/symbols/stop.svg +1 -0
- data/cockpit/themes/wellformed/symbols/terminate.svg +1 -0
- data/cockpit/themes/wellformed/symbols/wait_for_signal.svg +1 -0
- data/cockpit/themes/wellformed/theme.js +32 -0
- data/cockpit/track.html +8 -13
- data/cpee.gemspec +3 -3
- data/lib/callbacks/callbacks.rng +4 -4
- data/lib/callbacks.xml +4 -4
- data/lib/cpee/constants.rb +4 -4
- data/lib/cpee/fail.rb +4 -4
- data/lib/cpee/implementation.rb +10 -4
- data/lib/cpee/implementation_callbacks.rb +6 -6
- data/lib/cpee/implementation_notifications.rb +8 -5
- data/lib/cpee/implementation_properties.rb +132 -12
- data/lib/cpee/json_pointer.rb +110 -0
- data/lib/cpee/message.rb +26 -6
- data/lib/cpee/persistence.rb +10 -4
- data/lib/cpee/redis.rb +12 -4
- data/lib/cpee/statemachine.rb +4 -4
- data/lib/cpee/value_helper.rb +4 -4
- data/lib/cpee.xml +4 -4
- data/lib/engine/executionhandler-list.rng +4 -4
- data/lib/engine/instance-info.rng +4 -4
- data/lib/engine/instances.rng +4 -4
- data/lib/engine.xml +4 -4
- data/lib/properties/t_dslx.rng +356 -0
- data/lib/properties/transformation.rng +14 -0
- data/lib/properties.xml +5 -4
- data/server/executionhandlers/eval/backend/opts.yaml +1 -1
- data/server/executionhandlers/eval/connection.rb +16 -7
- data/server/executionhandlers/eval/execution.rb +4 -4
- data/server/executionhandlers/ruby/backend/opts.yaml +1 -1
- data/server/executionhandlers/ruby/connection.rb +17 -9
- data/server/executionhandlers/ruby/controller.rb +21 -6
- data/server/executionhandlers/ruby/dsl_to_dslx.xsl +6 -2
- data/server/executionhandlers/ruby/execution.rb +4 -4
- data/server/resources/properties.empty +5 -4
- data/server/resources/properties.init +5 -4
- data/server/resources/topics.xml +4 -4
- data/server/routing/end.pid +1 -1
- data/server/routing/end.rb +4 -4
- data/server/routing/forward-events-00.pid +1 -1
- data/server/routing/forward-events.rb +34 -23
- data/server/routing/forward-votes.pid +1 -1
- data/server/routing/forward-votes.rb +60 -47
- data/server/routing/persist.pid +1 -1
- data/server/routing/persist.rb +53 -30
- data/tools/server/cpee +1 -1
- data/tools/server/resources/properties.init +4 -4
- metadata +142 -5
- data/cockpit/CPEE.xml +0 -8
- data/cockpit/Signavio.xml +0 -8
- data/cockpit/transformations.xml +0 -4
- /data/{COPYING → LICENSE} +0 -0
data/cockpit/js/wfadaptor.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
/*
|
|
2
|
-
This file is part of
|
|
2
|
+
This file is part of cpee-layout.
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
of the GNU General Public License as published by the Free
|
|
6
|
-
either version 3 of the License, or (at your option) any
|
|
4
|
+
cpee-layout is free software: you can redistribute it and/or modify it under
|
|
5
|
+
the terms of the GNU Lesser General Public License as published by the Free
|
|
6
|
+
Software Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
+
later version.
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
10
|
-
PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
9
|
+
cpee-layout is distributed in the hope that it will be useful, but WITHOUT
|
|
10
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
+
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
|
12
|
+
details.
|
|
11
13
|
|
|
12
|
-
You should have received a copy of the GNU General Public License
|
|
13
|
-
|
|
14
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
15
|
+
along with cpee-layout (file LICENSE in the main directory). If not, see
|
|
14
16
|
<http://www.gnu.org/licenses/>.
|
|
15
17
|
*/
|
|
16
18
|
|
|
@@ -57,12 +59,20 @@ function WfAdaptor(theme_base,doit) { // Controller {{{
|
|
|
57
59
|
this.set_label_container = function(container) { // {{{
|
|
58
60
|
illustrator.set_label_container(container);
|
|
59
61
|
} // }}}
|
|
62
|
+
this.get_svg = function() { // {{{
|
|
63
|
+
return illustrator.get_svg();
|
|
64
|
+
} // }}}
|
|
65
|
+
this.get_svg_metrics = function() { // {{{
|
|
66
|
+
return illustrator.get_svg_metrics();
|
|
67
|
+
} // }}}
|
|
60
68
|
|
|
61
69
|
function loadTheme(doit) { //{{{
|
|
62
70
|
manifestation = new WFAdaptorManifestation(self);
|
|
63
71
|
illustrator.compact = manifestation.compact == true ? true : false;
|
|
64
72
|
illustrator.rotated_labels = manifestation.rotated_labels == true ? true : false;
|
|
65
73
|
illustrator.striped = manifestation.striped == true ? true : false;
|
|
74
|
+
illustrator.lr = manifestation.lr == true ? true : false;
|
|
75
|
+
illustrator.wellformed_pre_test = manifestation.wellformed_pre_test == true ? true : false;
|
|
66
76
|
description.source = manifestation.source;
|
|
67
77
|
var deferreds = [];
|
|
68
78
|
// copy parent stuff
|
|
@@ -229,15 +239,22 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
|
229
239
|
this.width_shift_label = 7;
|
|
230
240
|
this.group_extend = 1;
|
|
231
241
|
this.structural_tighten = 3; // 'structural' borders are smaller in y
|
|
242
|
+
this.conn_center = 15; // connectors attach to the center of the symbols, i.e. half a symbol before the end of the cell
|
|
232
243
|
this.elements = {}; // the svgs
|
|
233
244
|
this.svg = {};
|
|
234
245
|
this.draw = {};
|
|
235
246
|
this.dim = {};
|
|
236
247
|
this.dim.symbols = [];
|
|
237
248
|
this.dim.connections = [];
|
|
249
|
+
this.dim.implied = []; // symbols that an icon draws in a neighbouring cell (theme: implied), for the metrics only
|
|
250
|
+
this.dim.labels = {}; // the shown label of each cell ('row,col'), for the metrics only
|
|
251
|
+
this.dim.rows = []; // lr only: start and size of each symbol along the rows
|
|
238
252
|
this.compact = true;
|
|
239
253
|
this.rotated_labels = true;
|
|
240
254
|
this.striped = true;
|
|
255
|
+
this.lr = false;
|
|
256
|
+
this.wellformed_pre_test = false; // experimental: pre_test loops are drawn reversed
|
|
257
|
+
this.inverted = false; // true while drawing inside such a loop, nested pre_test loops toggle it
|
|
241
258
|
this.global_style = {};
|
|
242
259
|
// private
|
|
243
260
|
var self = this;
|
|
@@ -256,6 +273,18 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
|
256
273
|
' <marker id="endarrow" viewBox="0 0 10 10" refX="7" refY="5" orient="auto" markerUnits="strokeWidth" markerWidth="14" markerHeight="5.2">' +
|
|
257
274
|
' <path d="M 2,2 L 6.21,4.11 Q 8,5 6.21,5.89 L 2,8 Z"/>' +
|
|
258
275
|
' </marker>' +
|
|
276
|
+
' <marker id="arrowrev" viewBox="0 0 10 10" refX="28.5" refY="5" orient="auto-start-reverse" markerUnits="strokeWidth" markerWidth="14" markerHeight="3.5">' +
|
|
277
|
+
' <path d="m 2 2 l 6 3 l -6 3 z"/>' +
|
|
278
|
+
' </marker>' +
|
|
279
|
+
' <marker id="endarrowrev" viewBox="0 0 10 10" refX="7" refY="5" orient="auto-start-reverse" markerUnits="strokeWidth" markerWidth="14" markerHeight="5.2">' +
|
|
280
|
+
' <path d="M 2,2 L 6.21,4.11 Q 8,5 6.21,5.89 L 2,8 Z"/>' +
|
|
281
|
+
' </marker>' +
|
|
282
|
+
' <marker id="arrowdiag" viewBox="0 0 10 10" refX="24.5" refY="5" orient="auto" markerUnits="strokeWidth" markerWidth="14" markerHeight="3.5">' +
|
|
283
|
+
' <path d="m 2 2 l 6 3 l -6 3 z"/>' +
|
|
284
|
+
' </marker>' +
|
|
285
|
+
' <marker id="arrowdiagrev" viewBox="0 0 10 10" refX="24.5" refY="5" orient="auto-start-reverse" markerUnits="strokeWidth" markerWidth="14" markerHeight="3.5">' +
|
|
286
|
+
' <path d="m 2 2 l 6 3 l -6 3 z"/>' +
|
|
287
|
+
' </marker>' +
|
|
259
288
|
' <clipPath id="startclip">' +
|
|
260
289
|
' <rect x="-4" y="-4" width="35" height="38"/>' +
|
|
261
290
|
' </clipPath>' +
|
|
@@ -287,11 +316,142 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
|
287
316
|
let w = self.dim.get_x_max(0,graph.max.row,graph.max.col,'start');
|
|
288
317
|
if (w == 0) { w = bb.x + bb.width + self.width_shift; }
|
|
289
318
|
// the alternative is bb.x + bb.width + self.width_shift, but this is bad when clipped elements
|
|
319
|
+
if (self.lr) { w = Math.max(w, bb.x + bb.width + self.width_shift); } // lr: labels can reach across the flow, e.g. rotated below a gateway; clipped labels only reach along it
|
|
320
|
+
|
|
321
|
+
if (self.lr) { // mirror at the diagonal: rows go to the right, columns go down
|
|
322
|
+
graph.svg.attr('transform',lr_matrix());
|
|
323
|
+
self.svg.container.attr('height', w - lr_shift() + self.height_shift);
|
|
324
|
+
self.svg.container.attr('width', bb.y + bb.height + self.height_shift + lr_shift());
|
|
325
|
+
} else {
|
|
326
|
+
self.svg.container.attr('height', bb.y + bb.height + self.height_shift); // small border on the bottom
|
|
327
|
+
self.svg.container.attr('width', w); // small border on the right
|
|
328
|
+
}
|
|
329
|
+
} // }}}
|
|
330
|
+
this.get_svg = function() { // {{{
|
|
331
|
+
// standalone copy for export: the rules of all stylesheets marked with
|
|
332
|
+
// data-include-export are inlined into the style attributes (var()
|
|
333
|
+
// resolved, in cascade order), further columns from the label container are
|
|
334
|
+
// merged in, and interaction state and the render time are removed
|
|
335
|
+
var svgs = [self.svg.container.get(0)];
|
|
336
|
+
if (self.svg.label_container) {
|
|
337
|
+
self.svg.label_container.children('svg').not(self.svg.container).each(function(_,ele) { svgs.push(ele); });
|
|
338
|
+
}
|
|
339
|
+
var clones = svgs.map(function(s) { return s.cloneNode(true); });
|
|
340
|
+
|
|
341
|
+
var root = getComputedStyle(document.documentElement);
|
|
342
|
+
var rules = [];
|
|
343
|
+
var family = '';
|
|
344
|
+
$.each(document.styleSheets, function(_,sheet) {
|
|
345
|
+
if (!sheet.ownerNode || !sheet.ownerNode.hasAttribute('data-include-export')) { return; }
|
|
346
|
+
$.each(sheet.cssRules, function(_,rule) {
|
|
347
|
+
if (!rule.selectorText || rule.selectorText == ':root') { return; }
|
|
348
|
+
if (rule.selectorText == 'svg') {
|
|
349
|
+
if (rule.style.getPropertyValue('font-family') != '') {
|
|
350
|
+
family = getComputedStyle(svgs[0]).getPropertyValue('font-family').replace(/["']/g,'').trim();
|
|
351
|
+
}
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
var css = rule.style.cssText.replace(/var\((--[\w-]+)\)/g, function(m,v) { return root.getPropertyValue(v).trim() || m; });
|
|
355
|
+
rule.selectorText.split(',').forEach(function(sel) {
|
|
356
|
+
rules.push({ sel: sel.trim(), spec: specificity(sel), order: rules.length, css: css });
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
rules.sort(function(a,b) { return a.spec - b.spec || a.order - b.order; });
|
|
361
|
+
family = family.replace(/-/,' ').split(' ').map(function(w) { return w[0].toUpperCase() + w.substr(1); }).join(' '); // adwaita-sans -> Adwaita Sans, the installed name
|
|
362
|
+
|
|
363
|
+
clones.forEach(function(clone) {
|
|
364
|
+
$(clone).find('.duration').remove();
|
|
365
|
+
$(clone).find('.selected').removeClass('selected');
|
|
366
|
+
$(clone).find('.hover').removeClass('hover');
|
|
367
|
+
$(clone).find('*').each(function(_,el) {
|
|
368
|
+
var decl = [];
|
|
369
|
+
rules.forEach(function(r) {
|
|
370
|
+
try { if (el.matches(r.sel)) { decl.push(r.css); } } catch (e) { } // e.g. unsupported pseudo classes
|
|
371
|
+
});
|
|
372
|
+
var own = el.getAttribute('style');
|
|
373
|
+
if (own && own.trim() != '') { decl.push(own.trim().replace(/;?$/,';')); }
|
|
374
|
+
if ($(el).is('text.super, g.hoverstyle, g.markstyle')) { decl.push('display: none;'); }
|
|
375
|
+
if (el.nodeName == 'text' && family != '') { decl.push('font-family: \'' + family + '\';'); }
|
|
376
|
+
if (decl.length > 0) { el.setAttribute('style', decl.join(' ')); }
|
|
377
|
+
});
|
|
378
|
+
});
|
|
290
379
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
380
|
+
var svg = clones.shift();
|
|
381
|
+
var width = parseInt(svg.getAttribute('width'));
|
|
382
|
+
clones.forEach(function(clone) {
|
|
383
|
+
var gr = $X('<g transform="translate(' + width + ')" xmlns="http://www.w3.org/2000/svg"></g>');
|
|
384
|
+
gr.append($(clone).children());
|
|
385
|
+
width += parseInt(clone.getAttribute('width'));
|
|
386
|
+
$(svg).append(gr);
|
|
387
|
+
});
|
|
388
|
+
svg.setAttribute('width', width + 1);
|
|
389
|
+
return svg;
|
|
390
|
+
} // }}}
|
|
391
|
+
this.get_svg_metrics = function() { // {{{
|
|
392
|
+
// the layout of the last drawing as it is shown (a copy, empty cells are
|
|
393
|
+
// null): pos_matrix holds the symbols per row and column, x and width are
|
|
394
|
+
// horizontal; con_list the connections between them. Rows and columns are
|
|
395
|
+
// 0-indexed here, the layout counts from 1. lr is laid out top to bottom
|
|
396
|
+
// and mirrored at the diagonal, so rows and columns are swapped back, and x
|
|
397
|
+
// and width come from the rows (as in get_x, x is the symbol position plus
|
|
398
|
+
// width_shift). geometry: a symbol is drawn shift left of its x, and the
|
|
399
|
+
// symbols of row r start at top + r * row. label_box is where the label is
|
|
400
|
+
// shown, in the coordinates of the svg
|
|
401
|
+
var center_x = (self.width - self.default_width) / 2;
|
|
402
|
+
var center_y = (self.height - self.default_height) / 2;
|
|
403
|
+
var geometry = self.lr ? // lr: x runs along the internal rows, the rows are the internal columns, lr_matrix moves both by lr_shift
|
|
404
|
+
{ shift: self.width_shift - center_y, top: 2 * self.height_shift + center_x, row: self.width } :
|
|
405
|
+
{ shift: self.width_shift - center_x, top: self.height_shift + center_y, row: self.height };
|
|
406
|
+
var pos =function(r,c) { return self.lr ? { row: c - 1, col: r - 1 } : { row: r - 1, col: c - 1 }; };
|
|
407
|
+
var row_start = function(r,c) { // like get_row, but symbols without an own entry (e.g. alternative) also find one to the right
|
|
408
|
+
var rs = self.dim.rows[r] || [];
|
|
409
|
+
for (var j = c; j >= 0; j--) { if (rs[j]) { return rs[j].start; } }
|
|
410
|
+
for (var j = c + 1; j < rs.length; j++) { if (rs[j]) { return rs[j].start; } }
|
|
411
|
+
return 0;
|
|
412
|
+
};
|
|
413
|
+
var pos_matrix = [];
|
|
414
|
+
self.dim.symbols.forEach(function(row,r) {
|
|
415
|
+
if (!row) { return; }
|
|
416
|
+
row.forEach(function(sym,c) {
|
|
417
|
+
if (!sym || !sym.type || r == 0 || c == 0) { return; } // without type the cell is only reserved (set_x), nothing is drawn there
|
|
418
|
+
var p = pos(r,c);
|
|
419
|
+
var s = $.extend({}, sym);
|
|
420
|
+
if (self.lr) {
|
|
421
|
+
s.x = row_start(r,c) + self.width;
|
|
422
|
+
s.width = (self.dim.rows[r] && self.dim.rows[r][c] && self.dim.rows[r][c].size) || self.height;
|
|
423
|
+
}
|
|
424
|
+
var lab = self.dim.labels[r + ',' + c];
|
|
425
|
+
if (lab) {
|
|
426
|
+
var b = get_box(lab);
|
|
427
|
+
s.label_box = { x: b.x, y: b.y, width: b.width, height: b.height };
|
|
428
|
+
}
|
|
429
|
+
if (!pos_matrix[p.row]) { pos_matrix[p.row] = []; }
|
|
430
|
+
pos_matrix[p.row][p.col] = s;
|
|
431
|
+
});
|
|
432
|
+
});
|
|
433
|
+
self.dim.implied.forEach(function(i) { // x/y are cells in the icon; lr mirrors the icon, so its x runs along the rows there
|
|
434
|
+
var dr = self.lr ? (i.x || 0) : (i.y || 0), dc = self.lr ? (i.y || 0) : (i.x || 0);
|
|
435
|
+
var r = i.row + dr, c = i.col + dc;
|
|
436
|
+
var p = pos(r,c);
|
|
437
|
+
var src = self.dim.symbols[i.row][i.col];
|
|
438
|
+
if (!pos_matrix[p.row]) { pos_matrix[p.row] = []; }
|
|
439
|
+
if (pos_matrix[p.row][p.col]) { return; } // a real symbol wins
|
|
440
|
+
pos_matrix[p.row][p.col] = self.lr ?
|
|
441
|
+
{ x: row_start(i.row,i.col) + self.width + dr * self.height, width: self.height, type: i.type, eid: src.eid } :
|
|
442
|
+
{ x: src.x + dc * self.width, width: self.width, type: i.type, eid: src.eid };
|
|
443
|
+
});
|
|
444
|
+
var con_list = self.dim.connections.map(function(c) {
|
|
445
|
+
return { from: pos(c.from.row,c.from.col), to: pos(c.to.row,c.to.col) };
|
|
446
|
+
});
|
|
447
|
+
return JSON.parse(JSON.stringify({ lr: self.lr == true, geometry: geometry, pos_matrix: pos_matrix, con_list: con_list })); // holes become null
|
|
448
|
+
} // }}}
|
|
449
|
+
var specificity = function(sel) { // {{{ ids, classes/attributes/pseudo classes, types
|
|
450
|
+
var s = sel.replace(/::[\w-]+/g,'');
|
|
451
|
+
var a = (s.match(/#[\w-]+/g) || []).length;
|
|
452
|
+
var b = (s.match(/\.[\w-]+|\[[^\]]*\]|:[\w-]+/g) || []).length;
|
|
453
|
+
var c = (s.replace(/\[[^\]]*\]/g,'').match(/(^|[\s>+~(])[a-zA-Z][\w-]*/g) || []).length;
|
|
454
|
+
return a * 10000 + b * 100 + c;
|
|
295
455
|
} // }}}
|
|
296
456
|
this.set_duration = function(start) { //{{{
|
|
297
457
|
self.svg.container.append(
|
|
@@ -320,6 +480,9 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
|
320
480
|
$('> defs > [belongs-to=element]', self.svg.container).each(function() {$(this).remove()});
|
|
321
481
|
self.dim.symbols = [];
|
|
322
482
|
self.dim.connections = [];
|
|
483
|
+
self.dim.implied = [];
|
|
484
|
+
self.dim.labels = {};
|
|
485
|
+
self.dim.rows = [];
|
|
323
486
|
} // }}}
|
|
324
487
|
var get_symbol = this.get_symbol = function() { // {{{
|
|
325
488
|
} // }}}
|
|
@@ -345,7 +508,8 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
|
345
508
|
return line;
|
|
346
509
|
} //}}}
|
|
347
510
|
|
|
348
|
-
var set_x = this.dim.set_x = function(row,col,twidth
|
|
511
|
+
var set_x = this.dim.set_x = function(row,col,twidth) { //{{{
|
|
512
|
+
// reserves the space of a cell; what is drawn there (type, label, ...) is set by set_x_cond
|
|
349
513
|
if (!self.dim.symbols[row]) { self.dim.symbols[row] = []; }
|
|
350
514
|
if (!self.dim.symbols[row][col]) { self.dim.symbols[row][col] = {}; }
|
|
351
515
|
|
|
@@ -385,10 +549,14 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
|
385
549
|
} else {
|
|
386
550
|
self.dim.symbols[row][col].width = twidth;
|
|
387
551
|
}
|
|
388
|
-
self.dim.symbols[row][col].type = sname;
|
|
389
552
|
// console.log('set_x ',row,col,debug_dim());
|
|
390
553
|
} //}}}
|
|
391
554
|
var set_x_cond = this.dim.set_x_cond = function(row,col,tx,twidth,sname,label,subtype,sty,eid) { //{{{
|
|
555
|
+
if (self.lr) { // labels widen the row, not the column
|
|
556
|
+
set_row(row,col,[]);
|
|
557
|
+
self.dim.rows[row][col].size = Math.max(self.dim.rows[row][col].size || 0, twidth);
|
|
558
|
+
twidth = self.width;
|
|
559
|
+
}
|
|
392
560
|
if (!self.dim.symbols[row]) { self.dim.symbols[row] = []; }
|
|
393
561
|
if (!self.dim.symbols[row][col] || self.dim.symbols[row][col].width < twidth) {
|
|
394
562
|
self.dim.symbols[row][col] = {};
|
|
@@ -496,6 +664,57 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
|
496
664
|
var get_y = this.draw.get_y = function(row) { // {{{
|
|
497
665
|
return { y: row * self.height - self.height, height_shift: self.height_shift};
|
|
498
666
|
} // }}}
|
|
667
|
+
var lr_shift = function() { // {{{
|
|
668
|
+
// mirroring swaps the left (width - width_shift) and top (height_shift) margins, so shift them back
|
|
669
|
+
return self.width - self.width_shift - self.height_shift;
|
|
670
|
+
} // }}}
|
|
671
|
+
var lr_matrix = function() { // {{{
|
|
672
|
+
return 'matrix(0,1,1,0,' + lr_shift() + ',' + (self.height_shift - lr_shift()) + ')'; // top margin is twice the height_shift
|
|
673
|
+
} // }}}
|
|
674
|
+
var set_row = this.dim.set_row = function(row,col,prev) { // {{{
|
|
675
|
+
// lr: a symbol starts where its predecessors end, so only things in the same block are aligned
|
|
676
|
+
if (!self.lr) { return; }
|
|
677
|
+
if (!self.dim.rows[row]) { self.dim.rows[row] = []; }
|
|
678
|
+
if (self.dim.rows[row][col]) { return; }
|
|
679
|
+
let mx = 0;
|
|
680
|
+
prev.forEach((p) => {
|
|
681
|
+
if (!p) { return; }
|
|
682
|
+
if (p.row == 0 || p.col == 0) { p = { row: 1, col: 1 }; } // first element connects to description
|
|
683
|
+
mx = Math.max(mx, get_row_end(p.row,p.col));
|
|
684
|
+
});
|
|
685
|
+
for (let i=1; i<row; i++) { // and after everything before in this and the following columns, e.g. blocks in vertical parallels share columns
|
|
686
|
+
for (let j=col; self.dim.rows[i] && j<self.dim.rows[i].length; j++) {
|
|
687
|
+
if (self.dim.rows[i][j]) { mx = Math.max(mx, get_row_end(i,j)); }
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
self.dim.rows[row][col] = { start: mx };
|
|
691
|
+
} // }}}
|
|
692
|
+
var get_row = this.dim.get_row = function(row,col) { // {{{
|
|
693
|
+
if (!self.lr) { return (row - 1) * self.height; }
|
|
694
|
+
for (let j=col; j>=0; j--) { // e.g. wide connections point to empty columns
|
|
695
|
+
if (self.dim.rows[row] && self.dim.rows[row][j]) { return self.dim.rows[row][j].start; }
|
|
696
|
+
}
|
|
697
|
+
return 0;
|
|
698
|
+
} // }}}
|
|
699
|
+
var get_row_end = this.dim.get_row_end = function(row,col) { // {{{
|
|
700
|
+
if (!self.lr) { return row * self.height; }
|
|
701
|
+
let size = self.dim.rows[row] && self.dim.rows[row][col] && self.dim.rows[row][col].size;
|
|
702
|
+
return get_row(row,col) + (size || self.height);
|
|
703
|
+
} // }}}
|
|
704
|
+
var get_row_max = this.dim.get_row_max = function(rowf,rowt,colf,colt) { // {{{
|
|
705
|
+
if (!self.lr) { return rowt * self.height; }
|
|
706
|
+
let mx = 0;
|
|
707
|
+
let last = false;
|
|
708
|
+
for (let i=rowf; i<=rowt; i++) {
|
|
709
|
+
for (let j=colf; j<=colt; j++) {
|
|
710
|
+
if (self.dim.rows[i] && self.dim.rows[i][j]) {
|
|
711
|
+
mx = Math.max(mx, get_row_end(i,j));
|
|
712
|
+
if (i == rowt) { last = true; }
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
return last ? mx : mx + self.height; // closing symbols are drawn after the border
|
|
717
|
+
} // }}}
|
|
499
718
|
|
|
500
719
|
var get_width = this.draw.get_width = function(g) { //{{{
|
|
501
720
|
let t = g.clone();
|
|
@@ -505,6 +724,22 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
|
505
724
|
t.remove();
|
|
506
725
|
return w;
|
|
507
726
|
} //}}}
|
|
727
|
+
var get_label_end = this.draw.get_label_end = function(lab,frame) { //{{{
|
|
728
|
+
// where a label ends, in the coordinates of frame (one of its ancestors),
|
|
729
|
+
// including all transforms in between, so it does not matter if the label
|
|
730
|
+
// is beside the icon, below it, rotated or right aligned
|
|
731
|
+
let inner = lab.clone();
|
|
732
|
+
lab.parentsUntil(frame).each(function(_,p) {
|
|
733
|
+
let w = $X('<g xmlns="http://www.w3.org/2000/svg"></g>');
|
|
734
|
+
if ($(p).attr('transform')) { w.attr('transform',$(p).attr('transform')); }
|
|
735
|
+
inner = w.append(inner);
|
|
736
|
+
});
|
|
737
|
+
let g = $X('<g xmlns="http://www.w3.org/2000/svg"></g>').append(inner);
|
|
738
|
+
self.svg.container.append(g);
|
|
739
|
+
let bb = g[0].getBBox();
|
|
740
|
+
g.remove();
|
|
741
|
+
return Math.max(0, bb.x + bb.width);
|
|
742
|
+
} //}}}
|
|
508
743
|
var get_height = this.draw.get_height = function(g) { //{{{
|
|
509
744
|
let t = g.clone();
|
|
510
745
|
self.svg.container.append(t);
|
|
@@ -516,18 +751,24 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
|
516
751
|
var get_dim = this.draw.get_dim = function(g) { //{{{
|
|
517
752
|
let element = g.clone();
|
|
518
753
|
self.svg.container.append(element);
|
|
519
|
-
let
|
|
754
|
+
let dim = get_box(element[0]);
|
|
755
|
+
element.remove();
|
|
756
|
+
return dim;
|
|
757
|
+
} //}}}
|
|
758
|
+
var get_box = this.draw.get_box = function(el) { //{{{
|
|
759
|
+
// the enclosing box of a drawn element, in the coordinates of its svg,
|
|
760
|
+
// including all transforms (e.g. its blocks and the lr mirroring)
|
|
761
|
+
let svg = el.ownerSVGElement;
|
|
520
762
|
|
|
521
|
-
var r =
|
|
763
|
+
var r = el.getBBox();
|
|
522
764
|
|
|
523
765
|
if (!svg) {
|
|
524
|
-
element[0].remove();
|
|
525
766
|
return { x: 0, y: 0, cx: 0, cy: 0, width: 0, height: 0 };
|
|
526
767
|
}
|
|
527
768
|
|
|
528
769
|
var p = svg.createSVGPoint();
|
|
529
770
|
|
|
530
|
-
var matrix = svg.getScreenCTM().inverse().multiply(
|
|
771
|
+
var matrix = svg.getScreenCTM().inverse().multiply(el.getScreenCTM());
|
|
531
772
|
|
|
532
773
|
p.x = r.x;
|
|
533
774
|
p.y = r.y;
|
|
@@ -553,8 +794,6 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
|
553
794
|
var width = maxX - minX;
|
|
554
795
|
var height = maxY - minY;
|
|
555
796
|
|
|
556
|
-
element.remove();
|
|
557
|
-
|
|
558
797
|
return {
|
|
559
798
|
x: minX,
|
|
560
799
|
y: minY,
|
|
@@ -589,11 +828,11 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
|
589
828
|
|
|
590
829
|
let dstart = get_x(parent_row,col,'symbol ' + sname);
|
|
591
830
|
|
|
592
|
-
let sstart = dstart
|
|
593
|
-
let stop = row
|
|
831
|
+
let sstart = dstart + center_x - self.width_shift;
|
|
832
|
+
let stop = get_row(row,col) + center_y + self.height_shift;
|
|
594
833
|
|
|
595
834
|
var g = $X('<g class="element" element-row="' + (row-1) + '" element-type="' + sname + '" element-id="' + id + '" xmlns="http://www.w3.org/2000/svg">' +
|
|
596
|
-
'<g transform="translate(' + String(sstart) + ',' + String(stop) + ')"></g>' +
|
|
835
|
+
'<g transform="translate(' + String(sstart) + ',' + String(stop) + ')' + (self.lr ? ' matrix(0,1,1,0,0,0)' : '') + '"></g>' + // lr: mirror back, so that the symbol is upright
|
|
597
836
|
'</g>');
|
|
598
837
|
|
|
599
838
|
// add the element-endpoint and other stuff to each symbol (from theme info function)
|
|
@@ -702,9 +941,10 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
|
702
941
|
lab.text(title);
|
|
703
942
|
}
|
|
704
943
|
}
|
|
705
|
-
|
|
944
|
+
if (self.elements[sname].hidelabel) { lab.addClass('invisible'); } // still takes its space
|
|
706
945
|
if (mid.length > 0) {
|
|
707
946
|
if (end.length > 0) {
|
|
947
|
+
let width = this.get_label_end(lab,mid); // the clip path is inside part-middle
|
|
708
948
|
let pos = get_dim(mid);
|
|
709
949
|
mid.attr('clip-path','url(#ele-' + id + ')');
|
|
710
950
|
let clip = $X('<clipPath belongs-to="element" id="ele-' + id + '" xmlns="http://www.w3.org/2000/svg">' +
|
|
@@ -723,7 +963,7 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
|
723
963
|
lab.addClass('rotate');
|
|
724
964
|
tdim = self.width;
|
|
725
965
|
} else {
|
|
726
|
-
tdim = self.width
|
|
966
|
+
tdim = Math.max(self.width, this.get_label_end(lab,sym) + self.width_shift_label);
|
|
727
967
|
}
|
|
728
968
|
set_x_cond(row,col,dstart,tdim,sname,title,subtype,sty,id);
|
|
729
969
|
}
|
|
@@ -743,6 +983,12 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
|
743
983
|
$('.part-end',sym).remove();
|
|
744
984
|
set_x_cond(row,col,dstart,self.width,sname,title,subtype,sty,id);
|
|
745
985
|
}
|
|
986
|
+
if (self.elements[sname].implied) { self.dim.implied.push($.extend({row: row, col: col}, self.elements[sname].implied)); }
|
|
987
|
+
if (self.elements[sname].hidelabel) { // only takes its space, it is not shown
|
|
988
|
+
self.dim.symbols[row][col].label = undefined;
|
|
989
|
+
} else if (lab.length > 0 && lab.text() != '' && $.contains(sym[0],lab[0])) {
|
|
990
|
+
self.dim.labels[row + ',' + col] = lab[0];
|
|
991
|
+
}
|
|
746
992
|
|
|
747
993
|
|
|
748
994
|
$(g[0].childNodes[0]).append(sym);
|
|
@@ -758,10 +1004,10 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
|
758
1004
|
);
|
|
759
1005
|
}
|
|
760
1006
|
|
|
761
|
-
// hover
|
|
1007
|
+
// hover, top left of the symbol, or top right if the theme says so (e.g. because of a label on the left)
|
|
762
1008
|
$(g[0].childNodes[0]).append(
|
|
763
1009
|
$X(
|
|
764
|
-
'<g class="hoverstyle markstyle" xmlns="http://www.w3.org/2000/svg">' +
|
|
1010
|
+
'<g class="hoverstyle markstyle"' + (self.elements[sname].mark_position == 'right' ? ' transform="translate(27,0)"' : '') + ' xmlns="http://www.w3.org/2000/svg">' +
|
|
765
1011
|
'<circle cx="2" cy="0" r="7"/>' +
|
|
766
1012
|
'<path d="m -1 0 l 2 2 l 4 -4" class="standline"/>' +
|
|
767
1013
|
'</g>'
|
|
@@ -781,65 +1027,83 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
|
781
1027
|
let bstart = get_x(p1.row,p1.col,'border from');
|
|
782
1028
|
let bend = get_x_plus(p1.row,p2.row,p2.col,'border to');
|
|
783
1029
|
group.prepend($X('<rect element-id="' + id + '" x="' + (bstart - 1.1 * self.width_shift - self.group_extend) + '" ' +
|
|
784
|
-
'y="' + ((p1.row
|
|
1030
|
+
'y="' + (get_row(p1.row,p1.col)+self.height_shift/2-self.group_extend+yshrink) + '" ' +
|
|
785
1031
|
'width="' + (bend-bstart+2*self.group_extend) + '" ' +
|
|
786
|
-
'height="' + ((
|
|
1032
|
+
'height="' + (get_row_max(p1.row,p2.row,p1.col,p2.col)-get_row(p1.row,p1.col)+2*self.group_extend-2*yshrink) + '" ' +
|
|
787
1033
|
'class="block" rx="12" ry="12" xmlns="http://www.w3.org/2000/svg"/>'));
|
|
788
1034
|
} // }}}
|
|
789
1035
|
var draw_tile = this.draw.draw_tile = function(id, p1, p2, group, yshrink=0) { // {{{
|
|
790
1036
|
let bstart = get_x(p1.row,p1.col,'tile from');
|
|
791
1037
|
let bend = get_x_plus(p1.row,p2.row,p2.col,'tile to');
|
|
792
1038
|
group.prepend($X('<rect element-id="' + id + '" x="' + (bstart - 1.1 * self.width_shift - self.group_extend) + '" ' +
|
|
793
|
-
'y="' + ((p1.row
|
|
1039
|
+
'y="' + (get_row(p1.row,p1.col)+self.height_shift/2-self.group_extend+yshrink) + '" ' +
|
|
794
1040
|
'width="' + (bend-bstart+2*self.group_extend) + '" ' +
|
|
795
|
-
'height="' + ((
|
|
1041
|
+
'height="' + (get_row_max(p1.row,p2.row,p1.col,p2.col)-get_row(p1.row,p1.col)+2*self.group_extend-2*yshrink) + '" ' +
|
|
796
1042
|
'class="tile" rx="12" ry="12" xmlns="http://www.w3.org/2000/svg"/>'));
|
|
797
1043
|
} // }}}
|
|
798
|
-
var draw_connection = this.draw.draw_connection = function(group, start, end, context_row, arrow) { // {{{
|
|
1044
|
+
var draw_connection = this.draw.draw_connection = function(group, start, end, context_row, arrow, around=false) { // {{{
|
|
799
1045
|
let sr = Math.min(start.row,end.row);
|
|
800
1046
|
let cstart = get_x(sr,start.col,'conn from');
|
|
801
1047
|
let cend = get_x(sr,end.col,'conn to');
|
|
802
|
-
|
|
1048
|
+
let from = {row: start.row, col: start.col}, to = {row: end.row, col: end.col};
|
|
1049
|
+
self.dim.connections.push(self.inverted ? {from: to, to: from} : {from: from, to: to}); // inverted: the arrow points to the start
|
|
803
1050
|
|
|
804
1051
|
if(((end['row']-start['row']) == 0) && ((end['col']-start['col']) == 0)) return;
|
|
805
|
-
var line;
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
1052
|
+
var line = $X('<path xmlns="http://www.w3.org/2000/svg" class="edge"/>');
|
|
1053
|
+
let diag = false; // the arrow sits on a diagonal segment (into a gateway), so it has to be closer to the center
|
|
1054
|
+
let sy = get_row(start['row'],start['col']) + self.height - self.conn_center + start.yoffset; // center of the symbols
|
|
1055
|
+
let ssym = self.dim.symbols[start['row']] && self.dim.symbols[start['row']][start['col']];
|
|
1056
|
+
if (self.lr && self.inverted && ssym && self.elements[ssym.type] && self.elements[ssym.type].svg && $('.part-end',self.elements[ssym.type].svg).length > 0) { // inverted: the arrow points into the start from its end, not under the task template (tasks are the symbols with a part-end)
|
|
1057
|
+
sy = get_row_end(start['row'],start['col']) - self.conn_center + start.yoffset; // as far in from the end as other arrows are from the start
|
|
1058
|
+
}
|
|
1059
|
+
let ey = get_row(end['row'],end['col']) + self.height - self.conn_center + end.yoffset;
|
|
1060
|
+
if (around) { // e.g. back in an empty loop: leave at 45 degrees to the right, go straight, enter at 45 degrees
|
|
1061
|
+
diag = true;
|
|
1062
|
+
let off = 7.5 + 7; // from the center to the corner of the gateway, then 7 further
|
|
1063
|
+
line.attr("d", "M " + String(cstart) + "," + String(sy) +" "+
|
|
1064
|
+
String(cstart+off) + "," + String(sy-off) +" "+
|
|
1065
|
+
String(cend+off) + "," + String(ey+off) +" "+
|
|
1066
|
+
String(cend) + "," + String(ey)
|
|
1067
|
+
);
|
|
1068
|
+
} else if (end['row']-start['row'] == 0 || end['col']-start['col'] == 0) { // straight line
|
|
1069
|
+
line.attr("d", "M " + String(cstart) + "," + String(sy) +" "+
|
|
1070
|
+
String(cend) + "," + String(ey)
|
|
813
1071
|
);
|
|
814
1072
|
} else if (end['row']-start['row'] > 0) { // downwards
|
|
815
1073
|
if (end['col']-start['col'] > 0) {// left - right
|
|
816
1074
|
if (self.compact) {
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
String(
|
|
820
|
-
String(cend) + "," + String(
|
|
1075
|
+
diag = self.inverted;
|
|
1076
|
+
line.attr("d", "M " + String(cstart) + "," + String(sy) +" "+
|
|
1077
|
+
String(cstart+14) + "," + String(get_row_end(start['row'],start['col'])) +" "+ // first turn of horizontal-line going away from node
|
|
1078
|
+
String(cend) + "," + String(get_row_end(start['row'],start['col'])) +" "+
|
|
1079
|
+
String(cend) + "," + String(ey)
|
|
821
1080
|
);
|
|
822
1081
|
} else {
|
|
823
|
-
line.attr("d", "M " + String(cstart) + "," + String(
|
|
824
|
-
String(cend) + "," + String(
|
|
825
|
-
String(cend) + "," + String(
|
|
1082
|
+
line.attr("d", "M " + String(cstart) + "," + String(sy) +" "+
|
|
1083
|
+
String(cend) + "," + String(sy) +" "+
|
|
1084
|
+
String(cend) + "," + String(ey)
|
|
826
1085
|
);
|
|
827
1086
|
}
|
|
828
1087
|
} else { // right - left
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
String(
|
|
832
|
-
String(cend) + "," + String(end['row']
|
|
1088
|
+
diag = !self.inverted;
|
|
1089
|
+
line.attr("d", "M " + String(cstart) + "," + String(sy) +" "+
|
|
1090
|
+
String(cstart) + "," + String(get_row(end['row'],end['col'])+self.height-32) +" "+
|
|
1091
|
+
String(cend+14) + "," + String(get_row(end['row'],end['col'])+self.height-32) +" "+ // last turn of horizontal-line going into the node
|
|
1092
|
+
String(cend) + "," + String(ey)
|
|
833
1093
|
);
|
|
834
1094
|
}
|
|
835
1095
|
} else if(end['row']-start['row'] < 0) { // upwards
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
String(
|
|
840
|
-
String(cend) + "," + String(
|
|
1096
|
+
diag = !self.inverted;
|
|
1097
|
+
let by = (self.lr ? get_row_end(start['row'],start['col']) : (self.dim.symbols.length-1)*self.height) + 4;
|
|
1098
|
+
line.attr("d", "M " + String(cstart) + "," + String(sy) +" "+
|
|
1099
|
+
String(cstart) + "," + String(by) +" "+
|
|
1100
|
+
String(cend+15) + "," + String(by) +" "+
|
|
1101
|
+
String(cend+15) + "," + String(get_row(end['row'],end['col'])+self.height+15)+" "+
|
|
1102
|
+
String(cend) + "," + String(ey)
|
|
841
1103
|
);
|
|
842
1104
|
}
|
|
1105
|
+
if (arrow) { line.attr(self.inverted ? 'marker-start' : 'marker-end', 'url(#' + (end.structural ? 'endarrow' : (diag ? 'arrowdiag' : 'arrow')) + (self.inverted ? 'rev' : '') + ')'); } // inverted: arrow points to the start
|
|
1106
|
+
if (self.lr) { line.attr('transform',lr_matrix()); } // connections are not part of the graph group
|
|
843
1107
|
self.svg.container.append(line);
|
|
844
1108
|
} // }}}
|
|
845
1109
|
// }}}
|
|
@@ -900,6 +1164,7 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
900
1164
|
} // }}}
|
|
901
1165
|
var gd = this.get_description = function() { // public {{{
|
|
902
1166
|
var serxml = $(description.get(0).documentElement).clone(true);
|
|
1167
|
+
serxml.attr('dir', illustrator.lr ? 'lr' : 'td'); // layout direction of the theme, e.g. for the bpmn export
|
|
903
1168
|
serxml.removeAttr('svg-id');
|
|
904
1169
|
serxml.removeAttr('svg-type');
|
|
905
1170
|
serxml.removeAttr('svg-subtype');
|
|
@@ -985,6 +1250,7 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
985
1250
|
// }}}
|
|
986
1251
|
// Adaption functions {{{
|
|
987
1252
|
this.insert_after = function(new_node, target, source_opts) { // {{{
|
|
1253
|
+
reset_used_id_list();
|
|
988
1254
|
if ($.isArray(new_node)) {
|
|
989
1255
|
$.each(new_node,function(k,v){
|
|
990
1256
|
var nn = self.source(v,source_opts);
|
|
@@ -999,6 +1265,7 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
999
1265
|
update();
|
|
1000
1266
|
} // }}}
|
|
1001
1267
|
this.insert_first_into = function(new_node, target, source_opts) { // {{{
|
|
1268
|
+
reset_used_id_list();
|
|
1002
1269
|
if ($.isArray(new_node)) {
|
|
1003
1270
|
$.each(new_node,function(k,v){
|
|
1004
1271
|
var nn = self.source(v,source_opts);
|
|
@@ -1013,6 +1280,7 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
1013
1280
|
update();
|
|
1014
1281
|
} // }}}
|
|
1015
1282
|
this.insert_last_into = function(new_node, target) { // {{{
|
|
1283
|
+
reset_used_id_list();
|
|
1016
1284
|
if ($.isArray(new_node)) {
|
|
1017
1285
|
$.each(new_node,function(k,v){
|
|
1018
1286
|
var nn = self.source(v);
|
|
@@ -1057,11 +1325,15 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
1057
1325
|
$(this).removeAttr('svg-label');
|
|
1058
1326
|
});
|
|
1059
1327
|
} //}}}
|
|
1060
|
-
var
|
|
1328
|
+
var reversed_loop = function(node) { // private {{{
|
|
1329
|
+
return illustrator.wellformed_pre_test && node.tagName == 'loop' && $(node).attr('mode') == 'pre_test';
|
|
1330
|
+
} // }}}
|
|
1331
|
+
var parse = function(root, parent_pos, first_prev) { // private {{{
|
|
1061
1332
|
var pos = JSON.parse(JSON.stringify(parent_pos));
|
|
1062
1333
|
var max = {'row': 0,'col': 0};
|
|
1063
|
-
var prev = [parent_pos]; // connects parent with child(s), depending on the expansion
|
|
1334
|
+
var prev = [first_prev || parent_pos]; // connects parent with child(s), depending on the expansion
|
|
1064
1335
|
var endnodes = [];
|
|
1336
|
+
var markers = []; // wellformed_pre_test: branch markers, drawn in one row below all branches
|
|
1065
1337
|
var sname = sym_name(root.tagName,root);
|
|
1066
1338
|
var root_expansion = illustrator.elements[root.tagName].expansion(root);
|
|
1067
1339
|
var block = { 'max': {'row': pos.row, 'col': pos.col}, 'endnodes': [], 'svg': $X('<g class="group" xmlns="http://www.w3.org/2000/svg"/>') };
|
|
@@ -1080,10 +1352,12 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
1080
1352
|
labels.push({...{row: pos.row, element_id: 'start', tname: 'start', label: illustrator.elements[sname].label(root)},...illustrator.draw.get_y(pos.row)});
|
|
1081
1353
|
}
|
|
1082
1354
|
illustrator.global_style = (illustrator.elements[sname].style && root) ? illustrator.elements[sname].style(root) : {};
|
|
1083
|
-
illustrator.draw.draw_symbol(sname, 'description', '
|
|
1355
|
+
illustrator.draw.draw_symbol(sname, 'description', '', pos.row, pos.row, pos.row, pos.col, block.svg, false, {}, {})
|
|
1084
1356
|
} // }}}
|
|
1085
1357
|
|
|
1086
|
-
$(root).children().filter(function(){ return this.localName[0] != '_'; })
|
|
1358
|
+
var children = $(root).children().filter(function(){ return this.localName[0] != '_'; });
|
|
1359
|
+
if (illustrator.inverted && root_expansion != 'horizontal') { children = $(children.get().reverse()); } // wellformed_pre_test: everything inside is drawn in reverse order, but not the branches
|
|
1360
|
+
children.each(function() {
|
|
1087
1361
|
var context = this;
|
|
1088
1362
|
var tname = context.tagName;
|
|
1089
1363
|
var sname = sym_name(tname,context);
|
|
@@ -1096,32 +1370,52 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
1096
1370
|
if(root_expansion == 'horizontal') {
|
|
1097
1371
|
// for noindent themes do not indent the first column
|
|
1098
1372
|
if (!pos.noindent || (pos.noindent && endnodes.length > 1)) {
|
|
1099
|
-
illustrator.dim.set_x(pos.row,pos.col,illustrator.width
|
|
1373
|
+
illustrator.dim.set_x(pos.row,pos.col,illustrator.width);
|
|
1100
1374
|
pos.col++;
|
|
1101
1375
|
}
|
|
1102
1376
|
if (!illustrator.compact) {
|
|
1103
1377
|
if (block.max.row) {
|
|
1104
|
-
illustrator.dim.set_x(pos.row,pos.col,illustrator.width
|
|
1378
|
+
illustrator.dim.set_x(pos.row,pos.col,illustrator.width);
|
|
1105
1379
|
pos.row = block.max.row + 1;
|
|
1106
1380
|
}
|
|
1107
1381
|
}
|
|
1108
1382
|
}
|
|
1109
1383
|
|
|
1384
|
+
var bottom = false;
|
|
1110
1385
|
if(illustrator.elements[tname] != undefined && illustrator.elements[tname].type == 'complex') {
|
|
1386
|
+
bottom = illustrator.inverted && root_expansion == 'horizontal'; // wellformed_pre_test: branch markers are drawn below their content
|
|
1111
1387
|
if(illustrator.elements[tname] != undefined && !illustrator.elements[tname].svg) pos.row--;
|
|
1112
1388
|
// TODO: Remaining problem is the order inside the svg. Thats why the connection is above the icon
|
|
1113
1389
|
|
|
1114
|
-
illustrator.dim.set_x(pos.row,pos.col,illustrator.width
|
|
1390
|
+
illustrator.dim.set_x(pos.row,pos.col,illustrator.width);
|
|
1391
|
+
illustrator.dim.set_row(pos.row,pos.col,prev);
|
|
1392
|
+
if ((bottom ? !illustrator.lr : (illustrator.lr && illustrator.elements[tname].expansion(context) == 'vertical' && !illustrator.elements[tname].col_shift(context))) && illustrator.elements[sname].svg) { // lr: the content follows the label in the same column, bottom: the marker is drawn after the next branches, so measure the symbol before it is drawn
|
|
1393
|
+
let lab = (illustrator.elements[sname].label ? illustrator.elements[sname].label(context) : []) || [];
|
|
1394
|
+
let tit = lab.find((l) => l && l.column == 'Label' && l.value);
|
|
1395
|
+
illustrator.draw.draw_symbol(sname, 'measure', tit ? tit.value : undefined, pos.row, pos.row, pos.row, pos.col, $X('<g xmlns="http://www.w3.org/2000/svg"/>'), true, {}, {});
|
|
1396
|
+
}
|
|
1115
1397
|
// but fuuuuu, we calculate the gateways only later, so we couldnt even have them bigger for now
|
|
1116
1398
|
|
|
1117
1399
|
// console.log('----> down', tname, parent_pos.row, pos.row, parent_pos.col, pos.col, illustrator.dim.debug());
|
|
1118
1400
|
|
|
1119
|
-
|
|
1401
|
+
if (reversed_loop(context)) { illustrator.inverted = !illustrator.inverted; }
|
|
1402
|
+
let tblock;
|
|
1403
|
+
if (bottom) { // content starts in the row of the marker and connects to the gateway
|
|
1404
|
+
let up = JSON.parse(JSON.stringify(pos));
|
|
1405
|
+
up.row--;
|
|
1406
|
+
tblock = parse(context, up, prev[0]);
|
|
1407
|
+
} else {
|
|
1408
|
+
tblock = parse(context, JSON.parse(JSON.stringify(pos)));
|
|
1409
|
+
}
|
|
1410
|
+
if (reversed_loop(context)) { illustrator.inverted = !illustrator.inverted; }
|
|
1120
1411
|
|
|
1121
1412
|
// merge block and tblock, enforce the max, as the second branch could have fewer nodes than the first
|
|
1122
1413
|
block.max.row = Math.max(block.max.row,tblock.max.row);
|
|
1123
1414
|
block.max.col = Math.max(block.max.col,tblock.max.col);
|
|
1124
1415
|
block.endnodes = tblock.endnodes;
|
|
1416
|
+
if (bottom) { // markers are drawn after all branches, see below
|
|
1417
|
+
markers.push({ tname: tname, sname: sname, context: context, prev: tblock.endnodes, col: pos.col, top: pos.row, maxcol: tblock.max.col });
|
|
1418
|
+
}
|
|
1125
1419
|
|
|
1126
1420
|
// console.log('<---- up', tname, parent_pos.row, block.max.row, parent_pos.col, block.max.col, illustrator.dim.debug());
|
|
1127
1421
|
|
|
@@ -1138,9 +1432,11 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
1138
1432
|
// }}}
|
|
1139
1433
|
|
|
1140
1434
|
var g;
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1435
|
+
if (!bottom) {
|
|
1436
|
+
set_details(tname,sname,pos,context);
|
|
1437
|
+
var origpos = JSON.parse(JSON.stringify(pos));
|
|
1438
|
+
[g, endnodes] = draw_position(tname,parent_pos,origpos,prev,block,endnodes,context);
|
|
1439
|
+
}
|
|
1144
1440
|
|
|
1145
1441
|
// Prepare next iteration {{{
|
|
1146
1442
|
if(root_expansion == 'vertical') { prev = JSON.parse(JSON.stringify(endnodes)); pos.row = block.max.row;} // covers e.g. input's for alternative, parallel_branch, ... everything with horizontal expansion
|
|
@@ -1155,6 +1451,11 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
1155
1451
|
pos.row++;
|
|
1156
1452
|
max.row++;
|
|
1157
1453
|
block.max.row = pos.row;
|
|
1454
|
+
// the arrows to the closing symbol belong to the loop. empty loops: the
|
|
1455
|
+
// straight arrow comes from the opening symbol, not from the content, and
|
|
1456
|
+
// the way back goes around the side, so both point the other way
|
|
1457
|
+
let flip = reversed_loop(context) != (illustrator.elements[csname].closeblock == true && pos.row == origpos.row + 1);
|
|
1458
|
+
if (flip) { illustrator.inverted = !illustrator.inverted; }
|
|
1158
1459
|
if (illustrator.elements[sname].endnodes == 'this') {
|
|
1159
1460
|
pos.col++;
|
|
1160
1461
|
if (pos.col > max.col) {
|
|
@@ -1168,12 +1469,13 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
1168
1469
|
set_details(ctname,csname,pos,context,true);
|
|
1169
1470
|
[undefined, endnodes] = draw_position(ctname,parent_pos,pos,prev,block,[],context,{svg: g, pos: origpos});
|
|
1170
1471
|
}
|
|
1472
|
+
if (flip) { illustrator.inverted = !illustrator.inverted; }
|
|
1171
1473
|
if (illustrator.elements[sname].border == 'structural') {
|
|
1172
1474
|
// structural border: outgoing arrow starts at the group border instead of from the icon
|
|
1173
1475
|
// small y offset.
|
|
1174
1476
|
endnodes = endnodes.map(function(p) {
|
|
1175
1477
|
var np = JSON.parse(JSON.stringify(p));
|
|
1176
|
-
np.yoffset = illustrator.height_shift/2 + illustrator.group_extend +
|
|
1478
|
+
np.yoffset = illustrator.height_shift/2 + illustrator.group_extend + illustrator.conn_center - illustrator.structural_tighten;
|
|
1177
1479
|
return np;
|
|
1178
1480
|
});
|
|
1179
1481
|
}
|
|
@@ -1181,8 +1483,27 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
1181
1483
|
}
|
|
1182
1484
|
});
|
|
1183
1485
|
|
|
1486
|
+
if (markers.length > 0) {
|
|
1487
|
+
max.row++;
|
|
1488
|
+
block.max.row = max.row;
|
|
1489
|
+
let maxcol = block.max.col;
|
|
1490
|
+
if (illustrator.lr) { // all markers start at the same position, after the longest branch
|
|
1491
|
+
markers.forEach((m) => { illustrator.dim.set_row(max.row,m.col,m.prev); });
|
|
1492
|
+
let start = Math.max(...markers.map((m) => illustrator.dim.get_row(max.row,m.col)));
|
|
1493
|
+
markers.forEach((m) => { illustrator.dim.rows[max.row][m.col].start = start; });
|
|
1494
|
+
}
|
|
1495
|
+
markers.forEach((m) => {
|
|
1496
|
+
let mpos = { row: max.row, col: m.col, final: false, wide: false, yoffset: 0, top: m.top, marker: true }; // the tile starts at the top of the branch
|
|
1497
|
+
block.endnodes = [mpos]; // the marker is the end of its branch
|
|
1498
|
+
block.max.col = m.maxcol; // the tile only covers its own branch
|
|
1499
|
+
set_details(m.tname,m.sname,mpos,m.context);
|
|
1500
|
+
draw_position(m.tname,parent_pos,mpos,m.prev,block,endnodes,m.context);
|
|
1501
|
+
});
|
|
1502
|
+
block.max.col = maxcol;
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1184
1505
|
if($(root).children().filter(function(){ return this.attributes['svg-id'] != undefined; }).length == 0) { // empty complex found
|
|
1185
|
-
endnodes = [
|
|
1506
|
+
endnodes = [prev[0]]; // parent_pos, or for markers below their content the gateway
|
|
1186
1507
|
max.row = parent_pos.row;
|
|
1187
1508
|
max.col = parent_pos.col;
|
|
1188
1509
|
}
|
|
@@ -1233,6 +1554,7 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
1233
1554
|
// console.log('----- pos ' + sname, parent_pos.row, block.max.row, parent_pos.col, block.max.col, block, illustrator.dim.debug());
|
|
1234
1555
|
|
|
1235
1556
|
// Draw Symbol {{{
|
|
1557
|
+
illustrator.dim.set_row(pos.row,pos.col,prev);
|
|
1236
1558
|
let style = {};
|
|
1237
1559
|
if (illustrator.elements[sname].style && context) {
|
|
1238
1560
|
style = illustrator.elements[sname].style(context);
|
|
@@ -1265,7 +1587,7 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
1265
1587
|
if (illustrator.elements[sname].closing_symbol) {
|
|
1266
1588
|
illustrator.draw.draw_tile($(context).attr('svg-id'), pos, { col: wide, row: block.max.row + 1 }, block.svg, yshrink);
|
|
1267
1589
|
} else {
|
|
1268
|
-
illustrator.draw.draw_tile($(context).attr('svg-id'), pos, { col: wide, row: block.max.row }, block.svg, yshrink);
|
|
1590
|
+
illustrator.draw.draw_tile($(context).attr('svg-id'), pos.top ? { row: pos.top, col: pos.col } : pos, { col: wide, row: block.max.row }, block.svg, yshrink); // top: marker below its content
|
|
1269
1591
|
}
|
|
1270
1592
|
}
|
|
1271
1593
|
}
|
|
@@ -1278,7 +1600,7 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
1278
1600
|
// structural border: incoming arrow stops at the group border instead of reaching into the icon
|
|
1279
1601
|
// (only a pixel-level yoffset, row/col stay integers so get_x() column lookups stay correct)
|
|
1280
1602
|
conn_target = JSON.parse(JSON.stringify(pos));
|
|
1281
|
-
conn_target.yoffset = -illustrator.height + illustrator.height_shift/2 - illustrator.group_extend +
|
|
1603
|
+
conn_target.yoffset = -illustrator.height + illustrator.height_shift/2 - illustrator.group_extend + illustrator.conn_center + illustrator.structural_tighten;
|
|
1282
1604
|
conn_target.structural = true;
|
|
1283
1605
|
}
|
|
1284
1606
|
if(illustrator.elements[sname] != undefined && illustrator.elements[sname].closeblock == true) { // Close Block if element e.g. loop
|
|
@@ -1287,6 +1609,9 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
1287
1609
|
connection_case = 1;
|
|
1288
1610
|
// console.log('++ case 1',prev[node].row,pos.row,illustrator.dim.debug());
|
|
1289
1611
|
illustrator.draw.draw_connection(block.svg, pos, second.pos, 0, true);
|
|
1612
|
+
} else { // no content: the way back goes around the side
|
|
1613
|
+
connection_case = 7;
|
|
1614
|
+
illustrator.draw.draw_connection(block.svg, pos, second.pos, 0, true, true);
|
|
1290
1615
|
}
|
|
1291
1616
|
} else {
|
|
1292
1617
|
for (let node=0; node < block.endnodes.length; node++) {
|
|
@@ -1305,9 +1630,9 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
1305
1630
|
connection_case = 3;
|
|
1306
1631
|
illustrator.draw.draw_connection(block.svg, { row: 1, col: 1, yoffset: 0 }, conn_target, 0, true);
|
|
1307
1632
|
} else {
|
|
1308
|
-
if (illustrator.elements[sname].noarrow == undefined || illustrator.elements[sname].noarrow == false) {
|
|
1633
|
+
if (illustrator.elements[sname].noarrow == undefined || illustrator.elements[sname].noarrow == false || illustrator.inverted) { // inverted: the arrow points from the marker to the content
|
|
1309
1634
|
for (let node=0; node < prev.length; node++) {
|
|
1310
|
-
if (prev[node] && !prev[node].final) {
|
|
1635
|
+
if (prev[node] && !(illustrator.inverted ? pos.final : prev[node].final)) { // inverted: nothing goes out of a final element, which is drawn as the target
|
|
1311
1636
|
if (prev[node].wide) {
|
|
1312
1637
|
var pn = JSON.parse(JSON.stringify(prev[node]));
|
|
1313
1638
|
if (pos.col > prev[node].col) {
|
|
@@ -1320,10 +1645,10 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
1320
1645
|
connection_case = 5;
|
|
1321
1646
|
if (prev.length == 1) {
|
|
1322
1647
|
// console.log('++ case 5a',parent_pos.row, '---', prev[node].row,pos.row,illustrator.dim.debug());
|
|
1323
|
-
illustrator.draw.draw_connection(block.svg, prev[node], conn_target, 0,
|
|
1648
|
+
illustrator.draw.draw_connection(block.svg, prev[node], conn_target, 0, !prev[node].marker);
|
|
1324
1649
|
} else {
|
|
1325
1650
|
// console.log('++ case 5b',prev[node].row,pos.row,illustrator.dim.debug());
|
|
1326
|
-
illustrator.draw.draw_connection(block.svg, prev[node], conn_target, 0,
|
|
1651
|
+
illustrator.draw.draw_connection(block.svg, prev[node], conn_target, 0, !prev[node].marker); // no arrow into markers drawn below their content
|
|
1327
1652
|
}
|
|
1328
1653
|
}
|
|
1329
1654
|
}
|