feat: show a mid point for linear elements (#5534)

* feat: Add a mid point for linear elements

* fix tests

* show mid point only on hover

* hacky fix :(

* don't add mid points if present and only add outside editor

* improve styling and always show phantom point instead of just on hover

* fix tests

* fix

* only add polyfill for test

* add hover state for phantom point

* fix tests

* fix

* Add Array.at polyfill

* reuse `centerPoint()` helper

* reuse `distance2d`

* use `Point` type

Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
Aakansha Doshi 2022-08-11 20:16:25 +05:30 committed by GitHub
parent 731093f631
commit 5a8dbe8030
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 266 additions and 43 deletions

View file

@ -10982,6 +10982,7 @@ Object {
"hoverPointIndex": -1,
"isDragging": false,
"lastUncommittedPoint": null,
"midPointHovered": false,
"pointerDownState": Object {
"lastClickedPoint": -1,
"prevSelectedPointsIndices": null,
@ -11207,6 +11208,7 @@ Object {
"hoverPointIndex": -1,
"isDragging": false,
"lastUncommittedPoint": null,
"midPointHovered": false,
"pointerDownState": Object {
"lastClickedPoint": -1,
"prevSelectedPointsIndices": null,
@ -11659,6 +11661,7 @@ Object {
"hoverPointIndex": -1,
"isDragging": false,
"lastUncommittedPoint": null,
"midPointHovered": false,
"pointerDownState": Object {
"lastClickedPoint": -1,
"prevSelectedPointsIndices": null,
@ -12063,6 +12066,7 @@ Object {
"hoverPointIndex": -1,
"isDragging": false,
"lastUncommittedPoint": null,
"midPointHovered": false,
"pointerDownState": Object {
"lastClickedPoint": -1,
"prevSelectedPointsIndices": null,

View file

@ -21,6 +21,10 @@ Object {
0,
0,
],
Array [
15,
25,
],
Array [
30,
50,
@ -36,8 +40,8 @@ Object {
"strokeWidth": 1,
"type": "arrow",
"updated": 1,
"version": 3,
"versionNonce": 449462985,
"version": 4,
"versionNonce": 453191,
"width": 30,
"x": 10,
"y": 10,
@ -65,6 +69,10 @@ Object {
0,
0,
],
Array [
15,
25,
],
Array [
30,
50,
@ -80,8 +88,8 @@ Object {
"strokeWidth": 1,
"type": "line",
"updated": 1,
"version": 3,
"versionNonce": 449462985,
"version": 4,
"versionNonce": 453191,
"width": 30,
"x": 10,
"y": 10,