mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Create an event based UserSettings and use it for the grid diplay state.
This commit is contained in:
@@ -3,19 +3,6 @@
|
||||
|
||||
ns.SettingsController = function () {};
|
||||
|
||||
/**
|
||||
* Get state for the checkbox that control the display of the grid
|
||||
* on the drawing canvas.
|
||||
* @private
|
||||
*/
|
||||
ns.SettingsController.prototype.isShowGridChecked_ = function() {
|
||||
var showGridCheckbox = $('#show-grid');
|
||||
var isChecked = showGridCheckbox.is(':checked');
|
||||
return isChecked;
|
||||
};
|
||||
|
||||
// TODO(vincz): add get/set store
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
@@ -30,11 +17,9 @@
|
||||
$('#settings').toggleClass('has-expanded-drawer');
|
||||
});
|
||||
|
||||
// Show/hide the grid on drawing canvas:
|
||||
$.publish(Events.GRID_DISPLAY_STATE_CHANGED, [this.isShowGridChecked_()]);
|
||||
// Handle grid display changes:
|
||||
$('#show-grid').change($.proxy(function(evt) {
|
||||
var checked = this.isShowGridChecked_();
|
||||
$.publish(Events.GRID_DISPLAY_STATE_CHANGED, [checked]);
|
||||
var checked = $('#show-grid').prop('checked');
|
||||
pskl.UserSettings.set(pskl.UserSettings.SHOW_GRID, checked);
|
||||
}, this));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user