-
Notifications
You must be signed in to change notification settings - Fork 199
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: 解决移动端下,树形结构展开、收起交互失效的问题。 #3005
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,28 +155,48 @@ export class RowCell extends HeaderCell<RowHeaderConfig> { | |
|
||
const iconX = x + contentIndent; | ||
const iconY = this.getIconPosition().y; | ||
let offsetXY = 0; | ||
let offsetWH = 0; | ||
|
||
// 移动端的时候,将icon变化,从而增加触发交互的面积 | ||
if (isMobile()) { | ||
offsetXY = size / 4; | ||
offsetWH = size / 2!; | ||
} | ||
|
||
this.treeIcon = renderTreeIcon({ | ||
group: this, | ||
iconCfg: { | ||
x: iconX, | ||
y: iconY, | ||
width: size!, | ||
height: size!, | ||
x: iconX - offsetXY, | ||
y: iconY - offsetXY, | ||
width: size + offsetWH, | ||
height: size + offsetWH, | ||
fill, | ||
}, | ||
isCollapsed, | ||
onClick: () => { | ||
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. 这里不需要像 corner-cell 一样处理吗? |
||
this.onTreeIconClick(); | ||
}, | ||
onTouchEnd: () => { | ||
/** | ||
* 移动端时,绑定展开、收起事件 | ||
*/ | ||
this.emitCollapseEvent(); | ||
}, | ||
}); | ||
|
||
/** | ||
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. 直接删掉吧, 不需要注释 L#188-L#199 |
||
* 这里不能将整个单元格作为热区 | ||
* 否则会导致emitCollapseEvent回调执行两次, | ||
* 还会影响到绑定到整个单元格的其他事件,比如ToolTop.show | ||
* 树形结构的展开、收起操作,在移动端下失效 | ||
*/ | ||
// 移动端, 点击热区为整个单元格 | ||
if (isMobile()) { | ||
this.addEventListener('click', () => { | ||
this.emitCollapseEvent(); | ||
}); | ||
} | ||
// if (isMobile()) { | ||
// this.addEventListener('click', () => { | ||
// this.emitCollapseEvent(); | ||
// }); | ||
// } | ||
} | ||
|
||
protected drawTreeLeafNodeAlignDot() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
这个热区的处理建议在基类 HeaderCell 上抽一个公用方法, 和上面 corner-cell 公用