Skip to content

Commit

Permalink
fix(comment-map): adjust indicator height
Browse files Browse the repository at this point in the history
  • Loading branch information
h13i32maru committed Jun 26, 2020
1 parent b345d6e commit fc9abfb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,23 @@
}
}, {threshold: [0], rootMargin: '-40px'});

// create indicator
const indicatorWrapEl = document.createElement('div');
indicatorWrapEl.classList.add('highlight-indicator-wrap');
document.body.appendChild(indicatorWrapEl);

const indicatorEl = document.createElement('div');
indicatorEl.classList.add('highlight-indicator');
document.body.appendChild(indicatorEl);
indicatorWrapEl.appendChild(indicatorEl);

const rect = document.querySelector('.js-discussion').getBoundingClientRect();
const timelineHeight = rect.height;
const timelineOffset = rect.top + window.pageYOffset; //.js-discussionのheightを使うために、commentの絶対位置をオフセットする必要がある

// タイムラインの高さが小さいときは、インジケータも小さくする
const indicatorHeight = Math.min(timelineHeight / window.innerHeight, 1);
indicatorEl.style.height = `${indicatorHeight * 100}%`;

for (const comment of highlightCommentEls) {
// calc mark position
const commentRect = comment.getBoundingClientRect();
Expand Down
16 changes: 12 additions & 4 deletions src/Electron/Component/WebViewComponentInjection/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,21 @@
}

/*highlight indicator*/
.highlight-indicator {
.highlight-indicator-wrap {
position: fixed;
top: 150px;
left: 4px;
z-index: 9999;
width: 10px;
height: calc(100vh - 240px);
height: calc(100vh - 300px);
z-index: 9999;
display: flex;
align-items: center;
}

.highlight-indicator {
position: relative;
height: 100%;
width: 100%;
background: #EAECEF;
border-radius: 5px;
}
Expand All @@ -133,7 +141,7 @@
position: absolute;
width: 100%;
min-height: 10px;
max-height: 80px;
/*max-height: 80px;*/
background: #2CBE4F;
cursor: pointer;
/*border: solid 1px #1f9c35;*/
Expand Down

0 comments on commit fc9abfb

Please sign in to comment.