add default values for dimensions

This commit is contained in:
Martin
2017-08-05 01:24:15 +02:00
parent 45892a045d
commit ad42bbfe03
3 changed files with 16 additions and 6 deletions
+7 -1
View File
@@ -1205,11 +1205,17 @@ function ImageEditor(canvasId, args) {
hideRulers: 'Hide Ruler', hideRulers: 'Hide Ruler',
showFullscreen: 'Fullscreen', showFullscreen: 'Fullscreen',
exitFullscreen: 'Exit Fullscreen', exitFullscreen: 'Exit Fullscreen',
},
// Default dimensions
dimensions: {
width: 800,
height: 600
} }
}, args); }, args);
// Initialize canvas // Initialize canvas
_canvas = new Canvas(canvasId, args.dimensions); _canvas = new Canvas(canvasId, _settings.dimensions);
// Let Canvas know which type it is, canvas or wallpaper since it is // Let Canvas know which type it is, canvas or wallpaper since it is
// accessible for all objects contained within. // accessible for all objects contained within.
+2 -4
View File
@@ -11,11 +11,9 @@
<script type="text/javascript"> <script type="text/javascript">
var width = document.getElementById('width'); var width = document.getElementById('width');
var height = document.getElementById('height'); var height = document.getElementById('height');
var dimensions = {width: 800, height: 600};
var editor = new ImageEditor('image-editor', { var editor = new ImageEditor('image-editor', {
type: 'photo-wallpaper', type: 'photo-wallpaper'
dimensions: dimensions
}); });
function cropImage() { function cropImage() {
@@ -27,7 +25,7 @@
if(isFullscreen) { if(isFullscreen) {
editor.canvas.resize({width: window.innerWidth, height: window.innerHeight}); editor.canvas.resize({width: window.innerWidth, height: window.innerHeight});
} else { } else {
editor.canvas.resize(dimensions); editor.canvas.resize({width: 800, height: 600});
} }
} }
+7 -1
View File
@@ -19,11 +19,17 @@ function ImageEditor(canvasId, args) {
hideRulers: 'Hide Ruler', hideRulers: 'Hide Ruler',
showFullscreen: 'Fullscreen', showFullscreen: 'Fullscreen',
exitFullscreen: 'Exit Fullscreen', exitFullscreen: 'Exit Fullscreen',
},
// Default dimensions
dimensions: {
width: 800,
height: 600
} }
}, args); }, args);
// Initialize canvas // Initialize canvas
_canvas = new Canvas(canvasId, args.dimensions); _canvas = new Canvas(canvasId, _settings.dimensions);
// Let Canvas know which type it is, canvas or wallpaper since it is // Let Canvas know which type it is, canvas or wallpaper since it is
// accessible for all objects contained within. // accessible for all objects contained within.