shuishen
2023-04-12 ac59d030fef13920f65b65e9fe0b09d086547be7
src/utils/tools/DrawTool.js
@@ -19,7 +19,7 @@
class DrawTool {
    constructor() {
        this._viewer = undefined
        this._anchorLayer = new global.DC.Namespace.Cesium.CustomDataSource('draw-anchor-layer')
        this._anchorLayer = undefined
        this._floatingAnchor = undefined
        this._options = {}
        this._plotEvent = new PlotEvent()
@@ -88,10 +88,10 @@
     * @private
     */
    _onCreateAnchor ({ position, isCenter = false }) {
        console.log(this._options, 6633333)
        return this._anchorLayer.entities.add({
            position: position,
            billboard: {
                show: true,
                image: isCenter ? this._options.icon_center : this._options.icon_anchor,
                width: this._options.icon_size[0],
                height: this._options.icon_size[1],
@@ -178,6 +178,9 @@
     * @returns {DrawTool}
     */
    activate (options = {}) {
        this._anchorLayer = new global.DC.Namespace.Cesium.CustomDataSource('draw-anchor-layer')
        this._viewer.dataSources.add(this._anchorLayer)
        this._viewer.tooltip.enable = true
        this._options = { ...DEF_OPTS, ...options }
        this._unbindEvent()
@@ -195,6 +198,7 @@
        this._viewer.tooltip.enable = false
        this._anchorLayer.entities.removeAll()
        this._floatingAnchor = undefined
        this._viewer.dataSources.remove(this._anchorLayer)
        return this
    }
@@ -204,7 +208,6 @@
     */
    install (viewer) {
        this._viewer = viewer
        this._viewer.dataSources.add(this._anchorLayer)
        Object.defineProperty(this._viewer, 'curDrawTool', {
            value: this,
            writable: true,