Skip to content
Snippets Groups Projects
Commit b44ec897 authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

starting composite material class

parent 4b28d120
Branches
No related tags found
No related merge requests found
/**
* Created by aghassaei on 9/22/15.
*/
define(['material'], function(DMAMaterial){
function DMACompositeMaterial(data){
DMAMaterial.call(this, data);
}
DMACompositeMaterial.prototype = Object.create(DMAMaterial.prototype);
DMACompositeMaterial.prototype.set = function(data){
var edited = DMAMaterial.prototype.set.call(this, data);
if (this.sparseCells) edited |= !(_.isEqual(data.sparseCells, this.sparseCells));
return edited;
};
DMACompositeMaterial.prototype.getDimensions = function(){
return this.dimensions.clone();
};
DMACompositeMaterial.prototype.isComposite = function(){
return true;
};
DMACompositeMaterial.prototype.toJSON = function(){
return {
name: this.name,
color: this.color,
altColor: this.altColor,
noDelete: this.noDelete,
properties: this.properties
}
};
});
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
define(['appState'], function(appState){ define(['underscore', 'appState'], function(_, appState){
function DMAMaterial(json){ function DMAMaterial(json){
this.set(json); this.set(json);
...@@ -16,7 +16,6 @@ define(['appState'], function(appState){ ...@@ -16,7 +16,6 @@ define(['appState'], function(appState){
var oldAltColor = this.altColor; var oldAltColor = this.altColor;
var edited = false; var edited = false;
if (this.sparseCells) edited = !(_.isEqual(data.sparseCells, this.sparseCells));
var self = this; var self = this;
_.each(_.keys(data), function(key){ _.each(_.keys(data), function(key){
...@@ -27,6 +26,8 @@ define(['appState'], function(appState){ ...@@ -27,6 +26,8 @@ define(['appState'], function(appState){
if (!this.threeMaterial || oldColor != this.color || oldAltColor != this.altColor) this.changeColorScheme(); if (!this.threeMaterial || oldColor != this.color || oldAltColor != this.altColor) this.changeColorScheme();
if (!data.noDelete) this.noDelete = false; if (!data.noDelete) this.noDelete = false;
return edited;
}; };
DMAMaterial.prototype.changeColorScheme = function(state){ DMAMaterial.prototype.changeColorScheme = function(state){
...@@ -70,6 +71,10 @@ define(['appState'], function(appState){ ...@@ -70,6 +71,10 @@ define(['appState'], function(appState){
return false; return false;
}; };
DMAMaterial.prototype.isComposite = function(){
return false;
};
DMAMaterial.prototype.getProperties = function(){ DMAMaterial.prototype.getProperties = function(){
return this.properties; return this.properties;
}; };
...@@ -93,7 +98,10 @@ define(['appState'], function(appState){ ...@@ -93,7 +98,10 @@ define(['appState'], function(appState){
}; };
DMAMaterial.prototype.destroy = function(){ DMAMaterial.prototype.destroy = function(){
var self = this;
_.each(this, function(property, key){
self[key] = null;
});
}; };
return DMAMaterial; return DMAMaterial;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment