fix a few more errors

This commit is contained in:
Devin Howard 2016-09-23 14:12:27 +08:00
parent e65a5e2d1c
commit 6f91ce5ff5
5 changed files with 31 additions and 24 deletions

View file

@ -99,11 +99,11 @@ const JIT = {
synapsesToRemove.push(s) synapsesToRemove.push(s)
} }
else if (nodes[edge.nodeFrom] && nodes[edge.nodeTo]) { else if (nodes[edge.nodeFrom] && nodes[edge.nodeTo]) {
existingEdge = _.findWhere(edges, { existingEdge = _.find(edges, {
nodeFrom: edge.nodeFrom, nodeFrom: edge.nodeFrom,
nodeTo: edge.nodeTo nodeTo: edge.nodeTo
}) || }) ||
_.findWhere(edges, { _.find(edges, {
nodeFrom: edge.nodeTo, nodeFrom: edge.nodeTo,
nodeTo: edge.nodeFrom nodeTo: edge.nodeFrom
}) })

View file

@ -3,6 +3,7 @@
import Active from '../Active' import Active from '../Active'
import GlobalUI from '../GlobalUI' import GlobalUI from '../GlobalUI'
import Router from '../Router' import Router from '../Router'
import Util from '../Util'
/* /*
* Metamaps.Collaborators * Metamaps.Collaborators

View file

@ -191,7 +191,7 @@ const Topic = {
// opts is additional options in a hash // opts is additional options in a hash
// TODO: move createNewInDB and permitCerateSYnapseAfter into opts // TODO: move createNewInDB and permitCerateSYnapseAfter into opts
renderTopic: function (mapping, topic, createNewInDB, permitCreateSynapseAfter, opts) { renderTopic: function (mapping, topic, createNewInDB, permitCreateSynapseAfter, opts = {}) {
var self = Topic var self = Topic
var nodeOnViz, tempPos var nodeOnViz, tempPos

View file

@ -187,17 +187,9 @@ const TopicCard = {
} }
var openMetacodeSelect = function (event) { var openMetacodeSelect = function (event) {
var windowWidth
var showcardLeft
var TOPICCARD_WIDTH = 300 var TOPICCARD_WIDTH = 300
var METACODESELECT_WIDTH = 404 var METACODESELECT_WIDTH = 404
var distanceFromEdge
var MAX_METACODELIST_HEIGHT = 270 var MAX_METACODELIST_HEIGHT = 270
var windowHeight
var showcardTop
var topicTitleHeight
var distanceFromBottom
if (!selectingMetacode) { if (!selectingMetacode) {
selectingMetacode = true selectingMetacode = true
@ -206,9 +198,9 @@ const TopicCard = {
// select is accessible onscreen, when opened // select is accessible onscreen, when opened
// while topic card is close to the right // while topic card is close to the right
// edge of the screen // edge of the screen
windowWidth = $(window).width() var windowWidth = $(window).width()
showcardLeft = parseInt($('.showcard').css('left')) var showcardLeft = parseInt($('.showcard').css('left'))
distanceFromEdge = windowWidth - (showcardLeft + TOPICCARD_WIDTH) var distanceFromEdge = windowWidth - (showcardLeft + TOPICCARD_WIDTH)
if (distanceFromEdge < METACODESELECT_WIDTH) { if (distanceFromEdge < METACODESELECT_WIDTH) {
$('.metacodeSelect').addClass('onRightEdge') $('.metacodeSelect').addClass('onRightEdge')
} }
@ -217,11 +209,11 @@ const TopicCard = {
// select is accessible onscreen, when opened // select is accessible onscreen, when opened
// while topic card is close to the bottom // while topic card is close to the bottom
// edge of the screen // edge of the screen
windowHeight = $(window).height() var windowHeight = $(window).height()
showcardTop = parseInt($('.showcard').css('top')) var showcardTop = parseInt($('.showcard').css('top'))
topicTitleHeight = $('.showcard .title').height() + parseInt($('.showcard .title').css('padding-top')) + parseInt($('.showcard .title').css('padding-bottom')) var topicTitleHeight = $('.showcard .title').height() + parseInt($('.showcard .title').css('padding-top')) + parseInt($('.showcard .title').css('padding-bottom'))
heightOfSetList = $('.showcard .metacodeSelect').height() var heightOfSetList = $('.showcard .metacodeSelect').height()
distanceFromBottom = windowHeight - (showcardTop + topicTitleHeight) var distanceFromBottom = windowHeight - (showcardTop + topicTitleHeight)
if (distanceFromBottom < MAX_METACODELIST_HEIGHT) { if (distanceFromBottom < MAX_METACODELIST_HEIGHT) {
$('.metacodeSelect').addClass('onBottomEdge') $('.metacodeSelect').addClass('onBottomEdge')
} }

View file

@ -3125,9 +3125,15 @@ var Canvas;
}; };
}, },
translateToCenter: function(ps) { translateToCenter: function(ps) {
var size = this.getSize(), // START METAMAPS CODE
width = ps? (size.width - ps.width - this.translateOffsetX*2) : size.width; var size = this.getSize();
height = ps? (size.height - ps.height - this.translateOffsetY*2) : size.height; var width = ps ? (size.width - ps.width - this.translateOffsetX*2) : size.width;
var height = ps ? (size.height - ps.height - this.translateOffsetY*2) : size.height;
// ORIGINAL CODE
// var size = this.getSize(),
// width = ps? (size.width - ps.width - this.translateOffsetX*2) : size.width;
// height = ps? (size.height - ps.height - this.translateOffsetY*2) : size.height;
// END METAMAPS CODE
var ctx = this.getCtx(); var ctx = this.getCtx();
ps && ctx.scale(1/this.scaleOffsetX, 1/this.scaleOffsetY); ps && ctx.scale(1/this.scaleOffsetX, 1/this.scaleOffsetY);
ctx.translate(width/2, height/2); ctx.translate(width/2, height/2);
@ -5637,7 +5643,11 @@ Graph.Op = {
break; break;
case 'fade:seq': case 'fade': case 'fade:con': case 'fade:seq': case 'fade': case 'fade:con':
that = this; // START METAMAPS CODE
var that = this;
// ORIGINAL CODE:
// that = this;
// END METAMAPS CODE
graph = viz.construct(json); graph = viz.construct(json);
//set alpha to 0 for nodes to add. //set alpha to 0 for nodes to add.
@ -5773,7 +5783,11 @@ Graph.Op = {
break; break;
case 'fade:seq': case 'fade': case 'fade:con': case 'fade:seq': case 'fade': case 'fade:con':
that = this; // START METAMAPS CODE
var that = this;
// ORIGINAL CODE:
// that = this;
// END METAMAPS CODE
graph = viz.construct(json); graph = viz.construct(json);
//preprocessing for nodes to delete. //preprocessing for nodes to delete.
//get node property modes to interpolate //get node property modes to interpolate