Merge branch 'master' into dev

This commit is contained in:
Nick O'Leary
2020-09-03 16:14:55 +01:00
6 changed files with 176 additions and 111 deletions

View File

@@ -119,6 +119,9 @@
if (evt.keyCode === 27) {
that.element.val("");
}
if (evt.keyCode === 13) {
evt.preventDefault();
}
})
this.element.on("keyup",function(evt) {
that._change($(this).val());

View File

@@ -380,11 +380,16 @@ RED.group = (function() {
return;
}
}
var existingGroup;
// Second pass, ungroup any groups in the selection and add their contents
// to the selection
for (var i=0; i<selection.nodes.length; i++) {
n = selection.nodes[i];
if (n.type === "group") {
if (!existingGroup) {
existingGroup = n;
}
ungroupHistoryEvent.groups.push(n);
nodes = nodes.concat(ungroup(n));
} else {
@@ -398,6 +403,10 @@ RED.group = (function() {
// Finally, create the new group
var group = createGroup(nodes);
if (group) {
if (existingGroup) {
group.style = existingGroup.style;
group.name = existingGroup.name;
}
RED.view.select({nodes:[group]})
}
historyEvent.events.push({

View File

@@ -1678,7 +1678,7 @@ RED.view = (function() {
}
}
if (ns.length > 0) {
if (ns.length > 0 && mouse_mode == RED.state.MOVING_ACTIVE) {
historyEvent = {t:"move",nodes:ns,dirty:RED.nodes.dirty()};
if (activeSpliceLink) {
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp
@@ -2354,6 +2354,10 @@ RED.view = (function() {
mousedown_port_type = null;
activeSpliceLink = null;
spliceActive = false;
if (activeHoverGroup) {
activeHoverGroup.hovered = false;
activeHoverGroup = null;
}
d3.select(".red-ui-flow-link-splice").classed("red-ui-flow-link-splice",false);
if (spliceTimer) {
clearTimeout(spliceTimer);
@@ -2869,7 +2873,7 @@ RED.view = (function() {
//RED.touch.radialMenu.show(d3.select(this),pos);
if (mouse_mode == RED.state.IMPORT_DRAGGING) {
RED.keyboard.remove("escape");
var historyEvent = RED.history.peek();
if (activeSpliceLink) {
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp
var spliceLink = d3.select(activeSpliceLink).data()[0];
@@ -2886,12 +2890,27 @@ RED.view = (function() {
};
RED.nodes.addLink(link1);
RED.nodes.addLink(link2);
var historyEvent = RED.history.peek();
historyEvent.links = [link1,link2];
historyEvent.removedLinks = [spliceLink];
updateActiveNodes();
}
if (activeHoverGroup) {
for (var j=0;j<movingSet.length();j++) {
var n = movingSet.get(j);
RED.group.addToGroup(activeHoverGroup,n.n);
}
historyEvent.addedToGroup = activeHoverGroup;
activeHoverGroup.hovered = false;
enterActiveGroup(activeHoverGroup)
// TODO: check back whether this should add to moving_set
activeGroup.selected = true;
activeHoverGroup = null;
}
updateSelection();
RED.nodes.dirty(true);
redraw();
@@ -4418,6 +4437,7 @@ RED.view = (function() {
}
if (d.dirty || dirtyGroups[d.id]) {
var g = d3.select(this);
var recalculateLabelOffsets = false;
if (d.nodes.length > 0) {
// If the group was just moved, all of its contents was
// also moved - so no need to recalculate its bounding box
@@ -4446,6 +4466,7 @@ RED.view = (function() {
d.y = minY;
d.w = maxX - minX;
d.h = maxY - minY;
recalculateLabelOffsets = true;
// if set explicitly to false, this group has just been
// imported so needed this initial resize calculation.
// Now that's done, delete the flag so the normal
@@ -4459,28 +4480,31 @@ RED.view = (function() {
} else {
d.w = 40;
d.h = 40;
recalculateLabelOffsets = true;
}
if (!d.minWidth) {
if (d.style.label && d.name) {
var labelParts = getLabelParts(d.name||"","red-ui-flow-group-label");
d.minWidth = labelParts.width + 8;
d.labels = labelParts.lines;
} else {
d.minWidth = 40;
d.labels = [];
if (recalculateLabelOffsets) {
if (!d.minWidth) {
if (d.style.label && d.name) {
var labelParts = getLabelParts(d.name||"","red-ui-flow-group-label");
d.minWidth = labelParts.width + 8;
d.labels = labelParts.lines;
} else {
d.minWidth = 40;
d.labels = [];
}
}
}
d.w = Math.max(d.minWidth,d.w);
if (d.style.label && d.labels.length > 0) {
var labelPos = d.style["label-position"] || "nw";
var h = (d.labels.length-1) * 16;
if (labelPos[0] === "s") {
h += 8;
}
d.h += h;
if (labelPos[0] === "n") {
if (d.nodes.length > 0) {
d.y -= h;
d.w = Math.max(d.minWidth,d.w);
if (d.style.label && d.labels.length > 0) {
var labelPos = d.style["label-position"] || "nw";
var h = (d.labels.length-1) * 16;
if (labelPos[0] === "s") {
h += 8;
}
d.h += h;
if (labelPos[0] === "n") {
if (d.nodes.length > 0) {
d.y -= h;
}
}
}
}