-
Notifications
You must be signed in to change notification settings - Fork 1.3k
ImageEditor 2.0.0 Migration guide
์ ๋์ edited this page May 24, 2017
·
10 revisions
(translating)
There are a lot of changes for ImageEditor 2.0.0 including API changes and new features. This migration document will be nicely moving 2.0.0.
-
New APIs
-
startDrawingMode(modeName)
starts a drawing mode -
stopDrawingMode()
stops current drawing mode and back to 'NORMAL' mode -
getDrawingMode()
returns current drawing mode name. -
getCropzoneRect()
returns cropping rect in 'CROPPER' drawing mode. -
crop(rect)
crops image given area
-
-
Removed APIs
-
startCropping
,endCropping
-
startDrawingShapeMode
,endDrawingShapeMode
-
startFreeDrawing
,endFreeDrawing
-
startLineDrawing
,endLineDrawing
-
startTextMode
,endTextMode
endAll
-
endCropping
is divided into three APIs
-
var rect = imageEditor.getCropzoneRect();
imageEditor.crop(rect).then(() => {
imageEditor.stopDrawingMode();
});
-
removeActiveObject()
==>removeObject(id)
- In versions prior to 1.4.1, the users should select an object and manipulate it which is called 'active object'. There was no way to manipulate non-selected object. After 2.0.0 version, you can manipulate not only selected object, but also non-selected objects by receiving the Object Id.
- To get the Object Id, use the parameter.id in Promise.then() and the event callback.
imageEditor.addShape('circle', {
fill: 'red',
stroke: 'blue',
strokeWidth: 3,
rx: 10,
ry: 100,
isRegular: false
}).then(function(props) {
console.log(props.id);
imageEditor.changeShape(props.id, { // change circle
fill: '#FFFF00',
strokeWidth: 10
});
});
/*
{
id: number
type: type
left: number,
top: number,
width: number,
fill: string
stroke: string
strokeWidth: number
opacity: number,
// text object
text: string,
fontFamily: string,
fontSize: number,
fontStyle: string,
fontWeight: string,
textAlign: string,
textDecoration: string
}
*/
imageEditor.on('objectActivated', function(props) {
console.log(props);
console.log(props.type);
console.log(props.id);
});
- All drawing APIs returns Promise and supports Undo/Redo.
- List of related APIs
-
addIcon
,addImageObject
,addShape
,changeIconColor
-
changeShape
,addText
,changeText
,changeTextStyle
, -
resizeCanvasDimension
,applyFilter
,removeFilter
, -
clearObjects
,flipX
,flipY
,loadImageFromFile
, -
loadImageFromURL
,redo
,undo
,removeObject
, -
resetFlip
,rotate
,setAngle
,crop
, -
setObjectPosition
,setObjectProperties
-
As-Is | To-Be | ๋ณ๊ฒฝ | ์ด์ |
---|---|---|---|
addText | ์ด๋ฆ ๋ณ๊ฒฝ | 'TEXT' ๋ชจ๋์์ mousedown์ด ์์ ๊ฒฝ์ฐ ๋ฐ์ ๋ณดํต ์ด๋ฒคํธ๋ฅผ ๋ฐ์ addText() ๋ฅผ ์ฌ์ฉํ๋ค. |
|
N/A | ์ ๊ฑฐ | ์ค๋ธ์ ํธ๊ฐ ์ถ๊ฐ๋ ๊ฒฝ์ฐ์ธ๋ฐ, ํ์์ฑ์ด ์์ด ์ ๊ฑฐ๋จ | |
objectMoved objectScaled |
์ด๋ฆ ๋ฐ ๊ธฐ๋ฅ ๋ณ๊ฒฝ | ์ค๋ธ์ ํธ๊ฐ ์ด๋ํ๊ฑฐ๋ ์ค์ผ์ผ๊ฐ์ด ๋ณ๊ฒฝ๋ ๊ฒฝ์ฐ ๋ฐ์ | |
N/A | ์ ๊ฑฐ |
applyFilter() API์ Promise.then()์ผ๋ก ๋์ฒด |
|
N/A | ์ ๊ฑฐ |
loadImageFromFile() , loadImageFromURL() API์ Promise.then()์ผ๋ก ๋์ฒด |
|
N/A | ์ ๊ฑฐ |
clearObjects() API์ Promise.then()์ผ๋ก ๋์ฒด |
|
textEditing | ์ด๋ฆ ๋ณ๊ฒฝ | ํ ์คํธ ์ ๋ ฅ์ด ํ์ฑํ๋ ๊ฒฝ์ฐ ๋ฐ์ | |
redoStackChanged | ์ด๋ฆ ๋ฐ ๊ธฐ๋ฅ ๋ณ๊ฒฝ | redoStack์ ๊ฐฏ์๊ฐ ๋ณ๊ฒฝ๋ ๋ ์คํ ๊ฐฏ์๋ฅผ ์ ๋ฌํ๋ค. | |
undoStackChanged | ์ด๋ฆ ๋ฐ ๊ธฐ๋ฅ ๋ณ๊ฒฝ | undoStack์ ๊ฐฏ์๊ฐ ๋ณ๊ฒฝ๋ ๋ ์คํ ๊ฐฏ์๋ฅผ ์ ๋ฌํ๋ค. | |
N/A | ์ ๊ฑฐ | ์ํ ๋ชจ๋ ๋ณ๊ฒฝ์ ์ด๋ฒคํธ ํ์ ์์. | |
N/A | ์ ๊ฑฐ | ์ํ ๋ชจ๋ ๋ณ๊ฒฝ์ ์ด๋ฒคํธ ํ์ ์์. | |
N/A | ์ ๊ฑฐ | ์ํ ๋ชจ๋ ๋ณ๊ฒฝ์ ์ด๋ฒคํธ ํ์ ์์. | |
N/A | ์ ๊ฑฐ |
flipX() , flipY() API์ Promise.then()์ผ๋ก ๋์ฒด |
|
N/A | ์ ๊ฑฐ |
loadImageFromFile() , loadImageFromURL() API์ Promise.then()์ผ๋ก ๋์ฒด |
|
mousedown | mousedown | ์ ์ง | |
redoStackChanged | ์ด๋ฆ ๋ฐ ๊ธฐ๋ฅ ๋ณ๊ฒฝ | redoStack์ ๊ฐฏ์๊ฐ ๋ณ๊ฒฝ๋ ๋ ์คํ ๊ฐฏ์๋ฅผ ์ ๋ฌํ๋ค. | |
undoStackChanged | ์ด๋ฆ ๋ฐ ๊ธฐ๋ฅ ๋ณ๊ฒฝ | undoStack์ ๊ฐฏ์๊ฐ ๋ณ๊ฒฝ๋ ๋ ์คํ ๊ฐฏ์๋ฅผ ์ ๋ฌํ๋ค. | |
N/A | ์ ๊ฑฐ |
removeObject() API์ Promise.then()์ผ๋ก ๋์ฒด |
|
N/A | ์ ๊ฑฐ |
rotate() , setAngle() API์ Promise.then()์ผ๋ก ๋์ฒด |
|
objectActivated | ์ด๋ฆ ๋ฐ ๊ธฐ๋ฅ ๋ณ๊ฒฝ | ์ค๋ธ์ ํธ๊ฐ ์ ํ๋ ๊ฒฝ์ฐ, activateText ์์ ์ฃผ๋ ํ
์คํธ ํ๋ผ๋ฏธํฐ๋ฅผ์ฌ๊ธฐ์์ ์ ๋ฌํ๋ค.ex> params.text, params.fontSize |
|
N/A | ์ ๊ฑฐ | ์ํ ๋ชจ๋ ๋ณ๊ฒฝ์ ์ด๋ฒคํธ ํ์ ์์. | |
N/A | ์ ๊ฑฐ | ์ํ ๋ชจ๋ ๋ณ๊ฒฝ์ ์ด๋ฒคํธ ํ์ ์์. | |
N/A | ์ ๊ฑฐ | ์ํ ๋ชจ๋ ๋ณ๊ฒฝ์ ์ด๋ฒคํธ ํ์ ์์. |
- Can not call APIs from within callback function
- Remove object shape tool