From 62b7f9d265a82e018c8f8b21315823a9c09f5253 Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Tue, 3 Mar 2015 14:34:04 -0500 Subject: [PATCH] column separation listening event --- js/models/AppState.js | 2 +- js/models/Lattice.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/js/models/AppState.js b/js/models/AppState.js index 775aa210..7a997f04 100644 --- a/js/models/AppState.js +++ b/js/models/AppState.js @@ -35,7 +35,7 @@ AppState = Backbone.Model.extend({ face: {triangle:"Triangle"}, edge: {triangle:"Triangle"}, edgeRot: {triangle:"Triangle"}, - vertex: null//{square:"Square", xShape:"X"} + vertex: {square:"Square", xShape:"X"} }, cube:{ face: null diff --git a/js/models/Lattice.js b/js/models/Lattice.js index 13237c9a..cd368e10 100644 --- a/js/models/Lattice.js +++ b/js/models/Lattice.js @@ -17,6 +17,7 @@ Lattice = Backbone.Model.extend({ numCells: 0, numInvCells: 0, basePlane: null,//plane to build from + columnSeparation: 0.0, highlighter: null,//highlights build-able surfaces shouldPreserveCells: true,//preserve cells when changing lattice type shouldShowInverseCells: false @@ -29,6 +30,7 @@ Lattice = Backbone.Model.extend({ //bind events this.listenTo(this, "change:scale", this._scaleDidChange); this.listenTo(this, "change:shouldShowInverseCells", this._showInverseCells); + }, //////////////////////////////////////////////////////////////////////////////////// @@ -411,11 +413,12 @@ Lattice = Backbone.Model.extend({ _initLatticeType: function(){ //bind events - this.set("columnSeparation", 0.0, {silent:true}); + this.set("columnSeparation", 0.0); this.listenTo(this, "change:columnSeparation", this._changeColSeparation); this.set("basePlane", new OctaBasePlane({scale:this.get("scale")})); this.set("highlighter", new OctaFaceHighlighter({scale:this.get("scale")})); + }, _changeColSeparation: function(){ @@ -562,8 +565,7 @@ Lattice = Backbone.Model.extend({ }, _undo: function(){//remove all the mixins, this will help with debugging later - this.stopListening(this, "columnSeparation"); - this.set("columnSeparation", null); + this.stopListening(this, "change:columnSeparation"); var self = this; _.each(_.keys(this.OctaFaceLattice), function(key){ self[key] = null; @@ -579,8 +581,6 @@ Lattice = Backbone.Model.extend({ OctaEdgeLattice: { _undo: function(){//remove all the mixins, this will help with debugging later - this.stopListening(this, "columnSeparation"); - this.set("columnSeparation", null); var self = this; _.each(_.keys(this.OctaEdgeLattice), function(key){ self[key] = null; -- GitLab