Skip to content
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: Do not fire "changeShow" event when ColorPicker's color not changed (fix #131) #149

Merged
merged 1 commit into from
Feb 15, 2019

Conversation

junghwan-park
Copy link
Member

@junghwan-park junghwan-park commented Feb 15, 2019

Please check if the PR fulfills these requirements

  • It's submitted to right branch according to our branching model
  • It's right issue type on title
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)
  • It does not introduce a breaking change or has description for the breaking change

Description

Change show state when color changes & initial color-picker opening.


Thank you for your contribution to TOAST UI product. ๐ŸŽ‰ ๐Ÿ˜˜ โœจ

@junghwan-park junghwan-park added this to the v3.5.0 milestone Feb 15, 2019
@junghwan-park junghwan-park self-assigned this Feb 15, 2019
@junghwan-park junghwan-park changed the title fix: Do not fire "chaneShow" event when ColorPicker's color not changed (fix #131) fix: Do not fire "changeShow" event when ColorPicker's color not changed (fix #131) Feb 15, 2019
Copy link
Contributor

@dongsik-yoo dongsik-yoo left a comment

Choose a reason for hiding this comment

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

๋ฆฌ๋ทฐ ์™„๋ฃŒํ–ˆ์Šต๋‹ˆ๋‹ค. ์ˆ˜๊ณ ํ•˜์…จ์Šต๋‹ˆ๋‹ค.

* @private
*/
_isPaletteButton(target) {
return target.className === 'tui-colorpicker-palette-button';
Copy link
Contributor

Choose a reason for hiding this comment

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

์ด ์—˜๋ฆฌ๋จผํŠธ์˜ ํด๋ž˜์Šค๋Š” ํ•œ ๊ฐœ์ธ ๊ฒƒ์ด ๋ณด์žฅ์ด ๋˜๋Š”๊ฑฐ์˜ˆ์š”?

Copy link
Contributor

Choose a reason for hiding this comment

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

classList ์จ๋„ ๋˜์ง€ ์•Š์„๊นŒ์š”?

Copy link
Member Author

Choose a reason for hiding this comment

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

@dongsik-yoo ๋„ค. color-picker์˜ prefix๋ฅผ ui ๋‚ด๋ถ€์—์„œ ๋งŒ๋“ค๊ณ  ์žˆ๊ณ , ์˜ต์…˜์œผ๋กœ ๋ณ€๊ฒฝํ•  ์ˆ˜๋„ ์—†์Šต๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ํ˜„์žฌ ์ ์šฉ๋œ ํด๋ž˜์Šค๋ช…์„ ์ง์ ‘ ๋น„๊ตํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
@jinwoo-kim-nhn className์ด ๋” ๋„“์€ ๋ธŒ๋ผ์šฐ์ € ์ง€์›์„ํ•ด์„œ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‹จ์ผ ํด๋ž˜์Šค์ด๊ธฐ๋„ ํ•˜๊ณ ์š”~

* @returns {boolean}
* @private
*/
_isElementInColorPickerControl(element) {
Copy link
Contributor

Choose a reason for hiding this comment

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

์ด ๊ธฐ๋Šฅ์ด ๊ฐ„๋‹จํ•˜๊ธด ํ•˜์ง€๋งŒ ์—ฌ๋Ÿฌ ๊ตฐ๋ฐ์„œ ์“ธ ๊ฐ€๋Šฅ์„ฑ์ด ๋†ํ›„ํ•œ ํ•จ์ˆ˜๋กœ ๋ณด์—ฌ์š”. parents ์—์„œ ํŠน์ • ์—˜๋ฆฌ๋จผํŠธ๋ฅผ ์ฐพ๋Š” ๊ธฐ๋Šฅ์œผ๋กœ ์œ ํ‹ธ๋กœ ๋งŒ๋“ค๋ฉด ์–ด๋–จ๊นŒ ํ•ฉ๋‹ˆ๋‹ค.

Copy link
Member Author

Choose a reason for hiding this comment

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

๋„ค, ๊ทธ๋ž˜์„œ ๋ถ„๋ฆฌ๋ฅผ ๊ณ ๋ คํ•ด๋ดค์ง€๋งŒ ์•„์ง์€ ์—ฌ๊ธฐ ํ•œ๊ณณ์—์„œ๋งŒ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๊ณ , ๋ฏธ๋ฆฌ ๋ถ„๋ฆฌ ํ•ด๋‘์–ด๋„ ์œ„์น˜๋ฅผ ์–ด๋””์— ๋‘˜์ง€ ์• ๋งคํ•œ ๊ฒฝ์šฐ๊ฐ€ ์ƒ๊ธฐ๋”๋ผ๊ณ ์š”.
์ถ”ํ›„ ํ•„์š”ํ•œ ๊ณณ์ด ์ƒ๊ธด๋‹ค๋ฉด ๊ทธ๋•Œ ๋ถ„๋ฆฌํ•˜๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค :)


if (!isInPickerControl || (isInPickerControl && this._isPaletteButton(target))) {
this._show = !this._show;
this.pickerControl.style.display = this._show ? 'block' : 'none';
Copy link
Contributor

Choose a reason for hiding this comment

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

colorpickerElement์˜ ๋ถ€๋ชจ๊ฐ€ pickerControl์˜ˆ์š”?
ํด๋ฆญํ•œ ์—˜๋ฆฌ๋จผํŠธ๋งŒ ๋ณด์ง€ ์•Š๊ณ  ๋ถ€๋ชจ๊นŒ์ง€ ๋ณด๋„๋ก ์ฒ˜๋ฆฌํ•œ๊ฑฐ์ฃ ?

Copy link
Member Author

@junghwan-park junghwan-park Feb 15, 2019

Choose a reason for hiding this comment

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

@dongsik-yoo ์•„๋‡จ colorpickerElement๊ฐ€ pickerControl์„ ํฌํ•จํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
๊ทธ๋ž˜์„œ pickerControl์˜ ํด๋ฆญ๋˜ํ•œ ์—ฌ๊ธฐ์„œ ์ฒ˜๋ฆฌํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

  1. pickerControl์ด ํด๋ฆญ๋˜์ง€ ์•Š์€ ๊ฒฝ์šฐ๋Š” colorpickerElement๊ฐ€ ํด๋ฆญ๋˜์—ˆ์œผ๋‹ˆ ColorPicker๋ฅผ ๋…ธ์ถœ ์ƒํƒœ๋ฅผ ํ† ๊ธ€ํ•˜๊ณ ,
  2. pickerControl์—˜๋ฆฌ๋จผํŠธ๊ฐ€ ํด๋ฆญ๋˜์—ˆ์ง€๋งŒ Palette button์ด ํด๋ฆญ๋˜์ง€ ์•Š์•˜์„๋•Œ๋Š” ์•„์ง ์„ ํƒ์ค‘์ด๋ฏ€๋กœ ๋ ˆ์ด์–ด๋ฅผ ๋‹ซ์ง€ ์•Š๋„๋ก ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.

@jinwoo-kim-nhn
Copy link
Contributor

๋ฆฌ๋ทฐ ์™„๋ฃŒํ–ˆ์Šต๋‹ˆ๋‹ค. ์ˆ˜๊ณ ํ•˜์…จ์–ด์š”

@junghwan-park junghwan-park merged commit 580ab67 into master Feb 15, 2019
@junghwan-park junghwan-park deleted the fix/color-picker branch February 15, 2019 07:33
HerlinMatos pushed a commit to EveryMundo/tui.image-editor that referenced this pull request Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants