From 7193d2a3865c2e75a6bd775d50cec8baf3e1e09d Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Wed, 5 Nov 2014 13:26:14 -0500 Subject: [PATCH] fixed small render node issue --- app/assets/javascripts/src/JIT.js | 9 ++++++--- app/assets/javascripts/src/Metamaps.JIT.js | 2 +- app/assets/javascripts/src/Metamaps.js | 6 +++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/src/JIT.js b/app/assets/javascripts/src/JIT.js index 7483a544..bd8c1565 100644 --- a/app/assets/javascripts/src/JIT.js +++ b/app/assets/javascripts/src/JIT.js @@ -2478,6 +2478,7 @@ Extras.Classes.Navigation = new Class({ jQuery(document).trigger(Metamaps.JIT.events.zoom, [e]); // END METAMAPS CODE + console.log('zooming'); }, onMouseDown: function(e, win, eventInfo) { @@ -7427,6 +7428,7 @@ Graph.Label.Native = new Class({ (end code) */ plotLabel: function(canvas, node, controller) { + /* var ctx = canvas.getCtx(); var pos = node.pos.getc(true); @@ -7437,7 +7439,8 @@ Graph.Label.Native = new Class({ //START METAMAPS CODE - var arrayOfLabelLines = Metamaps.Util.splitLine(node.name,30).split('\n'); + //var arrayOfLabelLines = Metamaps.Util.splitLine(node.name,30).split('\n'); + var arrayOfLabelLines = ["something", "something"]; //render background ctx.fillStyle = ctx.strokeStyle = Metamaps.Settings.colors.labels.background; ctx.lineWidth = 2; @@ -7466,9 +7469,9 @@ Graph.Label.Native = new Class({ ctx.fill(); //ctx.stroke(); - ctx.fillStyle = ctx.strokeStyle = node.getLabelData('color'); + ctx.fillStyle = ctx.strokeStyle = node.getLabelData('color');*/ - this.renderLabel(arrayOfLabelLines, canvas, node, controller); + //this.renderLabel(arrayOfLabelLines, canvas, node, controller); // END METAMAPS CODE // ORIGINAL CODE this.renderLabel(canvas, node, controller); }, diff --git a/app/assets/javascripts/src/Metamaps.JIT.js b/app/assets/javascripts/src/Metamaps.JIT.js index d039b145..faf895f2 100644 --- a/app/assets/javascripts/src/Metamaps.JIT.js +++ b/app/assets/javascripts/src/Metamaps.JIT.js @@ -422,7 +422,7 @@ Metamaps.JIT = { } // if the topic has a link, draw a small image to indicate that - var hasLink = topic.get('link') !== "" && topic.get('link') !== null; + var hasLink = topic && topic.get('link') !== "" && topic.get('link') !== null; var linkImage = Metamaps.JIT.topicMediaImage; var linkImageLoaded = linkImage.complete || (typeof linkImage.naturalWidth !== "undefined" && diff --git a/app/assets/javascripts/src/Metamaps.js b/app/assets/javascripts/src/Metamaps.js index 6ba3a80f..2543f0df 100644 --- a/app/assets/javascripts/src/Metamaps.js +++ b/app/assets/javascripts/src/Metamaps.js @@ -1845,7 +1845,7 @@ Metamaps.Realtime = { startActiveMap: function () { var self = Metamaps.Realtime; - if (Metamaps.Active.Map) { + if (Metamaps.Active.Map && Metamaps.Active.Mapper) { var commonsMap = Metamaps.Active.Map.get('permission') === 'commons'; var publicMap = Metamaps.Active.Map.get('permission') === 'public'; @@ -3645,7 +3645,7 @@ Metamaps.Topic = { if (!$.isEmptyObject(Metamaps.Visualize.mGraph.graph.nodes)) { Metamaps.Visualize.mGraph.graph.addNode(newnode); nodeOnViz = Metamaps.Visualize.mGraph.graph.getNode(newnode.id); - topic.set('node', nodeOnViz, {silent: true}); // + topic.set('node', nodeOnViz, {silent: true}); topic.updateNode(); // links the topic and the mapping to the node nodeOnViz.setData("dim", 1, "start"); @@ -3694,7 +3694,7 @@ Metamaps.Topic = { } else { Metamaps.Visualize.mGraph.loadJSON(newnode); 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 nodeOnViz.setData("dim", 1, "start");