44
55import { Cesium } from '../../../libs'
66import State from '../../state/State'
7- import { DomUtil } from '../../utils'
7+ import { Util , DomUtil } from '../../utils'
88import { Transform } from '../../transform'
99import Layer from '../Layer'
1010
@@ -13,6 +13,15 @@ class HtmlLayer extends Layer {
1313 super ( id )
1414 this . _delegate = DomUtil . create ( 'div' , 'html-layer' , undefined )
1515 this . _delegate . setAttribute ( 'id' , this . _id )
16+ Util . merge ( this . _delegate . style , {
17+ position : 'absolute' ,
18+ left : '0' ,
19+ top : '0' ,
20+ width : '100%' ,
21+ height : '100%' ,
22+ pointerEvents : 'none' ,
23+ } )
24+
1625 this . _renderRemoveCallback = undefined
1726 this . _state = State . INITIALIZED
1827 }
@@ -45,7 +54,7 @@ class HtmlLayer extends Layer {
4554 this . _renderRemoveCallback = scene . postRender . addEventListener ( ( ) => {
4655 let cp = this . _viewer . camera . positionWC
4756 let cd = this . _viewer . camera . direction
48- const offset = this . _viewer . getOffset ( )
57+
4958 this . eachOverlay ( ( item ) => {
5059 if ( item && item . position ) {
5160 let position = Transform . transformWGS84ToCartesian ( item . position )
@@ -57,11 +66,6 @@ class HtmlLayer extends Layer {
5766 scene ,
5867 position
5968 )
60-
61- if ( windowCoord ) {
62- windowCoord . x += offset . x
63- windowCoord . y += offset . y
64- }
6569 item . _updateStyle (
6670 windowCoord ,
6771 Cesium . Cartesian3 . distance ( position , cp ) ,
0 commit comments