2013-06-16 08:17:50 +00:00
|
|
|
(function () {
|
|
|
|
var ns = $.namespace("pskl.controller");
|
|
|
|
|
|
|
|
ns.SettingsController = function () {};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @public
|
|
|
|
*/
|
|
|
|
ns.SettingsController.prototype.init = function() {
|
|
|
|
|
2013-06-17 17:54:43 +00:00
|
|
|
var show_grid = pskl.UserSettings.get(pskl.UserSettings.SHOW_GRID);
|
|
|
|
$('#show-grid').prop('checked', show_grid);
|
|
|
|
|
2013-06-17 08:37:08 +00:00
|
|
|
// Expand drawer when clicking 'Settings' tab.
|
|
|
|
$('#settings').click(function(evt) {
|
|
|
|
$('.right-sticky-section').toggleClass('expanded');
|
|
|
|
$('#settings').toggleClass('has-expanded-drawer');
|
|
|
|
});
|
2013-06-16 08:36:26 +00:00
|
|
|
|
2013-06-17 18:24:27 +00:00
|
|
|
// Handle grid display changes:
|
2013-06-16 08:17:50 +00:00
|
|
|
$('#show-grid').change($.proxy(function(evt) {
|
2013-06-17 18:24:27 +00:00
|
|
|
var checked = $('#show-grid').prop('checked');
|
2013-06-17 17:54:43 +00:00
|
|
|
pskl.UserSettings.set(pskl.UserSettings.SHOW_GRID, checked);
|
2013-06-16 08:17:50 +00:00
|
|
|
}, this));
|
|
|
|
|
|
|
|
// Handle canvas background changes:
|
2013-06-17 09:36:56 +00:00
|
|
|
$('#background-picker-wrapper').click(function(evt) {
|
|
|
|
var target = $(evt.target).closest('.background-picker');
|
|
|
|
if (target.length) {
|
|
|
|
var backgroundClass = target.data('background');
|
|
|
|
var body = $('body');
|
|
|
|
body.removeClass(body.data('current-background'));
|
|
|
|
body.addClass(backgroundClass);
|
|
|
|
body.data('current-background', backgroundClass);
|
|
|
|
|
|
|
|
$('.background-picker').removeClass('selected');
|
|
|
|
target.addClass('selected');
|
|
|
|
}
|
2013-06-16 08:17:50 +00:00
|
|
|
});
|
|
|
|
};
|
|
|
|
})();
|