Documentation ImageEditor.js
This commit is contained in:
@@ -9,7 +9,7 @@ function ImageEditor(canvasId, args) {
|
||||
var _settings = $.extend({
|
||||
// Type defaults to wallpaper
|
||||
type: 'wallpaper',
|
||||
// Default texts on the buttons. This van
|
||||
// Default texts on the buttons
|
||||
buttons: {
|
||||
flat: 'Flat',
|
||||
threeD: '3d',
|
||||
@@ -24,16 +24,16 @@ function ImageEditor(canvasId, args) {
|
||||
|
||||
// Initialize canvas
|
||||
_canvas = new Canvas(canvasId);
|
||||
|
||||
// Let Canvas know which type it is, canvas or wallpaper since it is
|
||||
// accessible for all objects contained within.
|
||||
_canvas.set({
|
||||
__type: _settings.type
|
||||
});
|
||||
|
||||
/**
|
||||
* @TODO: Refactor this. Since Canvas knows the type of editor it probably
|
||||
* better could reside there.
|
||||
*/
|
||||
// Adding buttons to the canvas depending on which type is active.
|
||||
// It might be better that this resides somewhere else, either in Canvas or
|
||||
// during the initialization of the image editor.
|
||||
if (_canvas.__type === 'canvas') {
|
||||
_canvas.getButtonMenu()
|
||||
.addItem('flat', _settings.buttons.flat, function () {
|
||||
@@ -57,6 +57,7 @@ function ImageEditor(canvasId, args) {
|
||||
.render();
|
||||
}
|
||||
|
||||
// Binding fullscreen change event to the image-editor wrapper. This way we can set the correct button active.
|
||||
$(_canvas.getSelectionElement().parentNode).bind('webkitfullscreenchange mozfullscreenchange fullscreenchange', function(e) {
|
||||
var isFullscreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
|
||||
|
||||
@@ -95,6 +96,7 @@ function ImageEditor(canvasId, args) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Loads the image into the canvas.
|
||||
* @param {Number|String} url
|
||||
* @param {Function} callback
|
||||
* @return {ImageEditor}
|
||||
|
||||
Reference in New Issue
Block a user