Browse Source

improve the DivIcon style

tags/2.6.1
Caven Chen 4 years ago
parent
commit
4f5efe4b15
1 changed files with 14 additions and 0 deletions
  1. 14
    0
      modules/overlay/html/DivIcon.js

+ 14
- 0
modules/overlay/html/DivIcon.js View File

// set translate // set translate
let x = windowCoord.x - this._delegate.offsetWidth / 2 let x = windowCoord.x - this._delegate.offsetWidth / 2
let y = windowCoord.y - this._delegate.offsetHeight / 2 let y = windowCoord.y - this._delegate.offsetHeight / 2

if (this._style.position === 'topleft') {
x = windowCoord.x
y = windowCoord.y
} else if (this._style.position === 'topright') {
x = windowCoord.x - this._delegate.offsetWidth
y = windowCoord.y
} else if (this._style.position === 'bottomleft') {
x = windowCoord.x
y = windowCoord.y - this._delegate.offsetHeight
} else if (this._style.position === 'bottomright') {
x = windowCoord.x - this._delegate.offsetWidth
y = windowCoord.y - this._delegate.offsetHeight
}
let translate3d = `translate3d(${Math.round(x)}px,${Math.round(y)}px, 0)` let translate3d = `translate3d(${Math.round(x)}px,${Math.round(y)}px, 0)`


// set scale // set scale

Loading…
Cancel
Save