Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drawTool在绘制point后调用禁用函数,会在禁用所在位置坐标下新生成一个point #1848

Closed
Wuli-Zhang opened this issue Nov 24, 2022 · 0 comments · Fixed by #1849

Comments

@Wuli-Zhang
Copy link

maptalks's version and what browser you use?
---- 1.0.0-rc.14

Issue description
---- drawTool绘制任何图形都可以正常绘制。如果调用禁用函数(disable),那么绘制Point的时候会在禁用时候的鼠标在的坐标下生成一个Point;如果禁用函数在drawend监听回调函数内调用,则不会出现。
linestring和polygon都正常不会多绘制一个图形只有point会在上述情况下多绘制一个。

Please provide a reproduction URL (on any jsfiddle like site)

        mode: 'Point'
      }).addTo(this.map)
      this.drawTool.enable()
      const _vm = this
      this.drawTool.on('drawend', function (param) {
        if (!_vm.shapeDrawLayer) {
          _vm.shapeDrawLayer = new maptalks.VectorLayer('draw-layer').addTo(
            _vm.map
          )
        }
        _vm.shapeDrawLayer.addGeometry(param.geometry)
        param.geometry.setProperties({
          type: param.geometry.type,
          gid: param.geometry._internalId
        })
      //此时调用禁用,不会出现两个点图形。
          _vm.drawTool.disable()
       
      })
this.drawTool = new maptalks.DrawTool({
        mode: 'Point'
      }).addTo(this.map)
      this.drawTool.enable()
      const _vm = this
      this.drawTool.on('drawend', function (param) {
        if (!_vm.shapeDrawLayer) {
          _vm.shapeDrawLayer = new maptalks.VectorLayer('draw-layer').addTo(
            _vm.map
          )
        }
        _vm.shapeDrawLayer.addGeometry(param.geometry)
        param.geometry.setProperties({
          type: param.geometry.type,
          gid: param.geometry._internalId
        })
       // 延迟函数内,或其他地方调用disable,就会在图层多生成一个点位。
        setTimeout(() => {
          _vm.drawTool.disable()
        }, 1500)
      })
@Wuli-Zhang Wuli-Zhang changed the title drawTool在绘制point后调用禁用函数,会在禁用所在位置左边下新生成一个point drawTool在绘制point后调用禁用函数,会在禁用所在位置坐标下新生成一个point Nov 24, 2022
deyihu added a commit to deyihu/maptalks.js that referenced this issue Nov 24, 2022
fuzhenn pushed a commit that referenced this issue Nov 25, 2022
* fix #1848

* fix

* fix OffscreenCanvas getContext warn about willReadFrequently
fuzhenn pushed a commit that referenced this issue Mar 10, 2023
* fix #1848

* fix

* fix OffscreenCanvas getContext warn about willReadFrequently
fuzhenn added a commit that referenced this issue Mar 16, 2023
…rain surface (#1903)

* add missing onMoveStart for prjCenter in map.animate

* add _recenterOnTerrain

* improve terrain related and fix coord conversion with terrain

* camera on terrain when zooming

* consider average tile altitude in tile visiting

* fix WMS on EPSG:4490

* add drawingTiles/drawingChildTiles/drawingParentTiles stage on TileLayerCanvasRenderer

* update infowindow title default css (#1841)

* synchronize the layer's remove event (#1844)

* synchronize the layer's remove event

* fix lint error

* fix geometry remove spec( by layer.remove)

* snapTo geometry First coordinate when draw start (#1845)

* TextBox support function-type width and height (#1853)

* fix WMS on EPSG:4490

* add missing onMoveStart for prjCenter in map.animate

* TextBox support function-type width and height

* fix specs

* ignore drawend event when drawtool disable (#1849)

* fix #1848

* fix

* fix OffscreenCanvas getContext warn about willReadFrequently

* Map event system: ignore the layer when its geometry does not listen … (#1847)

* Map event system: ignore the layer when its geometry does not listen to the corresponding event

* fix event links such as mousemove link mouseenter

* some updates related with geometry events

* fix spec

* 1.0.0-rc.15

* fixed NaN height of vector-type marker when markerHeight is 0

* upgrade function-type to 1.3.0

* fix map renderer domEvent remove

* add spec for color-interpolate function-type

* 1.0.0-rc.16

* upgrade @maptalks/function-type

* 1.0.0-rc.17

* fix webgl context when starting draw tiles, fix maptalks/issues#171

* move geometryEvetns def to OverlayLayer

* use polygon offset to solve z-fighting

* fix crash on ios weixin, #1761

* upgrade feature-filter

* fix coordinatesToContainerPointsAtRes

* redraw map when startEdit

* fix TileLayerGLRenderer

* rename this.drawingTiles to this.drawingCurrentTiles

* add missing comment

* remove default z from Position

* deal with z in Position.toJSON/toFixed

* remove default z from Position

* fixing specs

* happy lint

* fixing specs

* fixing specs

* fixing specs

---------

Co-authored-by: hu de yi <mehudeyi@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant