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)
}
else if (nodes[edge.nodeFrom] && nodes[edge.nodeTo]) {
existingEdge = _.findWhere(edges, {
existingEdge = _.find(edges, {
nodeFrom: edge.nodeFrom,
nodeTo: edge.nodeTo
}) ||
_.findWhere(edges, {
_.find(edges, {
nodeFrom: edge.nodeTo,
nodeTo: edge.nodeFrom
})

View file

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

View file

@ -191,7 +191,7 @@ const Topic = {
// opts is additional options in a hash
// 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 nodeOnViz, tempPos

View file

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

View file

@ -3125,9 +3125,15 @@ var Canvas;
};
},
translateToCenter: function(ps) {
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;
// START METAMAPS CODE
var size = this.getSize();
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();
ps && ctx.scale(1/this.scaleOffsetX, 1/this.scaleOffsetY);
ctx.translate(width/2, height/2);
@ -5637,7 +5643,11 @@ Graph.Op = {
break;
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);
//set alpha to 0 for nodes to add.
@ -5773,7 +5783,11 @@ Graph.Op = {
break;
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);
//preprocessing for nodes to delete.
//get node property modes to interpolate