lunit-io / insight-viewer

medical image viewer component for React
https://insight-viewer.lunit.io
MIT License
34 stars 6 forks source link

RFC-0004 / Annotation Drawer Event Handling improvement #397

Closed LTakhyunKim closed 1 year ago

LTakhyunKim commented 1 year ago

๐Ÿ“ Description

AnnotationDrawer ์—์„œ ์‚ฌ์šฉํ•˜๋Š” ์ด๋ฒคํŠธ ํ•ธ๋“ค๋ง ๋ฐฉ์‹์— ๋Œ€ํ•œ ๊ฐœ์„ ์•ˆ ๊ณต์œ ํ•ฉ๋‹ˆ๋‹ค.

AnnotationDrawer Event ๊ฐœ์„  RFC

์œ„ ๋งํฌ๋ฅผ ํ†ตํ•ด ๋ฌธ์„œ ํ™•์ธ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

github-actions[bot] commented 1 year ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
๐ŸŸข Statements 93.6% 278/297
๐ŸŸข Branches 88.28% 128/145
๐ŸŸข Functions 90.16% 55/61
๐ŸŸข Lines 94.6% 263/278

Test suite run success

109 tests passing in 31 suites.

Report generated by ๐Ÿงชjest coverage report action from b5462aa752d9600850d642ba427d6a3cc6bd1514

deminoth commented 1 year ago

๊ฐ€์žฅ ๊ทผ๋ณธ์ ์ธ ๋ฌธ์ œ์ธ Layer ๊ฐ€ ๊ฒน์ณ์„œ ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋Š” ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค. AnnotationViewer, AnnotationDrawer Layer ๋ฅผ ํ•˜๋‚˜๋กœ ํ†ต์ผํ•˜์—ฌ, ํ•ด๋‹น ๋ ˆ์ด์–ด์—์„œ ์ด๋ฒคํŠธ ๋“ฑ๋ก์„ ์ง„ํ–‰ํ•˜๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค.

์ด ๊ฒฝ์šฐ EnabledElement ์‚ฌ์šฉ์‹œ์™€๋Š” ๋‹ฌ๋ฆฌ Annotation Overlay๊ฐ€ ํ•ญ์ƒ overlay ์ค‘ z-index ์ตœ์ƒ๋‹จ์— ์žˆ์–ด์•ผ ํ•˜๋Š”๊ฒŒ ๋งž์„๊นŒ์š”?

LTakhyunKim commented 1 year ago

์ด ๊ฒฝ์šฐ EnabledElement ์‚ฌ์šฉ์‹œ์™€๋Š” ๋‹ฌ๋ฆฌ Annotation Overlay๊ฐ€ ํ•ญ์ƒ overlay ์ค‘ z-index ์ตœ์ƒ๋‹จ์— ์žˆ์–ด์•ผ ํ•˜๋Š”๊ฒŒ ๋งž์„๊นŒ์š”?

๋„ต ๋งž์Šต๋‹ˆ๋‹ค. ์ตœ์ƒ๋‹จ์— ์œ„์น˜ํ•ด์„œ ์œ ์ € ์ด๋ฒคํŠธ๋ฅผ ๋ฐ›๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค.

deminoth commented 1 year ago

๋„ต ๋งž์Šต๋‹ˆ๋‹ค. ์ตœ์ƒ๋‹จ์— ์œ„์น˜ํ•ด์„œ ์œ ์ € ์ด๋ฒคํŠธ๋ฅผ ๋ฐ›๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค.

์‚ฌ์‹ค ์—ฌ๋Ÿฌ ์˜ค๋ฒ„๋ ˆ์ด๊ฐ€ ๊ฒน์ณ์กŒ์„ ๋•Œ ํ•˜๋‚˜๋งŒ ์ด๋ฒคํŠธ๋ฅผ ๋ฐ›์„ ์ˆ˜ ์žˆ๋Š” ๋ฌธ์ œ ๋•Œ๋ฌธ์— EnabledElement๋ฅผ ์“ฐ๋Š” ๊ฒƒ์ธ๋ฐ, Annotation ์™ธ์˜ ๋‹ค๋ฅธ ์˜ค๋ฒ„๋ ˆ์ด๊ฐ€ ์ด๋ฒคํŠธ๋ฅผ ๋ฐ›์„ ์ˆ˜ ์žˆ์–ด์•ผ ํ•˜๋Š” ์‹œ๋‚˜๋ฆฌ์˜ค๊ฐ€ ๋”ฑํžˆ ๋– ์˜ค๋ฅด์ง€๋Š” ์•Š๋„ค์š”. ๋ฌธ์„œํ™”๋งŒ ์ž˜ ํ•œ๋‹ค๋ฉด ์ด๋Œ€๋กœ ๊ฐ€๋„ ๊ดœ์ฐฎ์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

deminoth commented 1 year ago
<svg onMouseDown={handleMouseDown} onMouseMove={handleMouseMove} onMouseUp={handleMouseUp}>
      {/** ๊ธฐ์กด AnnotationDrawer ์— Annotation Viewer ๋ฅผ ์ถ”๊ฐ€ */}
      <AnnotationViewer onClick={onClickAnnotation} />

Annotation์„ ํด๋ฆญํ–ˆ์„๋•Œ์—๋„ ๋ถ€๋ชจ์˜ onMouseDown ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒํ•  ๊ฒƒ ๊ฐ™์€๋ฐ, ๋”ฐ๋กœ ๋ฒ„๋ธ”๋ง์„ ๋ง‰๋Š” ๋“ฑ ์ฒ˜๋ฆฌ๊ฐ€ ํ•„์š”ํ• ์ง€๋„ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค.

