feat: @idraw/core addElement return uuid

This commit is contained in:
chenshenhai 2021-06-24 19:49:51 +08:00
parent 50c4bc1b96
commit ae5cc67127
2 changed files with 4 additions and 2 deletions

View file

@ -1,6 +1,7 @@
# @idraw/core
* [] Area select
* [] Hover element style
* [] Keep all num two decimals
* [x] Cursor style
* [x] Can't controll element at scroll-area

View file

@ -203,13 +203,14 @@ class Core {
this.draw();
}
addElement(elem: TypeElement<keyof TypeElemDesc>) {
if (this[_onlyRender] === true) return;
addElement(elem: TypeElement<keyof TypeElemDesc>): string | null {
if (this[_onlyRender] === true) return null;
const _elem = deepClone(elem);
_elem.uuid = createUUID();
this[_data].elements.unshift(_elem);
this[_emitChangeData]();
this.draw();
return _elem.uuid;
}
deleteElement(uuid: string) {