From 9a6bce3767a553c3e35f0dfcd7862b84b0b3da9d Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 30 Dec 2014 11:26:44 -0800 Subject: [PATCH] Add getters/setters to Grid --- examples/libraries/gridTool.js | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/examples/libraries/gridTool.js b/examples/libraries/gridTool.js index 7d98befec8..f9fc07f4dd 100644 --- a/examples/libraries/gridTool.js +++ b/examples/libraries/gridTool.js @@ -27,9 +27,6 @@ Grid = function(opts) { majorGridEvery: 2, }); - that.getMinorIncrement = function() { return minorGridSpacing; }; - that.getMajorIncrement = function() { return minorGridSpacing * majorGridEvery; }; - that.visible = false; that.enabled = false; @@ -37,13 +34,39 @@ Grid = function(opts) { return origin; } + that.getMinorIncrement = function() { return minorGridWidth; }; + that.getMajorIncrement = function() { return minorGridWidth * majorGridEvery; }; + + that.getMinorGridWidth = function() { return minorGridWidth; }; + that.setMinorGridWidth = function(value) { + minorGridWidth = value; + updateGrid(); + }; + + that.getMajorGridEvery = function() { return majorGridEvery; }; + that.setMajorGridEvery = function(value) { + majorGridEvery = value; + updateGrid(); + }; + + that.getColorIndex = function() { return colorIndex; }; + that.setColorIndex = function(value) { + colorIndex = value; + updateGrid(); + }; + that.getSnapToGrid = function() { return snapToGrid; }; + that.setSnapToGrid = function(value) { + snapToGrid = value; + that.emitUpdate(); + }; that.setEnabled = function(enabled) { that.enabled = enabled; updateGrid(); } + that.getVisible = function() { return that.visible; }; that.setVisible = function(visible, noUpdate) { that.visible = visible; updateGrid();