From 6cd00388ed600a307e49004724e79d9a7f81ad65 Mon Sep 17 00:00:00 2001 From: Ivan Borshchov Date: Fri, 27 Sep 2019 12:44:22 +0300 Subject: [PATCH] make redo hidden by default, add image.getWidth(), image.getHeight() --- README.md | 2 ++ build/index.html | 4 +++- js/main.js | 2 ++ js/params.js | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e764f4a..8fe47c3 100644 --- a/README.md +++ b/README.md @@ -185,6 +185,8 @@ Events accepted arguments: asBlob: ƒ asBlob(type, quality) asDataURL: ƒ asDataURL(type, quality) suggestedFileName: ƒ suggestedFileName(type) + getWidth: ƒ getWidth() + getHeight: ƒ getHeight() } operationsDone: int } diff --git a/build/index.html b/build/index.html index 39d90a4..d750cce 100644 --- a/build/index.html +++ b/build/index.html @@ -70,7 +70,9 @@ availableFontSizes: [1,2,4,8,16,64], availableArrowLengths: [10,20,30,40,50,60], // how_to_paste_actions: ['replace_all'], - + saveHandler: (saver) => { + console.log('saving', saver.getWidth(), saver.getHeight()) + } //toolbarPosition: 'top', // fixMobilePageReloader: false, // defaultTool: 'line', diff --git a/js/main.js b/js/main.js index 8617db4..a417f81 100644 --- a/js/main.js +++ b/js/main.js @@ -575,6 +575,8 @@ class PainterroProc { } return `${(this.loadedName || `image-${genId()}`)}.${realType}`; }, + getWidth: () => this.size.w, + getHeight: () => this.size.h, }; this.initEventHandlers(); diff --git a/js/params.js b/js/params.js index ae6a676..ab8eaad 100644 --- a/js/params.js +++ b/js/params.js @@ -78,7 +78,7 @@ export function setDefaults(parameters) { params.worklogLimit = firstDefined(params.worklogLimit, 100); params.defaultTool = params.defaultTool || 'select'; - params.hiddenTools = params.hiddenTools || []; + params.hiddenTools = params.hiddenTools || ['redo']; const defaultInHiddenIndex = params.hiddenTools.indexOf(params.defaultTool); if (defaultInHiddenIndex > -1) { logError(`Can't hide default tool '${params.defaultTool}', please change default tool to another to hide it`);