Commit d5181cef authored by Maxime Chazalviel's avatar Maxime Chazalviel
Browse files

Merge branch 'hotfix/fixShortcutandsave' into develop

parents e99c3a83 e72cd922
......@@ -7,7 +7,7 @@
/**
* The version of the application.
*/
"version": "2.0.1",
"version": "2.0.2",
/**
* The relative path to the application's markup file (html, jsp, asp, etc.).
......
......@@ -37,14 +37,14 @@ metExploreD3.GraphFunction = {
return graph;
},
horizontalAlign : function() {
horizontalAlign : function(panel) {
metExploreD3.GraphNode.fixSelectedNode();
var nodes = _metExploreViz.getSessionById('viz').getSelectedNodes();
var nodes = _metExploreViz.getSessionById(panel).getSelectedNodes();
var yRef = _metExploreViz.getSessionById('viz').getD3Data().getNodeById(nodes[0]).y;
var yRef = _metExploreViz.getSessionById(panel).getD3Data().getNodeById(nodes[0]).y;
var arrayNode = [];
d3.select("#viz").select("#D3viz").select("#graphComponent").selectAll("g.node")
d3.select("#"+panel).select("#D3viz").select("#graphComponent").selectAll("g.node")
.filter(function(node){
return nodes.indexOf(node.getId())!=-1;
})
......@@ -67,17 +67,17 @@ metExploreD3.GraphFunction = {
}
})
metExploreD3.GraphNetwork.tick("viz");
metExploreD3.GraphNetwork.tick(panel);
},
verticalAlign : function() {
verticalAlign : function(panel) {
metExploreD3.GraphNode.fixSelectedNode();
var nodes = _metExploreViz.getSessionById('viz').getSelectedNodes();
var nodes = _metExploreViz.getSessionById(panel).getSelectedNodes();
var xRef = _metExploreViz.getSessionById('viz').getD3Data().getNodeById(nodes[0]).x;
var xRef = _metExploreViz.getSessionById(panel).getD3Data().getNodeById(nodes[0]).x;
var arrayNode = [];
d3.select("#viz").select("#D3viz").select("#graphComponent").selectAll("g.node")
d3.select("#"+panel).select("#D3viz").select("#graphComponent").selectAll("g.node")
.filter(function(node){
return nodes.indexOf(node.getId())!=-1;
})
......@@ -100,7 +100,7 @@ metExploreD3.GraphFunction = {
}
})
metExploreD3.GraphNetwork.tick("viz");
metExploreD3.GraphNetwork.tick(panel);
},
colorDistanceOnNode : function(graph, func){
......
......@@ -133,16 +133,29 @@ metExploreD3.GraphNetwork = {
* @param {} panel : The panel to refresh
*/
zoom:function(panel) {
var scale = metExploreD3.getScaleById(panel);
d3.select("#"+panel).select("#D3viz").select("#graphComponent").attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");
var zoomListener = scale.getZoom();
var session = _metExploreViz.getSessionById(panel);
if(session.getScale().getZoomScale()<0.8) d3.select("#"+panel).select("#D3viz").select("#graphComponent").selectAll('text').classed("hide", true);
else d3.select("#"+panel).select("#D3viz").select("#graphComponent").selectAll('text').classed("hide", false);
// Firstly we changed the store which correspond to viz panel
scale.setZoomScale(d3.event.scale);
scale.setXScale(zoomListener.x());
scale.setYScale(zoomListener.y());
metExploreD3.GraphLink.tick(panel, scale);
if(d3.event.sourceEvent !=null)
if(d3.event.sourceEvent.type=='wheel')
session.setResizable(false);
// if visualisation is actived we add item to menu
if(session.isActive()){
var scale = metExploreD3.getScaleById(panel);
d3.select("#"+panel).select("#D3viz").select("#graphComponent").attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");
var zoomListener = scale.getZoom();
// Firstly we changed the store which correspond to viz panel
scale.setZoomScale(d3.event.scale);
scale.setXScale(zoomListener.x());
scale.setYScale(zoomListener.y());
metExploreD3.GraphLink.tick(panel, scale);
}
},
/*******************************************
......@@ -498,21 +511,7 @@ metExploreD3.GraphNetwork = {
.y( yScale )
.scaleExtent([ 0.01, 30 ])
.on("zoom", function(e){
if(metExploreD3.GraphNetwork.zoomListener.scale()<0.8) d3.select("#"+panel).select("#D3viz").select("#graphComponent").selectAll('text').classed("hide", true);
else d3.select("#"+panel).select("#D3viz").select("#graphComponent").selectAll('text').classed("hide", false);
var session = _metExploreViz.getSessionById(panel);
if(d3.event.sourceEvent !=null)
if(d3.event.sourceEvent.type=='wheel')
session.setResizable(false);
// if visualisation is actived we add item to menu
if(session.isActive()){
that.zoom(panel);
}
that.zoom(panel);
});
......@@ -532,21 +531,7 @@ metExploreD3.GraphNetwork = {
.y( yScale )
.scaleExtent([ 0.01, 30 ])
.on("zoom", function(e){
if(metExploreD3.GraphNetwork.zoomListener.scale()<0.8) d3.select("#"+panel).select("#D3viz").select("#graphComponent").selectAll('text').classed("hide", true);
else d3.select("#"+panel).select("#D3viz").select("#graphComponent").selectAll('text').classed("hide", false);
var session = _metExploreViz.getSessionById(this.parentNode.id);
if(d3.event.sourceEvent !=null)
if(d3.event.sourceEvent.type=='wheel')
session.setResizable(false);
// if visualisation is actived we add item to menu
if(session.isActive()){
that.zoom(this.parentNode.id);
}
that.zoom(this.parentNode.id);
});
var scale = new Scale(panel);
......@@ -3280,21 +3265,7 @@ setTimeout(
.y( yScale )
.scaleExtent([ 0.01, 30 ])
.on("zoom", function(e){
if(metExploreD3.GraphNetwork.zoomListener.scale()<0.8) d3.select("#"+panel).select("#D3viz").select("#graphComponent").selectAll('text').classed("hide", true);
else d3.select("#"+panel).select("#D3viz").select("#graphComponent").selectAll('text').classed("hide", false);
var session = _metExploreViz.getSessionById(panel);
if(d3.event.sourceEvent !=null)
if(d3.event.sourceEvent.type=='wheel')
session.setResizable(false);
// if visualisation is actived we add item to menu
if(session.isActive()){
that.zoom(panel);
}
that.zoom(panel);
});
scale.add({
......@@ -3329,20 +3300,7 @@ setTimeout(
.y( yScale )
.scaleExtent([ 0.01, 30 ])
.on("zoom", function(e){
if(metExploreD3.GraphNetwork.zoomListener.scale()<0.8) d3.select("#"+panel).select("#D3viz").select("#graphComponent").selectAll('text').classed("hide", true);
else d3.select("#"+panel).select("#D3viz").select("#graphComponent").selectAll('text').classed("hide", false);
var session = _metExploreViz.getSessionById(this.parentNode.id);
if(d3.event.sourceEvent !=null)
if(d3.event.sourceEvent.type=='wheel')
session.setResizable(false);
// if visualisation is actived we add item to menu
if(session.isActive()){
that.zoom(this.parentNode.id);
}
that.zoom(this.parentNode.id);
});
scale
.setScale(xScale, yScale, 1, 1, 1, metExploreD3.GraphNetwork.zoomListener.scale(), metExploreD3.GraphNetwork.zoomListener);
......@@ -3676,21 +3634,7 @@ setTimeout(
.y( yScale )
.scaleExtent([ 0.01, 30 ])
.on("zoom", function(e){
if(metExploreD3.GraphNetwork.zoomListener.scale()<0.8) d3.select("#"+panel).select("#D3viz").select("#graphComponent").selectAll('text').classed("hide", true);
else d3.select("#"+panel).select("#D3viz").select("#graphComponent").selectAll('text').classed("hide", false);
var session = metExploreD3.getSessionById(panel);
if(d3.event.sourceEvent !=null)
if(d3.event.sourceEvent.type=='wheel')
session.setResizable(false);
// if visualisation is actived we add item to menu
if(session.isActive()){
that.zoom(panel);
}
that.zoom(panel);
});
......@@ -3717,21 +3661,7 @@ setTimeout(
.y( yScale )
.scaleExtent([ 0.01, 30 ])
.on("zoom", function(e){
if(zoomListener.scale()<0.8) d3.select("#"+panel).select("#D3viz").select("#graphComponent").selectAll('text').classed("hide", true);
else d3.select("#"+panel).select("#D3viz").select("#graphComponent").selectAll('text').classed("hide", false);
var session = metExploreD3.getSessionById(this.parentNode.id);
if(d3.event.sourceEvent !=null)
if(d3.event.sourceEvent.type=='wheel')
session.setResizable(false);
// if visualisation is actived we add item to menu
if(session.isActive()){
that.zoom(this.parentNode.id);
}
that.zoom(this.parentNode.id);
});
scale
.getStoreByGraphName(panel)
......
......@@ -943,7 +943,56 @@ metExploreD3.GraphNode = {
});
},
/*******************************************
initShortCut: function () {
d3.select("body")
.on("keydown", function() {
_MyThisGraphNode.charKey = d3.event.keyCode;
_MyThisGraphNode.ctrlKey = d3.event.ctrlKey;
var activesession = _metExploreViz.getSessionById(_MyThisGraphNode.activePanel);
//H 72
if(_MyThisGraphNode.charKey==72 && activesession.getSelectedNodes().length>0)
{
metExploreD3.GraphFunction.horizontalAlign(_MyThisGraphNode.activePanel);
}
//V 86
if(_MyThisGraphNode.charKey==86 && activesession.getSelectedNodes().length>0)
{
metExploreD3.GraphFunction.verticalAlign(_MyThisGraphNode.activePanel);
}
// 65=A
if(_MyThisGraphNode.charKey==65 && _MyThisGraphNode.ctrlKey)
{
d3.select("#"+_MyThisGraphNode.activePanel).select("#D3viz").select("#graphComponent").selectAll("g.node")
.each(function(node){
if(!node.isSelected())
{
_MyThisGraphNode.selection(node, _MyThisGraphNode.activePanel);
}
});
}
})
.on("keyup", function(e) {
// 46=Suppr
var activesession = _metExploreViz.getSessionById(_MyThisGraphNode.activePanel);
if(_MyThisGraphNode.charKey==46 && activesession.getSelectedNodes().length>0)
{
metExploreD3.displayMessageYesNo("Selected nodes",'Do you want remove selected nodes?',function(btn){
if(btn=="yes")
{
metExploreD3.GraphNetwork.removeSelectedNode(_MyThisGraphNode.activePanel)
}
});
}
_MyThisGraphNode.charKey = 'none';
_MyThisGraphNode.ctrlKey = d3.event.ctrlKey;
});
},
/*******************************************
* To add nodes in visualization
* @param {} panel : The panel where the action is launched
*/
......@@ -966,51 +1015,7 @@ metExploreD3.GraphNode = {
}
}, false);
d3.select("body")
.on("keydown", function() {
_MyThisGraphNode.charKey = d3.event.keyCode;
_MyThisGraphNode.ctrlKey = d3.event.ctrlKey;
// 65=A
if(_MyThisGraphNode.charKey==65 && _MyThisGraphNode.ctrlKey)
{
d3.select("#"+parent).select("#D3viz").select("#graphComponent").selectAll("g.node")
.each(function(node){
if(!node.isSelected())
{
_MyThisGraphNode.selection(node, parent);
}
});
}
//H 72
if(_MyThisGraphNode.charKey==72 && session.getSelectedNodes().length>0)
{
metExploreD3.GraphFunction.horizontalAlign();
}
//V 86
if(_MyThisGraphNode.charKey==86 && session.getSelectedNodes().length>0)
{
metExploreD3.GraphFunction.verticalAlign();
}
})
.on("keyup", function(e) {
// 46=Suppr
if(_MyThisGraphNode.charKey==46 && session.getSelectedNodes().length>0)
{
metExploreD3.displayMessageYesNo("Selected nodes",'Do you want remove selected nodes?',function(btn){
if(btn=="yes")
{
metExploreD3.GraphNetwork.removeSelectedNode("viz")
}
});
}
_MyThisGraphNode.charKey = 'none';
_MyThisGraphNode.ctrlKey = d3.event.ctrlKey;
});
this.initShortCut();
metExploreD3.GraphNode.panelParent = parent;
......@@ -1618,41 +1623,8 @@ metExploreD3.GraphNode = {
var generalStyle = metExploreD3.getGeneralStyle();
var session = _metExploreViz.getSessionById(parent);
var sessionMain = _metExploreViz.getSessionById('viz');
d3.select("body")
.on("keydown", function() {
_MyThisGraphNode.charKey = d3.event.keyCode;
_MyThisGraphNode.ctrlKey = d3.event.ctrlKey;
// 65=A
if(_MyThisGraphNode.charKey==65 && _MyThisGraphNode.ctrlKey)
{
d3.select("#"+parent).select("#D3viz").select("#graphComponent").selectAll("g.node")
.each(function(node){
if(!node.isSelected())
{
_MyThisGraphNode.selection(node, parent);
}
});
}
})
.on("keyup", function(e) {
// 46=Suppr
if(_MyThisGraphNode.charKey==46 && session.getSelectedNodes().length>0)
{
metExploreD3.displayMessageYesNo("Selected nodes",'Do you want remove selected nodes?',function(btn){
if(btn=="yes")
{
metExploreD3.GraphNetwork.removeSelectedNode("viz")
}
});
}
_MyThisGraphNode.charKey = 'none';
_MyThisGraphNode.ctrlKey = d3.event.ctrlKey;
});
this.initShortCut();
metExploreD3.GraphNode.panelParent = parent;
......
......@@ -409,22 +409,26 @@ metExploreD3.GraphStyleEdition = {
* Create an object containing the label style data associated to a node
* @param {Object} node : The node whose label syle data will be put in the object
*/
createLabelStyleObject : function (node) {
var nodeLabel = d3.select("#viz").select("#D3viz").select("#graphComponent")
createLabelStyleObject : function (node, panel) {
var nodeLabel = d3.select("#"+panel).select("#D3viz").select("#graphComponent")
.selectAll("g.node")
.filter(function(d){return d.getId()==node.getId();})
.select("text");
var labelStyle = {
font : nodeLabel.style("font-family"),
fontSize : nodeLabel.style("font-size"),
fontBold : nodeLabel.style("font-weight"),
fontItalic : nodeLabel.style("font-style"),
fontUnderline : nodeLabel.style("text-decoration-line"),
fontOpacity : nodeLabel.attr("opacity"),
fontX : nodeLabel.attr("x"),
fontY : nodeLabel.attr("y"),
fontTransform : nodeLabel.attr("transform")
};
console.log(node);
console.log(nodeLabel);
if(nodeLabel.length>0){
var labelStyle = {
font : nodeLabel.style("font-family"),
fontSize : nodeLabel.style("font-size"),
fontBold : nodeLabel.style("font-weight"),
fontItalic : nodeLabel.style("font-style"),
fontUnderline : nodeLabel.style("text-decoration-line"),
fontOpacity : nodeLabel.attr("opacity"),
fontX : nodeLabel.attr("x"),
fontY : nodeLabel.attr("y"),
fontTransform : nodeLabel.attr("transform")
};
}
return labelStyle;
},
......@@ -432,8 +436,8 @@ metExploreD3.GraphStyleEdition = {
* Create an object containing the image position and dimension data associated to a node
* @param {Object} node : The node whose image position and dimension data will be put in the object
*/
createImageStyleObject : function (node) {
var nodeImage = d3.select("#viz").select("#D3viz").select("#graphComponent")
createImageStyleObject : function (node, panel) {
var nodeImage = d3.select("#"+ panel).select("#D3viz").select("#graphComponent")
.selectAll("g.node")
.filter(function(d){return d.getId()==node.getId();})
.select(".imageNode");
......
......@@ -1493,8 +1493,8 @@ metExploreD3.GraphUtils = {
networkJSON+="\"svgHeight\":"+JSON.stringify(node.getSvgHeight())+",";
}
networkJSON+="\"labelFont\":"+JSON.stringify(metExploreD3.GraphStyleEdition.createLabelStyleObject(node))+",";
var imagePosition = metExploreD3.GraphStyleEdition.createImageStyleObject(node);
networkJSON+="\"labelFont\":"+JSON.stringify(metExploreD3.GraphStyleEdition.createLabelStyleObject(node, key))+",";
var imagePosition = metExploreD3.GraphStyleEdition.createImageStyleObject(node, key);
if (imagePosition != undefined) {
networkJSON += "\"imagePosition\":" + JSON.stringify(imagePosition) + ",";
}
......
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