-
Notifications
You must be signed in to change notification settings - Fork 365
Normalize annotations elements to be based on common box model #706
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
Changes from all commits
5e7697f
798ba76
2203073
caec490
df46aec
8344dd6
81891e0
28168ad
9665724
57c162b
1d6446a
223414f
869bc05
a4004ad
c66d682
87daf8c
e9db75b
dd3f731
5cd9c0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<mxfile host="Electron" modified="2021-12-10T16:40:28.953Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/15.8.7 Chrome/91.0.4472.164 Electron/13.6.2 Safari/537.36" etag="xfEp3uVgfdj0fbe-stYk" version="15.8.7" type="device"><diagram id="EVLCtf8sz0nmjKRDlPg8" name="Page-1">7VfLjtsgFP0aL1PZ4EeyrD0zjapWqhRV064qGhMbFfu6mDROvr5gkziERNORMg9V403gcO81nMMBx8NZ1X0QpCk/Q065h/y88/CNh1AQ+Ej9aGQ7INM4GoBCsNwEjcCC7agBfYOuWU5bK1ACcMkaG1xCXdOltDAiBGzssBVw+60NKagDLJaEu+g9y2VpVoGSEZ9TVpT7NwfxbBipyD7YrKQtSQ6bIwjfejgTAHJoVV1GuSZvz8uQd3dh9DAxQWv5Lwnp/W4e/9iFWTNHv78sJvLTx68TU+UP4WuzYDNZud0zIGBd51QX8T2cbkom6aIhSz26UZorrJQVV71ANU05KiTtLs4zOKxebRsKFZViq0JMAvINYWbHoND0NyP/ODZYecT9IZEYzYtD7ZEW1TDMPIIl9DBLqorakvRhhkjbDPt0xTrNarpinGfAQfSF8PBch0qcJO8ii0yMD8gRnZFLZvREVGKHys5D2dbhUy1a2sQJ2rId+dkH6J1I1hLa4bzoeeWsqFV7qbihistUM8eUkd+bgYrluU5OG2C17NcVpV50cyJBDbUOaqWAX/QEtK2wglqaAwuFOkVpzuoiBSmhUmB4HRGD5MQPvuuH6IwdwqdyQ+hIOHD+TQmpT+K+8/1N0csn3NQ2JZqdM2Uwe05RI9eXSBvTPenedNzrGGHbmeGZmyp5ThFjR8RhJq9GQnW/3fXPq9IRhyd+RC+sY+LoaF77PwspQBLJQE9iMvOvdHfGtkPxGWWn11FWdcdv+X7s6B8Rvv0L</diagram></mxfile> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<mxfile host="Electron" modified="2022-04-06T13:33:15.938Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/16.5.1 Chrome/96.0.4664.110 Electron/16.0.7 Safari/537.36" etag="mGhTzBLkctCHceS27j_i" version="16.5.1" type="device"><diagram id="EVLCtf8sz0nmjKRDlPg8" name="Page-1">7Vddb5swFP01PGYCG0LyOGg+VG3SJDS13cvkBQesAZcaZyH59bPBJCFO1ExKqmgqL9jH11/n+FyMhcO8nnFSpl8hppmF7Li28IOFkOPYSL4UsmmR0dBrgYSzWAftgYhtqQZtja5YTKteoADIBCv74AKKgi5EDyOcw7oftoSsP2tJEmoA0YJkJvrEYpHqXSB/j88pS9JuZmc4blty0gXrnVQpiWF9AOGJhUMOINpSXoc0U+R1vLT9pmdadwvjtBCXdAietvPhz60blnP0+i0aiC+P3wd6lD8kW+kN68WKTccAh1URUzWIbeFgnTJBo5IsVOtaai6xVOSZrDmyGJMqbWJVxVxhNx3lgtYHkF7xjEJOBd/IEN2KbM2ePj7I1fX1Xgw81Fh6IMSuI9EHINmNvedIFjRN/0AZepsyOYo8n/RtukhVtod2yWpFW7BkWRZCBrwZCLfPdajEvv/J65GJ8Q45oNMzyfRuRCU2qKwtFG4MPuUORZ84Tiu2Jb+aAHUsyUpA1SaPhteMJYUsLyRdVHIZKJqYdPVn3ZCzOFadgxJYIZp9eYHlPRxJUEChgirB4Tc9Avu+WEIhdPZCruoiNWdFEoAQkEvQvY6Ijn/kB9v0g3fCDu6t3OAaEracP0shVVpuKi8fip7PcKO+KdH4lCmd8XuK6pm+RMqYZqb70LHT0cN9Z7onvlT+e4o4NERsV3I3Esrv27R57kpH7B758USGvZWOr48D8CP8/BJOxrMfL1M7ji66ol183zjroO5ue6W7xh1e23yDRj3v/+wHDoIIBmoRg7F9pSvIUaLDyNR2dB2DyOr+/6hpO/jLxJO/</diagram></mxfile> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<mxfile host="Electron" modified="2022-04-06T12:22:44.757Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/16.5.1 Chrome/96.0.4664.110 Electron/16.0.7 Safari/537.36" etag="B3XS2xQ8Z6Tyesn1KG14" version="16.5.1" type="device"><diagram id="EVLCtf8sz0nmjKRDlPg8" name="Page-1">7VjZcpswFP0aHpMBBMY8eskyXaaZcTJNnjKqkUEtICLkGPz1lUCswnXqxEkmE79Y92g/594rCQ3MouyCwiT4TjwUaqbuZRqYa6ZpGLrJ/wSSl8h4ZJeAT7EnGzXAAm+RBHWJrrGH0k5DRkjIcNIFlySO0ZJ1MEgp2XSbrUjYnTWBPlKAxRKGKvoTeyyQuzCdBr9E2A+qmY2RW9ZEsGosd5IG0CObFgTONDCjhLCyFGUzFAryKl7Kfuc7auuFURSzp3SY/txeju631iy5NB+uFifs25ebEznKIwzXcsNysSyvGKBkHXtIDKJrYLoJMEOLBC5F7YZrzrGARSG3DF5UF1XNgChDWQuSi7xAJEKM5ryJrDV1SZj0GNOS9qbhH4wkFrS4rztCqblfj93QwguSmf9gydzPEh+FuyTazxBMk9JPVzgTrE5XOAxnJCS0GAiUv5ehEjjOqd0hE4AaadFpq2TaR6ISKFRmmjnLFT75DlmXOIpSvIW/igbCE+GakbTMFwWvIfZjXl5yuhDncipowjyQJ7Iiwp4nOk8TgmNW7Mueava8J0FMYtEoZZT8QT2wGworEjOZsExLdOGa49ifEsZIxEHrZUQ0nF486Go82APhYB0rGixFwpLzWy6kyMSFcfep6O4M5/YUdYeC0nBfU1RbjUtTBKaa6T51rHS0QVdHa+Ckcl5TxJEiYrmSdyMhP9/Oi9+70hFY3UOyvrK9lY6OoqOc9iMLSQmDDBOxiBNXf6Gzc9SNUDCg7PhIyt78cCeT6xv0++w6f/j6eJ7Be/0p920UexPxcGm4bMvboZUTQ/NbQZh+qlugQu5E9Sm/wkl7nrXbz/O2dYUo5lsTvjBvSEee8ipSVGCQ+ojtO1JUafZcWyqMopC7w2N3GUN6yBmuhL/ufkVYdk/SlKzpEsle7WdTb6A6qVcDmb2BSh6UgQr3qLd9uMeoF+YiMuVlqyh/8LuWEu4D7rg7t/f9YKxmAGPoNXm0FKBen9UUcKTH5POYHOu9x+QQl8d5Sg4SqZ6Sz8qlGWa3ReK0DVfad626JokKI28Zh6fQMgftC/63SqGg90yxnANTKBiDf+fig1MoN5sPaGXz5jMkOPsL</diagram></mxfile> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<mxfile host="Electron" modified="2022-04-06T13:35:32.574Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/16.5.1 Chrome/96.0.4664.110 Electron/16.0.7 Safari/537.36" etag="oTq1D7feHSuL3TBc9qwE" version="16.5.1" type="device"><diagram id="EVLCtf8sz0nmjKRDlPg8" name="Page-1">7Vlbb9owFP41eWxF7CTAY6F3bVWlbirdS+USQ6yFOHNMCf31sxOHXGwu6wiiVXnBPr5/n33Od8CCw1l6xVAcfKc+Di3Q8VMLnlsA2HYHiC9pWeaWnufmhikjvupUGh7IG1bGjrLOiY+TWkdOachJXDeOaRThMa/ZEGN0Ue82oWF91RhNsWZ4GKNQtz4SnwfqFKBb2q8xmQbFyrbXz1tmqOisTpIEyKeLigleWHDIKOV5aZYOcSjBK3DJx12uaV1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Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<mxfile host="Electron" modified="2022-04-06T13:37:29.929Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/16.5.1 Chrome/96.0.4664.110 Electron/16.0.7 Safari/537.36" etag="EITPSf5pb8hXLFo2LEXO" version="16.5.1" type="device"><diagram id="EVLCtf8sz0nmjKRDlPg8" name="Page-1">3Vddb9sgFP01fsxkg52Px9lJE02dNCmasj1NNCY2KjYeJrOTXz+wcWJCpnZSHLX1i+Fwgcs53As4MMrqJUdF+pXFmDrAjWsHzh0APM8F8qeQQ4tMx0ELJJzE2ugMrMkRa9DV6J7EuDQMBWNUkMIEtyzP8VYYGOKcVabZjlFz1gIl2ALWW0RtdENikepVgMkZX2GSpN3M3njWtmSoM9YrKVMUs6oHwYUDI86YaEtZHWGqyOt4afs9/KP15BjHuXhNh3BzXI1/Hf2oWIHf39Yj8fjl+0iP8gfRvV6wdlYcOgY42+cxVoO4DgyrlAi8LtBWtVZSc4mlIqOy5slijMq0sVUV28NuOswFrnuQ9niJWYYFP0gT3Qqmmj29fYCv69VZDOBqLO0JcQKR3gDJaewzR7KgafoPysDLlMlR5P7EL9OFyqLdtDtSK9rCHaE0YpTxZiDYfrehEk4mnwKDTAhPSI/OwCYzGIhKaFFZOyA6WHzKFQqTOI5LckRPjYHalmgvWNkmj4ZXSpJclreSLiy5DBVNREb1Z92QkThWncOCkVw06wpCJ5hfSJCzXBmVgrNnfAGacbFjudDZC/iqi9Sc5EnIhGCZBP0bxYNvSnja5n0Br4SDP1Q0+JaELec/pJAqLTeVn+9dUW9ARWcXQelOrwSlN7kiKhxK1MCOS6AC085070zHASPTD8yTyr9yUl0TcbDIHFsitp68GQnl+fbQfG9KR/iKDHtXHSeWjnrajywkZwIJwpQTo5l7o0zrTc1MC2xlpwMp+5Tvl5sqGafzx2yRztdH4kb3u0kaybJ7xtzoWnnXG7qsnh9MTVvv2QkXfwE=</diagram></mxfile> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<mxfile host="Electron" modified="2022-04-06T13:38:42.435Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/16.5.1 Chrome/96.0.4664.110 Electron/16.0.7 Safari/537.36" etag="iPNnFQ5q4MATVNQFGyID" version="16.5.1" type="device"><diagram id="EVLCtf8sz0nmjKRDlPg8" name="Page-1">3VfLjpswFP0alqnAhiQsC/OIqlaqFFXTripPcMCqwYwxDcnX1waT4JhRUilIM8MG+/j6dY6PLzgwzptHjsrsG0swdYCbNA68cwDwPBfIl0L2HbKcBx2QcpLooBOwJgesQVejNUlwZQQKxqggpQluWFHgjTAwxDnbmWFbRs1ZS5RiC1hvELXRJ5KITO8CLE74CpM062f25mHXkqM+WO+kylDCdgMI3jsw5oyJrpQ3MaaKvJ6Xrt/DK63HhXFciGs6RE+H1fz3wY/LFXj5vp6Jr19+zPQofxGt9Yb1YsW+Z4CzukiwGsR1YLTLiMDrEm1U605qLrFM5FTWPFlMUJW1sapir7CfDnOBmwGkV/yIWY4F38sQ3QqWmj19fICv67uTGMDVWDYQ4ggifQDS49gnjmRB0/QflIHLlMlR5PnEl+lCVdkd2i1pFG3RllAaM8p4OxDsnttQCReLT4FBJoRHZEBnYJMZTEQltKhsHBDvLT7lDoVJHMcVOaDnNkAdS1QLVnWXR8srJWkhyxtJF5ZcRoomIl39WTfkJElU56hkpBDtvoLICe7OJChYoYIqwdkffAaavtiyQujbC/iqi9ScFGnEhGC5BP0b+cE3JTwe86GAI3bwp3KDb0nYcf5TCqmu5bby650r6i2nUxS6Z6b0wIgpvTFR4VSiBrYvgTKmfdO9Lx2ndKYfmJnKH8lUi4mcGfo0zGNwCIr8BVX1bBZs42vyFM9Y/lxXl/NUR3P/AQTHtRgQHX7Y7D+3WO3W8maMIb8aHtrnTbkDXpG3pnLHqI4LS0c97UcWkjOBBGFqEbPQvZFHvdDMX8BWdnkbZWX19LvUtg1+OuH9Pw==</diagram></mxfile> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,10 +17,10 @@ export function inPointRange(point, center, radius, borderWidth) { | |
return (Math.pow(point.x - center.x, 2) + Math.pow(point.y - center.y, 2)) <= Math.pow(radius + hBorderWidth, 2); | ||
} | ||
|
||
export function inBoxRange(point, {x, y, width, height}, axis, borderWidth) { | ||
export function inBoxRange(point, {x, y, x2, y2}, axis, borderWidth) { | ||
const hBorderWidth = borderWidth / 2; | ||
const inRangeX = point.x >= x - hBorderWidth - EPSILON && point.x <= x + width + hBorderWidth + EPSILON; | ||
const inRangeY = point.y >= y - hBorderWidth - EPSILON && point.y <= y + height + hBorderWidth + EPSILON; | ||
const inRangeX = point.x >= x - hBorderWidth - EPSILON && point.x <= x2 + hBorderWidth + EPSILON; | ||
const inRangeY = point.y >= y - hBorderWidth - EPSILON && point.y <= y2 + hBorderWidth + EPSILON; | ||
if (axis === 'x') { | ||
return inRangeX; | ||
} else if (axis === 'y') { | ||
|
@@ -30,8 +30,8 @@ export function inBoxRange(point, {x, y, width, height}, axis, borderWidth) { | |
} | ||
|
||
export function getElementCenterPoint(element, useFinalPosition) { | ||
const {x, y} = element.getProps(['x', 'y'], useFinalPosition); | ||
return {x, y}; | ||
const {centerX, centerY} = element.getProps(['centerX', 'centerY'], useFinalPosition); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be better for backward compatibility, if we used On the other hand centerX and centerY are explicit. Could also go further explicit and use top, left, bottom, right for the corner coordinates. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
make sense!
Could make sense but in this way we don't have any backward compatibility, for any annotation type. Do you want I do in this PR or with another one? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kurkle be also aware that top, left, bottom and right can not map very well the line annotation because bottom could be greater than top. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@kurkle sorry but I think I misunderstood your comment. In my poor option it couldn't be a good idea to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what you mean with "not readable"? The element properties can be read directly from the element. But if you mean its not obvious what x and y are, I agree. I think its ok to go with centerX/Y, just wanted to bounce these thoughts. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I meant "user friendly" or obvious (as you wrote). I didn't the user can not access to them ;) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@kurkle I thought about line annotation. We could go to top, left, bottom and right model but we need to add some additional logic to know which corners of the box must be join to draw the line to the right direction. |
||
return {x: centerX, y: centerY}; | ||
} | ||
|
||
const isOlderPart = (act, req) => req > act || (act.length > req.length && act.slice(0, req.length) === req); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the return value deserves its own type, maybe called
AnnotationBoxModel
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, makes sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have already
AnnotationElement
even if it includesoptions
in its definition. in my opinion, we need to map the new model in more TS types.