Commit 05cfe2eb authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

improve graph editor UI.

parent 6cf868fc
...@@ -268,8 +268,43 @@ path, ._jsPlumb_endpoint { cursor:pointer; } ...@@ -268,8 +268,43 @@ path, ._jsPlumb_endpoint { cursor:pointer; }
font-style:italic; font-style:italic;
padding-top:0.9em; padding-top:0.9em;
font-size:0.9em; font-size:0.9em;
z-index:4;
cursor:move;
background-color:white;
font-size:11px;
-webkit-transition:background-color 0.1s ease-in;
-moz-transition:background-color 0.1s ease-in;
transition:background-color 0.1s ease-in;
}
.window:hover {
background-color: #5c96bc;
color:white;
} }
#debug textarea { #debug textarea {
width:100%; width:100%;
} }
.ep {
position:absolute;
bottom:37%;
right:5px;
width:1em;
height:1em;
background-color:orange;
cursor:pointer;
box-shadow: 0px 0px 2px black;
-webkit-transition:-webkit-box-shadow 0.25s ease-in;
-moz-transition:-moz-box-shadow 0.25s ease-in;
transition:box-shadow 0.25s ease-in;
}
._jsPlumb_source_hover, ._jsPlumb_target_hover, .dragHover {
background-color:#1e8151;
color:white;
}
path {
cursor:pointer;
}
...@@ -181,7 +181,7 @@ ...@@ -181,7 +181,7 @@
that.newElement = function (element) { that.newElement = function (element) {
var element_type = element._class.replace('.', '-'); var element_type = element._class.replace('.', '-');
element.element_id = that.generateElementId(); element.element_id = that.generateElementId();
if (! element.id) { if (!element.id) {
element.id = that.generateNodeId(element_type); element.id = that.generateNodeId(element_type);
} }
priv.super_newElement(element, configuration[element_type]); priv.super_newElement(element, configuration[element_type]);
......
...@@ -158,74 +158,40 @@ ...@@ -158,74 +158,40 @@
var configuration = { var configuration = {
"Dream-Source": { "Dream-Source": {
anchor: {
RightMiddle: {}
},
/* TODO: make anchor not a configuration option and allow to connect from everywhere */
property_list: [property_container["interarrivalTime"], property_list: [property_container["interarrivalTime"],
property_container["entity"] property_container["entity"]
], ],
_class: 'Dream.Source' _class: 'Dream.Source'
}, },
"Dream-Machine": { "Dream-Machine": {
anchor: {
RightMiddle: {},
LeftMiddle: {},
TopCenter: {},
BottomCenter: {}
},
property_list: [property_container["processingTime"], property_list: [property_container["processingTime"],
property_container["failures"] property_container["failures"]
], ],
_class: 'Dream.Machine' _class: 'Dream.Machine'
}, },
"Dream-Queue": { "Dream-Queue": {
anchor: {
RightMiddle: {},
LeftMiddle: {}
},
property_list: [property_container["capacity"], property_container[ property_list: [property_container["capacity"], property_container[
"isDummy"]], "isDummy"]],
_class: 'Dream.Queue' _class: 'Dream.Queue'
}, },
"Dream-Exit": { "Dream-Exit": {
anchor: {
LeftMiddle: {}
},
_class: 'Dream.Exit' _class: 'Dream.Exit'
}, },
"Dream-MachineJobShop": { "Dream-MachineJobShop": {
anchor: {
RightMiddle: {},
LeftMiddle: {},
TopCenter: {},
BottomCenter: {}
},
property_list: [property_container["processingTime"], property_list: [property_container["processingTime"],
property_container["failures"] property_container["failures"]
], ],
_class: 'Dream.MachineJobShop' _class: 'Dream.MachineJobShop'
}, },
"Dream-QueueJobShop": { "Dream-QueueJobShop": {
anchor: {
RightMiddle: {},
LeftMiddle: {}
},
property_list: [property_container["capacity"], property_container[ property_list: [property_container["capacity"], property_container[
"isDummy"]], "isDummy"]],
_class: 'Dream.QueueJobShop' _class: 'Dream.QueueJobShop'
}, },
"Dream-ExitJobShop": { "Dream-ExitJobShop": {
anchor: {
LeftMiddle: {}
},
_class: 'Dream.ExitJobShop' _class: 'Dream.ExitJobShop'
}, },
"Dream-Repairman": { "Dream-Repairman": {
anchor: {
TopCenter: {},
BottomCenter: {}
},
property_list: [property_container["capacity"]], property_list: [property_container["capacity"]],
_class: 'Dream.Repairman' _class: 'Dream.Repairman'
}, },
...@@ -246,7 +212,10 @@ ...@@ -246,7 +212,10 @@
$(".tool").draggable({ $(".tool").draggable({
opacity: 0.7, opacity: 0.7,
helper: "clone", helper: "clone",
cursorAt: {top: 0, left: 0}, cursorAt: {
top: 0,
left: 0
},
stop: function (tool) { stop: function (tool) {
var box_top, box_left, _class; var box_top, box_left, _class;
var offset = $("#render").offset(); var offset = $("#render").offset();
......
...@@ -57,20 +57,9 @@ ...@@ -57,20 +57,9 @@
jsPlumb.setRenderMode(jsPlumb.SVG); jsPlumb.setRenderMode(jsPlumb.SVG);
var color = "#00f"; var color = "#00f";
jsPlumb.importDefaults({ jsPlumb.importDefaults({
// default drag options
DragOptions: {
cursor: 'pointer',
zIndex: 2000
},
EndpointStyles: [{
fillStyle: '#225588'
}, {
fillStyle: '#558822'
}],
//PaintStyle : {strokeStyle:"#736AFF", lineWidth:2 },
HoverPaintStyle: { HoverPaintStyle: {
strokeStyle: "#42a62c", strokeStyle: "#1e8151",
lineWidth: 4 lineWidth: 2
}, },
Endpoint: ["Dot", { Endpoint: ["Dot", {
radius: 2 radius: 2
...@@ -80,18 +69,10 @@ ...@@ -80,18 +69,10 @@
location: 1, location: 1,
id: "arrow", id: "arrow",
length: 14, length: 14,
width: 12,
foldback: 0.8 foldback: 0.8
}] }]
], ],
PaintStyle: { Container: "render"
lineWidth: 2,
strokeStyle: color
},
Anchor: "Continuous",
Connector: ["StateMachine", {
curviness: 20
}]
}); });
// listen for clicks on connections, and offer to change values on click. // listen for clicks on connections, and offer to change values on click.
...@@ -107,13 +88,6 @@ ...@@ -107,13 +88,6 @@
jsPlumb.bind("connectionDragStop", function (connection) {}); jsPlumb.bind("connectionDragStop", function (connection) {});
jsPlumb.makeTarget(jsPlumb.getSelector(".w"), {
dropOptions: {
hoverClass: "dragHover"
},
anchor: "Continuous"
});
var updateConnectionData = function (connection, remove) { var updateConnectionData = function (connection, remove) {
if (remove) { if (remove) {
delete(priv.edge_container[connection.id]); delete(priv.edge_container[connection.id]);
...@@ -236,10 +210,33 @@ ...@@ -236,10 +210,33 @@
var stop = function (element) { var stop = function (element) {
priv.updateElementCoordinate(that.getNodeId(element.target.id)); priv.updateElementCoordinate(that.getNodeId(element.target.id));
}; };
jsPlumb.draggable(jsPlumb.getSelector(".window"), { jsPlumb.draggable(jsPlumb.getSelector(".window"), {
grid: [10, 10], grid: [10, 10],
stop: stop stop: stop
}); });
jsPlumb.makeSource(jsPlumb.getSelector(".window"), {
filter: ".ep",
anchor: "Continuous",
connector: ["StateMachine", {
curviness: 20
}],
connectorStyle: {
strokeStyle: "#5c96bc",
lineWidth: 2,
outlineColor: "transparent",
outlineWidth: 4
},
});
jsPlumb.makeTarget(jsPlumb.getSelector(".window"), {
dropOptions: {
hoverClass: "dragHover"
},
anchor: "Continuous"
});
}; };
priv.addElementToContainer = function (element) { priv.addElementToContainer = function (element) {
// Now update the container of elements // Now update the container of elements
...@@ -419,7 +416,7 @@ ...@@ -419,7 +416,7 @@
coordinate = priv.updateElementCoordinate(element.id, coordinate); coordinate = priv.updateElementCoordinate(element.id, coordinate);
} }
render_element.append('<div class="window ' + element._class.replace('.', '-') + '" id="' + render_element.append('<div class="window ' + element._class.replace('.', '-') + '" id="' +
element.element_id + '">' + (element.name || element.id) + '</div>'); element.element_id + '">' + (element.name || element.id) + '<div class="ep"></div></div>');
box = $("#" + element.element_id); box = $("#" + element.element_id);
var absolute_position = priv.convertToAbsolutePosition( var absolute_position = priv.convertToAbsolutePosition(
coordinate.left, coordinate.top); coordinate.left, coordinate.top);
...@@ -447,11 +444,6 @@ ...@@ -447,11 +444,6 @@
scope: "blue rectangle", scope: "blue rectangle",
isTarget: true isTarget: true
}; };
for (var key in option.anchor) {
jsPlumb.addEndpoint(element.element_id, {
anchor: key
}, endpoint);
}
priv.onDataChange(); priv.onDataChange();
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment