add cursor change for non-allowed operations
diff --git a/web/ons-demo/css/skin.default.css b/web/ons-demo/css/skin.default.css
index 579d940..5f3d114 100644
--- a/web/ons-demo/css/skin.default.css
+++ b/web/ons-demo/css/skin.default.css
@@ -6,6 +6,14 @@
margin: 0px;
}
+#topology.linking {
+ cursor: crosshair;
+}
+
+.nodrop {
+ cursor: not-allowed;
+}
+
.status {
padding: 1em;
}
diff --git a/web/ons-demo/js/app.js b/web/ons-demo/js/app.js
index daf767c..491b1f1 100644
--- a/web/ons-demo/js/app.js
+++ b/web/ons-demo/js/app.js
@@ -349,10 +349,15 @@
// var flowMap = createFlowMap(model);
function mouseOverSwitch(data) {
+
+ d3.event.preventDefault();
+
if (data.highlighted) {
return;
}
+
+
// only highlight valid link or flow destination by checking for class of existing highlighted circle
var highlighted = svg.selectAll('circle.highlight')[0];
if (highlighted.length == 1) {
@@ -402,12 +407,27 @@
function mouseDownSwitch(data) {
mouseOverSwitch(data);
data.mouseDown = true;
+ d3.select('#topology').classed('linking', true);
+
+ if (data.className === 'core') {
+ d3.selectAll('.edge').classed('nodrop', true);
+ }
+ if (data.className === 'edge') {
+ d3.selectAll('.core').classed('nodrop', true);
+ d3.selectAll('.aggregation').classed('nodrop', true);
+ }
+ if (data.className === 'aggregation') {
+ d3.selectAll('.edge').classed('nodrop', true);
+ d3.selectAll('.aggregation').classed('nodrop', true);
+ }
}
function mouseUpSwitch(data) {
if (data.mouseDown) {
data.mouseDown = false;
+ d3.select('#topology').classed('linking', false);
d3.event.stopPropagation();
+ d3.selectAll('.nodrop').classed('nodrop', false);
}
}
@@ -519,10 +539,13 @@
function clearHighlight() {
svg.selectAll('circle').each(function (data) {
data.mouseDown = false;
+ d3.select('#topology').classed('linking', false);
mouseOutSwitch(data);
})
};
+ d3.selectAll('.nodrop').classed('nodrop', false);
+
function removeLink(link) {
var path1 = document.getElementById(link['src-switch'] + '=>' + link['dst-switch']);
var path2 = document.getElementById(link['dst-switch'] + '=>' + link['src-switch']);
@@ -840,6 +863,7 @@
svg = createTopologyView();
selectedFlowsView = createFlowView();
+
// workaround for Chrome v25 bug
// if executed immediately, the view box transform logic doesn't work properly
// fixed in Chrome v27