Browse Source

Merge cef17d20bb into 1506483f1e

pull/218/merge
Luoyy 2 weeks ago
parent
commit
8b6e4b548d
No account linked to committer's email address
2 changed files with 12 additions and 7 deletions
  1. 11
    7
      src/modules/layer/type/HtmlLayer.js
  2. 1
    0
      src/modules/overlay/html/DivIcon.js

+ 11
- 7
src/modules/layer/type/HtmlLayer.js View File

@@ -4,7 +4,7 @@

import { Cesium } from '../../../libs'
import State from '../../state/State'
import { DomUtil } from '../../utils'
import { Util, DomUtil } from '../../utils'
import { Transform } from '../../transform'
import Layer from '../Layer'

@@ -13,6 +13,15 @@ class HtmlLayer extends Layer {
super(id)
this._delegate = DomUtil.create('div', 'html-layer', undefined)
this._delegate.setAttribute('id', this._id)
Util.merge(this._delegate.style, {
position: 'absolute',
left: '0',
top: '0',
width: '100%',
height: '100%',
pointerEvents: 'none',
})

this._renderRemoveCallback = undefined
this._state = State.INITIALIZED
}
@@ -45,7 +54,7 @@ class HtmlLayer extends Layer {
this._renderRemoveCallback = scene.postRender.addEventListener(() => {
let cp = this._viewer.camera.positionWC
let cd = this._viewer.camera.direction
const offset = this._viewer.getOffset()
this.eachOverlay((item) => {
if (item && item.position) {
let position = Transform.transformWGS84ToCartesian(item.position)
@@ -57,11 +66,6 @@ class HtmlLayer extends Layer {
scene,
position
)

if (windowCoord) {
windowCoord.x += offset.x
windowCoord.y += offset.y
}
item._updateStyle(
windowCoord,
Cesium.Cartesian3.distance(position, cp),

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

@@ -21,6 +21,7 @@ class DivIcon extends Overlay {
position: 'absolute',
top: '0',
left: '0',
pointerEvents: 'auto',
})
this.content = content
this._state = State.INITIALIZED

Loading…
Cancel
Save