瀏覽代碼

添加覆盖物对鼠标移动事件的支持

tags/1.13.2
Caven Chen 4 年之前
父節點
當前提交
a3e1c18209
共有 2 個檔案被更改,包括 12 行新增11 行删除
  1. 1
    0
      src/core/event/EventType.js
  2. 11
    11
      src/core/overlay/model/Tileset.js

+ 1
- 0
src/core/event/EventType.js 查看文件

CLICK: Cesium.ScreenSpaceEventType.LEFT_CLICK, CLICK: Cesium.ScreenSpaceEventType.LEFT_CLICK,
RIGHT_CLICK: Cesium.ScreenSpaceEventType.RIGHT_CLICK, RIGHT_CLICK: Cesium.ScreenSpaceEventType.RIGHT_CLICK,
DB_CLICK: Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK, DB_CLICK: Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,
MOUSE_MOVE: Cesium.ScreenSpaceEventType.MOUSE_MOVE,
MOUSE_OVER: 'mouseover', MOUSE_OVER: 'mouseover',
MOUSE_OUT: 'mouseout' MOUSE_OUT: 'mouseout'
} }

+ 11
- 11
src/core/overlay/model/Tileset.js 查看文件

* *
* @private * @private
*/ */
_initVisibleEvent() {
if (!this._tileVisibleCallback) {
this._tileVisibleCallback = this._delegate.tileVisible.addEventListener(
this._updateTile,
this
)
}
_bindVisibleEvent() {
this._tileVisibleCallback && this._tileVisibleCallback()
this._tileVisibleCallback = this._delegate.tileVisible.addEventListener(
this._updateTile,
this
)
} }


/** /**
/** /**
* Sets height * Sets height
* @param height * @param height
* @param isAbsolute
* @returns {Tileset} * @returns {Tileset}
*/ */
setHeight(height) {
setHeight(height, isAbsolute = false) {
this.readyPromise.then(tileset => { this.readyPromise.then(tileset => {
let center = Cesium.Cartographic.fromCartesian( let center = Cesium.Cartographic.fromCartesian(
tileset.boundingSphere.center tileset.boundingSphere.center
let offset = Cesium.Cartesian3.fromRadians( let offset = Cesium.Cartesian3.fromRadians(
center.longitude, center.longitude,
center.latitude, center.latitude,
center.height + height
isAbsolute ? height : center.height + height
) )
let translation = Cesium.Cartesian3.subtract( let translation = Cesium.Cartesian3.subtract(
offset, offset,
*/ */
setProperties(properties) { setProperties(properties) {
this._properties = properties this._properties = properties
this._initVisibleEvent()
this._bindVisibleEvent()
return this return this
} }


*/ */
setCustomShader(customShader) { setCustomShader(customShader) {
this._customShader = customShader this._customShader = customShader
this._initVisibleEvent()
this._bindVisibleEvent()
return this return this
} }



Loading…
取消
儲存