-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix: solve side effects related to duplicate events #1226
Conversation
โฆoords of time event
โฆtDuplicateEvents option
@@ -107,6 +107,10 @@ | |||
/> | |||
</button> | |||
<span class="navbar--range"></span> | |||
<div class="nav-checkbox"> | |||
<input class="checkbox-collapse" type="checkbox" id="collapse" value="collapse" /> | |||
<label for="collapse">Collapse duplicate events and disable the detail popup</label> |
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.
์ค๋ณต ์ผ์ ์ด ๊ฒน์ณ์ง๊ณ ํผ์ณ์ง๋ ๋์์ด ์ ๋ณด์ด๋๋ก collapseDuplicateEvents
๋ฅผ ํ์ฑํํ๋ฉด useDetailPopup
๋ฅผ ๋๋๋ก ๋ง๋ค์์ต๋๋ค.
@@ -266,11 +314,11 @@ export function setRenderInfoOfUIModels( | |||
|
|||
matrices.forEach((matrix) => { | |||
const maxRowLength = Math.max(...matrix.map((row) => row.length)); | |||
const baseWidth = 100 / maxRowLength; | |||
const baseWidth = Math.round(100 / maxRowLength); |
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.
์ค๋ณต ์ผ์ ์ ๊ฒฝ์ฐ preact์ ์คํ์ผ์ ์ง์ ํ ๋ left์ width๋ฅผ ๋ฌธ์์ด๊ฐ์ผ๋ก ๋๊ธฐ๊ฒ ๋ฉ๋๋ค. ์ด ๋ ๋๋์ด ๋จ์ด์ง์ง ์๋ baseWidth๋ฅผ ๊ฐ์ง๋ ๊ฒฝ์ฐ css ์คํ์ผ์ด ์ ๋๋ก ์ ์ฉ๋์ง ๋ชปํ๋ ๊ฒฝ์ฐ๊ฐ ์๊ฒจ์ ๋ฐ์ฌ๋ฆผํ๋๋ก ํ์์ต๋๋ค.
#### ๊ธฐ์กด์ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ง ์์๋ ์ด์
๊ธฐ์กด์๋ left์ width๋ฅผ number
ํ์์ผ๋ก preact์ ๋๊ธฐ๊ณ , preact ๋ด๋ถ์์ ์์ซ์ ์ ์ฒ๋ฆฌํด์ฃผ์์ต๋๋ค. ํ์ง๋ง ํ์ฌ ์ค๋ณต๋ ์ผ์ ์ ๊ฒฝ์ฐ left์ width๋ฅผ string
ํ์์ผ๋ก ๋๊ธฐ๋๋ก ๋ณ๊ฒฝ๋๋ฉด์ preact์์ ์๋์ผ๋ก ์ฒ๋ฆฌ๋์ง ์์ต๋๋ค.
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.
๊ทธ๋ฅ ๊ถ๊ธํด์์. preact ๋ด๋ถ์์ ์์ซ์ ์ฒ๋ฆฌํด์คฌ๋ค๋ ๋ถ๋ถ์ด ์ฌ๊ธด๊ฐ์?
์์ซ์ ์ด ๋๋ฌด ๋ง์์ง๋ ๋ถ๋ถ์ ์์ ์๋ ๋ญ๊ฐ ๋ฐ์ฌ๋ฆผ ์ฒ๋ฆฌ๋ฅผ ํ๊ฑฐ๋ toFixed
๋ฅผ ์จ์ผ ํ์ง ์์๊น ์๊ฐํ๋ค๊ฐ ๊ด์ฐฎ์ผ๋๊น ๋
๋๋๋ฐ, ์ด๋ฐ๋ถ๋ถ์์ ์์ธ์ ๋ฌธ์ ๊ฐ ํฐ์ง๋๊ตฐ์ ๐ค
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.
์ ์ด ๋ถ๋ถ์ ์ ๊ฐ ์๋ชป ํ์ ํ๋ค์. ๊ธฐ์กด์๋ number๊ฐ ์๋ string์ผ๋ก ๋๊ธฐ๊ณ ์์์ต๋๋ค. (์ฐธ๊ณ - TimeEvent.tsx L75-L79)
์ ์๊ฐ์๋ ์ด๋ฒ์ ์ถ๊ฐ๋ ํผ์ผํธ ๊ฐ์ ๋ํ๊ณ ๋นผ๋ ๊ณผ์ ๋๋ฌธ์ ๋ถ๋์์์ ์ค๋ฅ๊ฐ ๋ ๊ฒ ๊ฐ์ต๋๋ค.
๊ธฐ์กด์๋ ๋ถ๋์์์ ์ ์ฐ์ฐ์ด ์๋๋ผ 100 / baseWidth
์ ๊ฐ์ด ๊ฒฐ๊ณผ๊ฐ ๋ถ๋์์์ ์ผ๋ก ๋ํ๋๋ ๊ฑฐ๋ผ ๋ฌธ์ ๊ฐ ์์๋๋ฐ, ์ด๋ฒ์ ์ถ๊ฐ๋ ๋ก์ง์ ๋ถ๋์์์ ๋ผ๋ฆฌ์ ์ฐ์ฐ์ด๋ผ ๋ฌธ์ ๊ฐ ๋ฐ์ํ ๊ฒ ๊ฐ์์.
/** | ||
* represent the left value of a duplicate event. | ||
* ex) calc(50% - 24px), calc(50%), ... | ||
* | ||
* @type {string} | ||
*/ | ||
duplicateLeft = ''; | ||
|
||
/** | ||
* represent the width value of a duplicate event. | ||
* ex) calc(50% - 24px), 9px, ... | ||
* | ||
* @type {string} | ||
*/ | ||
duplicateWidth = ''; |
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.
๊ธฐ์กด์ left
์ width
๋ฅผ ์์ ํ์ง ์๊ณ ์๋ก์ด ํ๋กํผํฐ๋ฅผ ๋ง๋ ์ด์ ๋ ํ์
๋ฌธ์ ๋๋ฌธ์
๋๋ค. left
์ width
๊ฐ ๋ฌธ์์ด๋ ๊ฐ๋ฅํ๋๋ก number | string
ํ์
์ผ๋ก ๋ฐ๊พธ๋ฉด ๋ค๋ฅธ ๋ง์ ๊ณณ์์ ํ์
์๋ฌ๊ฐ ๋ฐ์ํ๊ณ , ์ด๋ฅผ ๋ชจ๋ ์์ ํด์ผ ํฉ๋๋ค. ์๊ฐ๋ณด๋ค ์ํฅ์ ๋ผ์น๋ ๋ถ๋ถ์ด ๋ง์์ ์๋ก์ด ํ๋กํผํฐ๋ฅผ ๋ง๋ค์์ต๋๋ค.
infos.push({ | ||
start: event.duplicateStarts as TZDate, | ||
end: event.duplicateEnds as TZDate, | ||
goingDuration: 0, | ||
comingDuration: 0, | ||
}); |
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.
duplicateStarts
์๋ ์ค๋ณต ์ผ์ ๊ทธ๋ฃน ์ค ๊ฐ์ฅ ์ด๋ฅธ start + goingDuration์, duplicateEnds
์๋ ๊ฐ์ฅ ๋ฆ์ end + comingDuration์ ์ ์ฅํฉ๋๋ค. duplicateStarts
๊ณผ duplicateEnds
๋ ์ด๋ฏธ duration์ ๊ณ ๋ คํ ๊ฐ์ด๊ธฐ ๋๋ฌธ์ ์ถฉ๋์ ๊ณ์ฐํ ๋๋ goingDuration๊ณผ comingDuration์ 0์ผ๋ก ์ค์ ํฉ๋๋ค.
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.
๋ฆฌ๋ทฐ ์๋ฃํฉ๋๋ค. ์ด๋ ค์ด ๊ธฐ๋ฅ ๊ตฌํํ๋๋ผ ๋ฌด์ฒ ๊ณ ์ํ์ จ์ด์.
์์ํ๊ฒ ์ฝ๋ ๋ค๋ฌ์ด์ฃผ์ จ์ผ๋ฉด ํ๋ ๋ถ๋ถ, ์ค๋ช ์ด ์กฐ๊ธ ๋ ํ์ํ๋ค๊ณ ์๊ฐํ๋ ๋ถ๋ถ ๋ฑ ์ฝ๋ฉํธ ๋จ๊ฒผ์ต๋๋ค.
@@ -266,11 +314,11 @@ export function setRenderInfoOfUIModels( | |||
|
|||
matrices.forEach((matrix) => { | |||
const maxRowLength = Math.max(...matrix.map((row) => row.length)); | |||
const baseWidth = 100 / maxRowLength; | |||
const baseWidth = Math.round(100 / maxRowLength); |
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.
๊ทธ๋ฅ ๊ถ๊ธํด์์. preact ๋ด๋ถ์์ ์์ซ์ ์ฒ๋ฆฌํด์คฌ๋ค๋ ๋ถ๋ถ์ด ์ฌ๊ธด๊ฐ์?
์์ซ์ ์ด ๋๋ฌด ๋ง์์ง๋ ๋ถ๋ถ์ ์์ ์๋ ๋ญ๊ฐ ๋ฐ์ฌ๋ฆผ ์ฒ๋ฆฌ๋ฅผ ํ๊ฑฐ๋ toFixed
๋ฅผ ์จ์ผ ํ์ง ์์๊น ์๊ฐํ๋ค๊ฐ ๊ด์ฐฎ์ผ๋๊น ๋
๋๋๋ฐ, ์ด๋ฐ๋ถ๋ถ์์ ์์ธ์ ๋ฌธ์ ๊ฐ ํฐ์ง๋๊ตฐ์ ๐ค
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.
๋ฆฌ๋ทฐ ์๋ฃํฉ๋๋ค.
if (!isDuplicateEvent && uiModel.duplicateEvents.length > 0) { | ||
uiModel.duplicateEvents.forEach((event) => { | ||
setRenderInfo({ | ||
uiModel: event, | ||
columnIndex, | ||
baseWidth, | ||
startColumnTime, | ||
endColumnTime, | ||
isDuplicateEvent: true, | ||
}); | ||
}); | ||
|
||
return; | ||
} |
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.
์ผ๋ฆฌ๋ฆฌํด๋ณด๋ค
if (!isDuplicateEvent && uiModel.duplicateEvents.length > 0) { | |
uiModel.duplicateEvents.forEach((event) => { | |
setRenderInfo({ | |
uiModel: event, | |
columnIndex, | |
baseWidth, | |
startColumnTime, | |
endColumnTime, | |
isDuplicateEvent: true, | |
}); | |
}); | |
return; | |
} | |
if (isDuplicateEvent || uiModel.duplicateEvents.length === 0) { | |
// ์๋ ๋ก์ง | |
} else { | |
uiModel.duplicateEvents.forEach((event) => { | |
setRenderInfo({ | |
uiModel: event, | |
columnIndex, | |
baseWidth, | |
startColumnTime, | |
endColumnTime, | |
isDuplicateEvent: true, | |
}); | |
}); | |
} |
๊ฐ์ ๋ฐฉ์์ ์ด๋ ์ ๊ฐ์?
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.
์ ๋ ๊ฐ์ธ์ ์ผ๋ก ์ผ๋ฆฌ ๋ฆฌํด์ ๋ ์ ํธํฉ๋๋ค..ใ
ใ
ใ
๊ตณ์ด else ๋ฌธ์ ๋ง๋ค์ด์ ์ธ๋ดํ
์ด์
ํ ๋จ๊ณ๋ฅผ ์ถ๊ฐํ๊ณ ์ถ์ง ์๊ธฐ๋ ํ๊ณ , ์๋ ๋ก์ง์์๋ returnํ๋ ๋ก์ง์ด ์์ด์ ์ด๋ ๋ก์ง์ ํ๋๋ผ๋ ๋ฆฌํด ํ์
์ด ๋์ผํ๊ฒ undefined
์ด ๋๊ฑฐ๋ ์.
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.
ํน์ else ์ฐ๋ ๊ฑธ ์ ํธํ๋ ์ด์ ๊ฐ ์๋์??
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.
์ง๊ธ ํจ์๋ ๊ด์ฐฎ์๋ฐ ํจ์๊ฐ ๊ธธ์ด์ง๊ณ ๋ก์ง์ด ๋ณต์กํ ๋ ์ค๊ฐ์ ์ผ๋ฆฌ๋ฆฌํด์ผ๋ก ๋น ์ ธ๋๊ฐ๋ฉด ๋ก์ง ํ์ ์ด ์ฝ์ง ์๋๋ผ๊ตฌ์.
๊ฐ์ธ์ ์ธ ์๊ฒฌ์ด๋ผ ๋ฐ์ ์ํ์ ๋ ๊ด์ฐฎ์ต๋๋ค!
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.
์ ๋ ๊ธฐ๋ณธ์ ์ผ๋ก ์ผ๋ฆฌ๋ฆฌํด ์ข์ํ๋๋ฐ ์๋ฌด๊ฒ๋ ๋ฆฌํด ์ํ๊ณ return
๋ง ์๋ ์ผ๋ฆฌ๋ฆฌํด๋ณด๋จ ๊ฐ์ด ๋ช
์์ ์ธ ์ผ๋ฆฌ๋ฆฌํด์ด์ด์ผ ๊ทธ๋ด๋งํ ๊ฐ์น๊ฐ ์๋ค๊ณ ์๊ฐํ๋ ํธ์ด์์.
์ด ํจ์๋ ์ฝ๊ฐ ๋ค๋ฅธ๋ฐ, ์ฌ๊ทํจ์์ด๋ฏ๋ก ์กฐ๊ฑด ์ข ๋ฃ ๋ถ๋ถ์ด ๋จผ์ ํจ์ ์๋จ์ ๋๋ฌ๋์๋๊ฒ ์ข๋ค๊ณ ์๊ฐํด์ ์ง๊ธ ์ํ๋ก๋ ์ถฉ๋ถํ๋ค ๋ด ๋๋ค.
์ ์ฝ๋ฉํธ์๋ ์ผ์ง๋ง ์ด๋ฐ ํํ์ ์ฌ๊ท๊ฐ ์๋ ๋ค๋ฅธ ๋ฐฉ์์ผ๋ก ํ์ด๋๊ฐ ์ ์์ผ๋ฉด ์ข๊ฒ ์ง๋ง ๋ง๋ ํ ๊ฐ์ ์์ด๋์ด๊ฐ ๋ ์ค๋ฅด์ง ์์ ๋์ด๊ฐ์์ฃ .
Please check if the PR fulfills these requirements
fix #xxx[,#xxx]
, where "xxx" is the issue number)Description
5%
of the column.9px
.collapseDuplicateEvent
option.collapseDuplicateEvent
option.Thank you for your contribution to TOAST UI product. ๐ ๐ โจ