mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Adding SettingsController
This commit is contained in:
@ -142,6 +142,7 @@
|
|||||||
<script src="js/controller/ToolController.js"></script>
|
<script src="js/controller/ToolController.js"></script>
|
||||||
<script src="js/controller/PaletteController.js"></script>
|
<script src="js/controller/PaletteController.js"></script>
|
||||||
<script src="js/controller/NotificationController.js"></script>
|
<script src="js/controller/NotificationController.js"></script>
|
||||||
|
<script src="js/controller/SettingsController.js"></script>
|
||||||
<!-- Services -->
|
<!-- Services -->
|
||||||
<script src="js/service/LocalStorageService.js"></script>
|
<script src="js/service/LocalStorageService.js"></script>
|
||||||
<script src="js/service/HistoryService.js"></script>
|
<script src="js/service/HistoryService.js"></script>
|
||||||
|
37
js/controller/SettingsController.js
Normal file
37
js/controller/SettingsController.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
(function () {
|
||||||
|
var ns = $.namespace("pskl.controller");
|
||||||
|
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
ns.SettingsController.prototype.init = function() {
|
||||||
|
|
||||||
|
// Show/hide the grid on drawing canvas:
|
||||||
|
$.publish(Events.GRID_DISPLAY_STATE_CHANGED, [this.isShowGridChecked_()]);
|
||||||
|
$('#show-grid').change($.proxy(function(evt) {
|
||||||
|
var checked = this.isShowGridChecked_();
|
||||||
|
$.publish(Events.GRID_DISPLAY_STATE_CHANGED, [checked]);
|
||||||
|
}, this));
|
||||||
|
|
||||||
|
// Handle canvas background changes:
|
||||||
|
$('#canvas-picker').change(function(evt) {
|
||||||
|
$('#canvas-picker option:selected').each(function() {
|
||||||
|
console.log($(this).val());
|
||||||
|
$('html')[0].className = $(this).val();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
})();
|
@ -83,17 +83,6 @@
|
|||||||
$('#tools-container').html(toolMarkup);
|
$('#tools-container').html(toolMarkup);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Get state for the checkbox that control the display of the grid
|
|
||||||
* on the drawing canvas.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
ns.ToolController.prototype.isShowGridChecked_ = function() {
|
|
||||||
var showGridCheckbox = $('#show-grid');
|
|
||||||
var isChecked = showGridCheckbox.is(':checked');
|
|
||||||
return isChecked;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
@ -106,12 +95,5 @@
|
|||||||
this.selectTool_(this.toolInstances.simplePen);
|
this.selectTool_(this.toolInstances.simplePen);
|
||||||
// Activate listener on tool panel:
|
// Activate listener on tool panel:
|
||||||
$("#tool-section").click($.proxy(this.onToolIconClicked_, this));
|
$("#tool-section").click($.proxy(this.onToolIconClicked_, this));
|
||||||
|
|
||||||
// Show/hide the grid on drawing canvas:
|
|
||||||
$.publish(Events.GRID_DISPLAY_STATE_CHANGED, [this.isShowGridChecked_()]);
|
|
||||||
$('#show-grid').change($.proxy(function(evt) {
|
|
||||||
var checked = this.isShowGridChecked_();
|
|
||||||
$.publish(Events.GRID_DISPLAY_STATE_CHANGED, [checked]);
|
|
||||||
}, this));
|
|
||||||
};
|
};
|
||||||
})();
|
})();
|
@ -24,6 +24,7 @@ $.namespace("pskl");
|
|||||||
this.drawingController = new pskl.controller.DrawingController(frameSheet, $('#drawing-canvas-container'));
|
this.drawingController = new pskl.controller.DrawingController(frameSheet, $('#drawing-canvas-container'));
|
||||||
this.animationController = new pskl.controller.AnimatedPreviewController(frameSheet, $('#preview-canvas-container'));
|
this.animationController = new pskl.controller.AnimatedPreviewController(frameSheet, $('#preview-canvas-container'));
|
||||||
this.previewsController = new pskl.controller.PreviewFilmController(frameSheet, $('#preview-list'));
|
this.previewsController = new pskl.controller.PreviewFilmController(frameSheet, $('#preview-list'));
|
||||||
|
this.settingsController = new pskl.controller.SettingsController();
|
||||||
|
|
||||||
// To catch the current active frame, the selection manager have to be initialized before
|
// To catch the current active frame, the selection manager have to be initialized before
|
||||||
// the 'frameSheet.setCurrentFrameIndex(0);' line below.
|
// the 'frameSheet.setCurrentFrameIndex(0);' line below.
|
||||||
@ -39,6 +40,7 @@ $.namespace("pskl");
|
|||||||
|
|
||||||
this.animationController.init();
|
this.animationController.init();
|
||||||
this.previewsController.init();
|
this.previewsController.init();
|
||||||
|
this.settingsController.init();
|
||||||
|
|
||||||
this.historyService = new pskl.service.HistoryService(frameSheet);
|
this.historyService = new pskl.service.HistoryService(frameSheet);
|
||||||
this.historyService.init();
|
this.historyService.init();
|
||||||
@ -74,13 +76,6 @@ $.namespace("pskl");
|
|||||||
$('#settings').click(function(evt) {
|
$('#settings').click(function(evt) {
|
||||||
$('.right-sticky-section').toggleClass('expanded');
|
$('.right-sticky-section').toggleClass('expanded');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#canvas-picker').change(function(evt) {
|
|
||||||
$('#canvas-picker option:selected').each(function() {
|
|
||||||
console.log($(this).val());
|
|
||||||
$('html')[0].className = $(this).val();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
render : function (delta) {
|
render : function (delta) {
|
||||||
|
Reference in New Issue
Block a user