removed flicker from topic creation
This commit is contained in:
parent
2bbe2b8eff
commit
3b2e23b1e0
1 changed files with 22 additions and 18 deletions
|
@ -1705,17 +1705,26 @@ Metamaps.Util = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
pixelsToCoords: function (pixels) {
|
pixelsToCoords: function (pixels) {
|
||||||
var canvas = Metamaps.Visualize.mGraph.canvas,
|
var coords;
|
||||||
s = canvas.getSize(),
|
if (Metamaps.Visualize.mGraph) {
|
||||||
p = canvas.getPos(),
|
var canvas = Metamaps.Visualize.mGraph.canvas,
|
||||||
ox = canvas.translateOffsetX,
|
s = canvas.getSize(),
|
||||||
oy = canvas.translateOffsetY,
|
p = canvas.getPos(),
|
||||||
sx = canvas.scaleOffsetX,
|
ox = canvas.translateOffsetX,
|
||||||
sy = canvas.scaleOffsetY;
|
oy = canvas.translateOffsetY,
|
||||||
var coords = {
|
sx = canvas.scaleOffsetX,
|
||||||
x: (pixels.x - p.x - s.width/2 - ox) * (1/sx),
|
sy = canvas.scaleOffsetY;
|
||||||
y: (pixels.y - p.y - s.height/2 - oy) * (1/sy),
|
coords = {
|
||||||
};
|
x: (pixels.x - p.x - s.width/2 - ox) * (1/sx),
|
||||||
|
y: (pixels.y - p.y - s.height/2 - oy) * (1/sy),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
coords = {
|
||||||
|
x: 0,
|
||||||
|
y: 0
|
||||||
|
};
|
||||||
|
}
|
||||||
return coords;
|
return coords;
|
||||||
},
|
},
|
||||||
getPastelColor: function () {
|
getPastelColor: function () {
|
||||||
|
@ -3633,14 +3642,9 @@ Metamaps.Topic = {
|
||||||
|
|
||||||
if (!$.isEmptyObject(Metamaps.Visualize.mGraph.graph.nodes)) {
|
if (!$.isEmptyObject(Metamaps.Visualize.mGraph.graph.nodes)) {
|
||||||
Metamaps.Visualize.mGraph.graph.addNode(newnode);
|
Metamaps.Visualize.mGraph.graph.addNode(newnode);
|
||||||
Metamaps.Visualize.mGraph.graph.eachNode(function (n) {
|
|
||||||
n.setData("dim", 25, "start");
|
|
||||||
n.setData("dim", 25, "end");
|
|
||||||
});
|
|
||||||
nodeOnViz = Metamaps.Visualize.mGraph.graph.getNode(newnode.id);
|
nodeOnViz = Metamaps.Visualize.mGraph.graph.getNode(newnode.id);
|
||||||
topic.set('node', nodeOnViz);
|
topic.set('node', nodeOnViz, {silent: true}); //
|
||||||
topic.updateNode(); // links the topic and the mapping to the node
|
topic.updateNode(); // links the topic and the mapping to the node
|
||||||
|
|
||||||
|
|
||||||
nodeOnViz.setData("dim", 1, "start");
|
nodeOnViz.setData("dim", 1, "start");
|
||||||
nodeOnViz.setData("dim", 25, "end");
|
nodeOnViz.setData("dim", 25, "end");
|
||||||
|
|
Loading…
Add table
Reference in a new issue