Skip to content

feat:Geometry edit support dragOnAxis#2818

Merged
fuzhenn merged 3 commits intomaptalks:masterfrom
deyihu:2697
Feb 10, 2026
Merged

feat:Geometry edit support dragOnAxis#2818
fuzhenn merged 3 commits intomaptalks:masterfrom
deyihu:2697

Conversation

@deyihu
Copy link
Copy Markdown
Collaborator

@deyihu deyihu commented Feb 6, 2026

fix #2817
fix #2697

   const point = new maptalks.Marker(map.getCenter(), {
                // draggable: true,
                // dragOnAxis: 'y'
            }).addTo(pointLayer);
            point.startEdit({
                dragOnAxis: 'y'
            });

@@ -143,6 +144,32 @@ function onHandleDragEnd(ev: Record<string, any>): boolean {
return false;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以把calCoordOffsetByDragOnAxis 参数改为如下形式,更清晰一些:

function calCoordOffsetByDragOnAxis(
  currentCoord?: Coordinate, offset: Coordinate, dragOnAxis?: string
):
  • 参数只传递 currentCoord 和 offset
  • 有preCoord时,offset 参数通过计算得到: currentCoord.sub(preCoord)
  • 没有currentCoord时,根据axis修改offset并返回

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我已经拆成两个方法,这样不会又迷惑性了

@deyihu deyihu requested a review from fuzhenn February 10, 2026 07:18
@fuzhenn fuzhenn merged commit ddb4b0f into maptalks:master Feb 10, 2026
3 checks passed
@deyihu deyihu deleted the 2697 branch February 10, 2026 09:23
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 this pull request may close these issues.

Geometry dragOnAxis not effective polygon startEdit时能控制只沿x,y方向拖拽方向吗

2 participants