tui-image-editor
Advanced tools
Comparing version 3.14.0 to 3.14.1
@@ -1,2 +0,2 @@ | ||
// Type definitions for TOAST UI Image Editor v3.13.0 | ||
// Type definitions for TOAST UI Image Editor v3.14.0 | ||
// TypeScript Version: 3.2.2 | ||
@@ -3,0 +3,0 @@ |
{ | ||
"name": "tui-image-editor", | ||
"author": "NHN. FE Development Lab <dl_javascript@nhn.com>", | ||
"version": "3.14.0", | ||
"version": "3.14.1", | ||
"license": "MIT", | ||
@@ -91,3 +91,3 @@ "repository": { | ||
}, | ||
"gitHead": "e1926f6cbb4dfd3e0c3c52438d458ed1882cc4c4" | ||
"gitHead": "41a1d24d8945ac99b2d5d6b5514a827d42929111" | ||
} |
@@ -35,2 +35,12 @@ /** | ||
const DEFAULT_ZOOM_LEVEL = 1.0; | ||
const { | ||
ZOOM_CHANGED, | ||
ADD_TEXT, | ||
TEXT_EDITING, | ||
OBJECT_MODIFIED, | ||
KEY_DOWN, | ||
KEY_UP, | ||
HAND_STARTED, | ||
HAND_STOPPED, | ||
} = eventNames; | ||
@@ -92,4 +102,4 @@ /** | ||
zoomChanged: this._changeScrollState.bind(this), | ||
keydown: this._onKeyDown.bind(this), | ||
keyup: this._onKeyUp.bind(this), | ||
keydown: this._startHandModeWithSpaceBar.bind(this), | ||
keyup: this._endHandModeWithSpaceBar.bind(this), | ||
}; | ||
@@ -119,15 +129,34 @@ | ||
canvas.on(eventNames.ZOOM_CHANGED, this._listeners.zoomChanged); | ||
canvas.on(ZOOM_CHANGED, this._listeners.zoomChanged); | ||
fabric.util.addListener(document, 'keydown', this._listeners.keydown); | ||
fabric.util.addListener(document, 'keyup', this._listeners.keyup); | ||
this.graphics.on(ADD_TEXT, this._startTextEditingHandler.bind(this)); | ||
this.graphics.on(TEXT_EDITING, this._startTextEditingHandler.bind(this)); | ||
this.graphics.on(OBJECT_MODIFIED, this._stopTextEditingHandler.bind(this)); | ||
fabric.util.addListener(document, KEY_DOWN, this._listeners.keydown); | ||
fabric.util.addListener(document, KEY_UP, this._listeners.keyup); | ||
} | ||
/** | ||
* Keydown event handler | ||
* Handler when you started editing text | ||
* @private | ||
*/ | ||
_startTextEditingHandler() { | ||
this.isTextEditing = true; | ||
} | ||
/** | ||
* Handler when you stopped editing text | ||
* @private | ||
*/ | ||
_stopTextEditingHandler() { | ||
this.isTextEditing = false; | ||
} | ||
/** | ||
* Handler who turns on hand mode when the space bar is down | ||
* @param {KeyboardEvent} e - Event object | ||
* @private | ||
*/ | ||
_onKeyDown(e) { | ||
if (this.withSpace) { | ||
_startHandModeWithSpaceBar(e) { | ||
if (this.withSpace || this.isTextEditing) { | ||
return; | ||
@@ -144,7 +173,7 @@ } | ||
/** | ||
* Keyup event handler | ||
* Handler who turns off hand mode when space bar is up | ||
* @param {KeyboardEvent} e - Event object | ||
* @private | ||
*/ | ||
_onKeyUp(e) { | ||
_endHandModeWithSpaceBar(e) { | ||
if (e.keyCode === keyCodes.SPACE) { | ||
@@ -246,3 +275,3 @@ e.preventDefault(); | ||
canvas.fire(eventNames.HAND_STARTED); | ||
canvas.fire(HAND_STARTED); | ||
} | ||
@@ -265,3 +294,3 @@ | ||
canvas.fire(eventNames.HAND_STOPPED); | ||
canvas.fire(HAND_STOPPED); | ||
} | ||
@@ -666,3 +695,3 @@ | ||
_fireZoomChanged(canvas, zoomLevel) { | ||
canvas.fire(eventNames.ZOOM_CHANGED, { viewport: canvas.calcViewportBoundaries(), zoomLevel }); | ||
canvas.fire(ZOOM_CHANGED, { viewport: canvas.calcViewportBoundaries(), zoomLevel }); | ||
} | ||
@@ -669,0 +698,0 @@ |
@@ -170,2 +170,4 @@ /** | ||
HAND_STOPPED: 'handStopped', | ||
KEY_DOWN: 'keydown', | ||
KEY_UP: 'keyup', | ||
}; | ||
@@ -172,0 +174,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
41459
4361653