Skip to content

Commit

Permalink
Only cache passages that exist when processing a change event
Browse files Browse the repository at this point in the history
This was causing problems when initially creating a story.
  • Loading branch information
klembot committed Oct 10, 2015
1 parent d40a585 commit e6e9746
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/story-edit/linkManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,12 @@ module.exports = Backbone.View.extend(
var oldStart = this.parent.collection.findWhere({ id: this.parent.model.previous('startPassage') });
var newStart = this.parent.collection.findWhere({ id: this.parent.model.get('startPassage') });

this.cachePassage(oldStart);
this.cachePassage(newStart);
if (oldStart)
this.cachePassage(oldStart);

if (newStart)
this.cachePassage(newStart);

this.drawAll();
});

Expand Down Expand Up @@ -378,11 +382,6 @@ module.exports = Backbone.View.extend(

this.drawArrowsWhileDragging = (this.parent.model.get('zoom') > 0.25);

var draggedViews = this.parent.children.filter(function (view)
{
return view.selected;
});

/**
An array of passages models currently being dragged.
Expand Down

0 comments on commit e6e9746

Please sign in to comment.