LTakhyunKim commented 1 year ago

์‚ฌ์‹ค ์—ฌ๋Ÿฌ ์˜ค๋ฒ„๋ ˆ์ด๊ฐ€ ๊ฒน์ณ์กŒ์„ ๋•Œ ํ•˜๋‚˜๋งŒ ์ด๋ฒคํŠธ๋ฅผ ๋ฐ›์„ ์ˆ˜ ์žˆ๋Š” ๋ฌธ์ œ ๋•Œ๋ฌธ์— EnabledElement๋ฅผ ์“ฐ๋Š” ๊ฒƒ์ธ๋ฐ, Annotation ์™ธ์˜ ๋‹ค๋ฅธ ์˜ค๋ฒ„๋ ˆ์ด๊ฐ€ ์ด๋ฒคํŠธ๋ฅผ ๋ฐ›์„ ์ˆ˜ ์žˆ์–ด์•ผ ํ•˜๋Š” ์‹œ๋‚˜๋ฆฌ์˜ค๊ฐ€ ๋”ฑํžˆ ๋– ์˜ค๋ฅด์ง€๋Š” ์•Š๋„ค์š”. ๋ฌธ์„œํ™”๋งŒ ์ž˜ ํ•œ๋‹ค๋ฉด ์ด๋Œ€๋กœ ๊ฐ€๋„ ๊ดœ์ฐฎ์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

๋„ต ์ € ์—ญ์‹œ๋„ ํ•ด๋‹น ๋ฐฉ์•ˆ์„ ๊ณ ๋ คํ•  ๋•Œ ๋ง์”€ํ•˜์‹  AnnotationOverlay ์™ธ์— ๋ณ„๋„์˜ Overlay ์—์„œ ์ด๋ฒคํŠธ๋ฅผ ๋ฐ›์•„์•ผํ•˜๋Š” ์‹œ๋‚˜๋ฆฌ์˜ค๋ฅผ ์ƒ๊ฐํ–ˆ์ง€๋งŒ, ๋”ฑํžˆ ์—†์„ ๋“ฏํ•˜์—ฌ ์œ„์™€ ๊ฐ™์ด ์ง„ํ–‰ํ•˜๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค.

๋ฌธ์„œํ™” ๋ถ€๋ถ„์€ RFC ๋ฌธ์„œ๋ฅผ ๋น„๋กฏํ•˜์—ฌ dev-docs, ์™ธ๋ถ€ ๊ณต๊ฐœ docs ๋“ฑ์— ์œ„ ๋‚ด์šฉ์„ ์ž‘์„ฑํ•˜๋Š” ๋ฐฉํ–ฅ์œผ๋กœ ์ง„ํ–‰ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

LTakhyunKim commented 1 year ago

Annotation์„ ํด๋ฆญํ–ˆ์„๋•Œ์—๋„ ๋ถ€๋ชจ์˜ onMouseDown ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒํ•  ๊ฒƒ ๊ฐ™์€๋ฐ, ๋”ฐ๋กœ ๋ฒ„๋ธ”๋ง์„ ๋ง‰๋Š” ๋“ฑ ์ฒ˜๋ฆฌ๊ฐ€ ํ•„์š”ํ• ์ง€๋„ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค.

๋„ต, ์š”๊ฑด ์ฒ˜๋ฆฌ๊ฐ€ ํ•„์š”ํ•  ๊ฒƒ ๊ฐ™๋„ค์š” RFC ๋ฌธ์„œ์—๋„ ์œ„ ๋‚ด์šฉ ์ž‘์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค. 14caaac

LTakhyunKim commented 1 year ago

์ด๋ฒคํŠธ ๋“ฑ๋ก ๋Œ€์ƒ DOM ์€ AnnotationDrawer ๊ฐ€ ์•„๋‹Œ EnabledElement ์— ํ•˜๊ณ  ์žˆ์Œ์—๋„ ๋ถˆ๊ตฌํ•˜๊ณ  AnnotationDrawer ์—์„œ ํ•˜๊ณ  ์žˆ๋‹ค๋Š” ๊ฒƒ ์—ญ์‹œ, ๊ด€์‹ฌ์‚ฌ ๋ถ„๋ฆฌ๋ผ๋Š” ์ธก๋ฉด์—์„œ ์ข‹์€ ๊ตฌ์กฐ๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค.

์š” ๋ฌธ์žฅ์€ ํ•œ๋ฒˆ ์ˆ˜์ •ํ•ด๋ณด์„ธ์š”.

์•„๋ž˜์™€ ๊ฐ™์ด ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค. b5462aa

์‹ค์ œ ์ด๋ฒคํŠธ ๋“ฑ๋ก ๋Œ€์ƒ Dom ์€ `EnabledElement` ๋กœ ์ฝ”๋“œ ํŒŒ์•…์— ๋ถ€์ •์  ์˜ํ–ฅ์„ ์ฃผ๋ฉฐ
`EnabledElement` ์— ๋Œ€ํ•œ ๋กœ์ง์„ `AnnotationDrawer` ์—์„œ ๋‹ค๋ฃฌ๋‹ค๋Š” ์ ์—์„œ ๊ด€์‹ฌ์‚ฌ ๋ถ„๋ฆฌ ์ธก๋ฉด์—์„œ ์ข‹์€ ๊ตฌ์กฐ๊ฐ€ ์•„๋‹ˆ๋ผ๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค.