[Rt-commit] rt branch, 4.6/lifecycle-ui-dev, repushed
Craig Kaiser
craig at bestpractical.com
Mon Dec 2 08:41:36 EST 2019
The branch 4.6/lifecycle-ui-dev was deleted and repushed:
was f45bc0d57a62f0da5b43836f73d5dbe86a9eefed
now 51e18270ae70f64723d500c13c7bddfb6a6952c3
1: f45bc0d57a ! 1: 51e18270ae Core Lifecycle-UI
@@ -1732,7 +1732,16 @@
+ self.node.select("circle")
+ .attr("r", self.node_radius)
+ .attr("stroke", "black")
-+ .attr("fill", '#547CCC' )
++ .attr("fill", function(d) {
++ switch(d.type) {
++ case 'active':
++ return '#547CCC';
++ case 'inactive':
++ return '#4bb2cc';
++ case 'initial':
++ return '#599ACC';
++ }
++ })
+ .on("click", function() {
+ d3.event.stopPropagation();
+ d3.event.preventDefault();
@@ -1775,8 +1784,12 @@
+
+ self.node.select("text")
+ .text(function(d) { return d.name; })
-+ .each(function () { self.TruncateLabel(this); })
-+ .attr("x", -self.node_radius/2)
++ .each(function () { self.TruncateLabel(this, self); })
++ .attr("x", function(d) {
++ var node = d3.select(this), textLength = node.node().getComputedTextLength();
++ if ( textLength > self.node_radius*2 ) textLength = self.node_radius*2;
++ return -textLength/2;
++ })
+ .attr("y", 0)
+ .style("font-size", "10px")
+ .on("click", function(d) {
@@ -1798,6 +1811,10 @@
+ if ( element ) {
+ for (let item of list) {
+ jQuery(item).val(element[item.name]);
++ // Can we make this check for the select bootstrap class instead of hard coding the known fields?
++ if ( item.name === 'type' ) {
++ jQuery(".bootstrap-select .filter-option").text(element[item.name])
++ }
+ }
+ self.editing_node = element;
+ }
@@ -1896,10 +1913,11 @@
+ .classed('node-selected', false);
+ }
+
-+ TruncateLabel(element) {
++ TruncateLabel(element, self) {
+ var node = d3.select(element), textLength = node.node().getComputedTextLength(), text = node.text();
-+
-+ while (textLength > 45 && text.length > 0) {
++ var diameter = self.node_radius * 2 - textLength/4;
++
++ while (textLength > diameter && text.length > 0) {
+ text = text.slice(0, -1);
+ node.text(text + '…');
+ textLength = node.node().getComputedTextLength();
More information about the rt-commit
mailing list