File tree Expand file tree Collapse file tree 3 files changed +12
-13
lines changed Expand file tree Collapse file tree 3 files changed +12
-13
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " react-design-editor" ,
3
- "version" : " 0.0.42 " ,
3
+ "version" : " 0.0.43 " ,
4
4
"description" : " Design Editor Tools with React.js + ant.design + fabric.js" ,
5
5
"main" : " dist/react-design-editor.min.js" ,
6
6
"typings" : " lib/index.d.ts" ,
Original file line number Diff line number Diff line change @@ -1538,22 +1538,21 @@ class Handler implements HandlerOptions {
1538
1538
let prevLeft = 0 ;
1539
1539
let prevTop = 0 ;
1540
1540
this . canvas . setBackgroundColor ( this . canvasOption . backgroundColor , this . canvas . renderAll . bind ( this . canvas ) ) ;
1541
- const workareaExist = json . filter ( ( obj : FabricObjectOption ) => obj . id === 'workarea' ) ;
1541
+ const workarea = json . find ( ( obj : FabricObjectOption ) => obj . id === 'workarea' ) ;
1542
1542
if ( ! this . workarea ) {
1543
1543
this . workareaHandler . initialize ( ) ;
1544
1544
}
1545
- if ( ! workareaExist . length ) {
1546
- this . canvas . centerObject ( this . workarea ) ;
1547
- this . workarea . setCoords ( ) ;
1548
- prevLeft = this . workarea . left ;
1549
- prevTop = this . workarea . top ;
1550
- } else {
1551
- const workarea = workareaExist [ 0 ] ;
1545
+ if ( workarea ) {
1552
1546
prevLeft = workarea . left ;
1553
1547
prevTop = workarea . top ;
1554
1548
this . workarea . set ( workarea ) ;
1555
1549
await this . workareaHandler . setImage ( workarea . src , true ) ;
1556
1550
this . workarea . setCoords ( ) ;
1551
+ } else {
1552
+ this . canvas . centerObject ( this . workarea ) ;
1553
+ this . workarea . setCoords ( ) ;
1554
+ prevLeft = this . workarea . left ;
1555
+ prevTop = this . workarea . top ;
1557
1556
}
1558
1557
json . forEach ( ( obj : FabricObjectOption ) => {
1559
1558
if ( obj . id === 'workarea' ) {
Original file line number Diff line number Diff line change 1
- import ReactDOM from 'react-dom' ;
2
1
import debounce from 'lodash/debounce' ;
3
-
4
- import Handler from './Handler' ;
2
+ import ReactDOM from 'react-dom' ;
5
3
import { FabricObject } from '../utils' ;
4
+ import Handler from './Handler' ;
5
+
6
6
7
7
class TooltipHandler {
8
8
handler : Handler ;
@@ -54,7 +54,7 @@ class TooltipHandler {
54
54
let element = target . name as any ;
55
55
const { onTooltip } = this . handler ;
56
56
if ( onTooltip ) {
57
- element = await onTooltip ( this . tooltipEl , target ) ;
57
+ element = await onTooltip ( tooltip , target ) ;
58
58
if ( ! element ) {
59
59
return ;
60
60
}
You can’t perform that action at this time.
0 commit comments