[Bps-public-commit] rt-extension-lifecycleui branch, master, updated. e321caf4ad8bd3b23a6f4c05bc70137062dbd060

Shawn Moore shawn at bestpractical.com
Wed Sep 20 15:52:26 EDT 2017


The branch, master has been updated
       via  e321caf4ad8bd3b23a6f4c05bc70137062dbd060 (commit)
       via  2638477e972ec2fc48220ffbea5f8c8910948a54 (commit)
       via  b912ad01f6ad81341ccf789fe67d46136b4bc73c (commit)
      from  8a4a824c8e8e9e81913d52565ba9953fb0352d80 (commit)

Summary of changes:
 static/css/lifecycleui-editor.css             |  1 -
 static/css/lifecycleui-viewer-interactive.css |  4 ++++
 static/js/lifecycleui-editor.js               | 31 +++++++++++++++++++++------
 static/js/lifecycleui-model.js                |  4 ++++
 static/js/lifecycleui-viewer-interactive.js   |  6 ++++++
 5 files changed, 38 insertions(+), 8 deletions(-)

- Log -----------------------------------------------------------------
commit b912ad01f6ad81341ccf789fe67d46136b4bc73c
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Sep 20 19:10:49 2017 +0000

    Highlight the status for which you clicked to open a menu

diff --git a/static/css/lifecycleui-viewer-interactive.css b/static/css/lifecycleui-viewer-interactive.css
index 191a048..e7c237b 100644
--- a/static/css/lifecycleui-viewer-interactive.css
+++ b/static/css/lifecycleui-viewer-interactive.css
@@ -48,3 +48,7 @@
     box-shadow: 2px 2px 8px -2px #999;
 }
 
+.lifecycle-ui .statuses circle.selected {
+    filter: url(#hover);
+}
+
diff --git a/static/js/lifecycleui-viewer-interactive.js b/static/js/lifecycleui-viewer-interactive.js
index 79a0e8f..df5c1bd 100644
--- a/static/js/lifecycleui-viewer-interactive.js
+++ b/static/js/lifecycleui-viewer-interactive.js
@@ -9,6 +9,8 @@ jQuery(function () {
     Interactive.prototype.deselectStatus = function () {
         delete this.selectedStatus;
         delete this.selectedMenu;
+
+        this.statusContainer.selectAll('.selected').classed('selected', false);
         this.menuContainer.find('.status-menu.selected').removeClass('selected');
     };
 
@@ -30,6 +32,10 @@ jQuery(function () {
         var statusName = d.name;
         this.selectedMenu = this.menuContainer.find('.status-menu[data-status="'+statusName+'"]');
         this.selectedStatus = d;
+        var circle = this.statusContainer.select('circle[data-key="'+ d._key + '"]');
+
+        this.statusContainer.selectAll('.selected').classed('selected', false);
+        circle.classed('selected', true);
 
         this.menuContainer.find('.status-menu.selected').removeClass('selected');
         this.selectedMenu.addClass('selected');

commit 2638477e972ec2fc48220ffbea5f8c8910948a54
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Sep 20 19:22:33 2017 +0000

    Make pointHandleRadius a JS accessor rather than CSS
    
    We'll need it for positioning the circle radius pointHandle

diff --git a/static/css/lifecycleui-editor.css b/static/css/lifecycleui-editor.css
index 08393a9..f495cc7 100644
--- a/static/css/lifecycleui-editor.css
+++ b/static/css/lifecycleui-editor.css
@@ -46,7 +46,6 @@
 .lifecycle-ui .has-focus .point-handle {
     stroke: black;
     fill: steelblue;
-    r: 5px;
 }
 
 .lifecycle-ui .inspector .actions {
diff --git a/static/js/lifecycleui-editor.js b/static/js/lifecycleui-editor.js
index e25951a..b5b8214 100644
--- a/static/js/lifecycleui-editor.js
+++ b/static/js/lifecycleui-editor.js
@@ -3,6 +3,7 @@ jQuery(function () {
 
     function Editor (container) {
         Super.call(this);
+        this.pointHandleRadius = 5;
     };
     Editor.prototype = Object.create(Super.prototype);
 
@@ -403,6 +404,7 @@ jQuery(function () {
 
         handles.enter().append("circle")
                      .classed("point-handle", true)
+                     .attr("r", self.pointHandleRadius)
                      .call(d3.drag()
                          .subject(function (d) { return { x: self.xScaleZero(d.x), y : self.yScaleZero(d.y) } })
                          .on("start", function (d) { self.didBeginDrag(d, this) })

commit e321caf4ad8bd3b23a6f4c05bc70137062dbd060
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Sep 20 19:51:20 2017 +0000

    Add point handle for setting circle radius

diff --git a/static/js/lifecycleui-editor.js b/static/js/lifecycleui-editor.js
index b5b8214..53af54f 100644
--- a/static/js/lifecycleui-editor.js
+++ b/static/js/lifecycleui-editor.js
@@ -308,14 +308,24 @@ jQuery(function () {
     Editor.prototype.addPointHandles = function (d) {
         var self = this;
         var points = [];
-        for (var i = 0; i < d.points.length; ++i) {
+
+        if (d._type == 'circle') {
             points.push({
-                _key: d._key + '-' + i,
-                i: i,
-                x: d.points[i].x,
-                y: d.points[i].y
+                _key: d._key + '-r',
+                x: this.xScaleZeroInvert(d.r + this.pointHandleRadius/2),
+                y: 0
             });
         }
+        else {
+            for (var i = 0; i < d.points.length; ++i) {
+                points.push({
+                    _key: d._key + '-' + i,
+                    i: i,
+                    x: d.points[i].x,
+                    y: d.points[i].y
+                });
+            }
+        }
         self.pointHandles = points;
     };
 
@@ -344,7 +354,12 @@ jQuery(function () {
         d.x = x;
         d.y = y;
 
-        this.lifecycle.movePolygonPoint(this.inspectorNode, d.i, x, y);
+        if (this.inspectorNode._type == 'circle') {
+            this.lifecycle.moveCircleRadiusPoint(this.inspectorNode, this.xScaleZero(x), this.yScaleZero(y));
+        }
+        else {
+            this.lifecycle.movePolygonPoint(this.inspectorNode, d.i, x, y);
+        }
 
         this.renderDisplay();
     };
@@ -585,7 +600,7 @@ jQuery(function () {
         Super.prototype.focusItem.call(this, item);
         this.setInspectorContent(item);
 
-        if (item._type == 'polygon' || item._type == 'line') {
+        if (item._type == 'polygon' || item._type == 'line' || item._type == 'circle') {
             this.addPointHandles(item);
         }
 
diff --git a/static/js/lifecycleui-model.js b/static/js/lifecycleui-model.js
index 47e37b9..c9511e9 100644
--- a/static/js/lifecycleui-model.js
+++ b/static/js/lifecycleui-model.js
@@ -544,6 +544,10 @@ jQuery(function () {
         item.y = y;
     };
 
+    Lifecycle.prototype.moveCircleRadiusPoint = function (circle, x, y) {
+        circle.r = Math.max(10, Math.sqrt(x**2 + y**2));
+    }
+
     Lifecycle.prototype.movePolygonPoint = function (polygon, index, x, y) {
         var point = polygon.points[index];
         point.x = x;

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list