File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change 1
- import { extend , isNil , isString } from '../core/util' ;
1
+ import { extend , isNil , isNumber , isString } from '../core/util' ;
2
2
import { createEl , setStyle , removeDomNode } from '../core/util/dom' ;
3
3
import Eventable from '../core/Eventable' ;
4
4
import Class from '../core/Class' ;
@@ -229,8 +229,11 @@ class Control extends Eventable(Class) {
229
229
}
230
230
for ( const p in position ) {
231
231
if ( position . hasOwnProperty ( p ) ) {
232
- position [ p ] = parseInt ( position [ p ] ) ;
233
- this . __ctrlContainer . style [ p ] = position [ p ] + 'px' ;
232
+ let v = position [ p ] || 0 ;
233
+ if ( isNumber ( v ) ) {
234
+ v += 'px' ;
235
+ }
236
+ this . __ctrlContainer . style [ p ] = v ;
234
237
}
235
238
}
236
239
/**
@@ -251,20 +254,20 @@ class Control extends Eventable(Class) {
251
254
252
255
Control . positions = {
253
256
'top-left' : {
254
- 'top' : 20 ,
255
- 'left' : 20
257
+ 'top' : 20 ,
258
+ 'left' : 20
256
259
} ,
257
260
'top-right' : {
258
- 'top' : 20 ,
259
- 'right' : 20
261
+ 'top' : 20 ,
262
+ 'right' : 20
260
263
} ,
261
264
'bottom-left' : {
262
265
'bottom' : 20 ,
263
- 'left' : 20
266
+ 'left' : 20
264
267
} ,
265
268
'bottom-right' : {
266
269
'bottom' : 20 ,
267
- 'right' : 20
270
+ 'right' : 20
268
271
}
269
272
} ;
270
273
You can’t perform that action at this time.
0 commit comments