1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-19 20:51:42 +00:00

Tooltip misplaced (#3499)

* fix bug: tooltip misplaced

* Transition only opacity attributes
This commit is contained in:
Aaron Bird
2020-03-04 02:56:31 +08:00
committed by GitHub
parent 88e8d2e009
commit 9549355ab7
3 changed files with 25 additions and 1 deletions

View File

@@ -144,6 +144,15 @@ class StorageItem extends React.Component {
}
}
handleFolderMouseEnter(e, tooltipRef, isFolded) {
if (isFolded) {
const buttonEl = e.currentTarget
const tooltipEl = tooltipRef.current
tooltipEl.style.top = buttonEl.getBoundingClientRect().y + 'px'
}
}
handleFolderButtonContextMenu(e, folder) {
context.popup([
{
@@ -316,6 +325,7 @@ class StorageItem extends React.Component {
folder.key
)
const isActive = !!location.pathname.match(folderRegex)
const tooltipRef = React.createRef(null)
const noteSet = folderNoteMap.get(storage.key + '-' + folder.key)
let noteCount = 0
@@ -339,7 +349,11 @@ class StorageItem extends React.Component {
key={folder.key}
index={index}
isActive={isActive || folder.key === this.state.draggedOver}
tooltipRef={tooltipRef}
handleButtonClick={e => this.handleFolderButtonClick(folder.key)(e)}
handleMouseEnter={e =>
this.handleFolderMouseEnter(e, tooltipRef, isFolded)
}
handleContextMenu={e => this.handleFolderButtonContextMenu(e, folder)}
folderName={folder.name}
folderColor={folder.color}