diff --git a/lib/raf-debounce.js b/lib/raf-debounce.js deleted file mode 100644 index 4408ae0..0000000 --- a/lib/raf-debounce.js +++ /dev/null @@ -1,25 +0,0 @@ -module.exports = function rafDebounce (fn) { - let args, context, requestID; - - function later () { - fn.apply(context, args); - args = context = requestID = null; - } - - function debounced () { - if (fn == null) { - throw new Error('raf debounced function is already disposed.'); - } - args = arguments; - context = this; - window.cancelAnimationFrame(requestID); - requestID = window.requestAnimationFrame(later); - } - - debounced.dispose = () => { - window.cancelAnimationFrame(requestID); - fn = args = context = requestID = null; - }; - - return debounced; -}; diff --git a/lib/tool-bar-view.js b/lib/tool-bar-view.js index 622ee14..aafc5e1 100644 --- a/lib/tool-bar-view.js +++ b/lib/tool-bar-view.js @@ -1,5 +1,4 @@ const {CompositeDisposable, Emitter} = require('atom'); -const rafDebounce = require('./raf-debounce'); module.exports = class ToolBarView { constructor () { @@ -46,12 +45,6 @@ module.exports = class ToolBarView { if (atom.config.get('tool-bar.visible')) { this.show(); } - - this.drawGutter = rafDebounce(this.drawGutter.bind(this)); - this.subscriptions.add(this.drawGutter); - - this.element.addEventListener('scroll', this.drawGutter); - window.addEventListener('resize', this.drawGutter); } addItem (newItem) { @@ -76,7 +69,6 @@ module.exports = class ToolBarView { nextItem ? nextItem.element : null ); - this.drawGutter(); return nextItem; } @@ -84,7 +76,6 @@ module.exports = class ToolBarView { removeItem (item) { item.destroy(); this.items.splice(this.items.indexOf(item), 1); - this.drawGutter(); } destroy () { @@ -95,11 +86,8 @@ module.exports = class ToolBarView { this.subscriptions = null; this.hide(); - this.element.removeEventListener('scroll', this.drawGutter); this.element = null; - window.removeEventListener('resize', this.drawGutter); - this.emitter.emit('did-destroy'); this.emitter.dispose(); this.emitter = null; @@ -170,23 +158,6 @@ module.exports = class ToolBarView { } } - drawGutter () { - this.element.classList.remove('gutter-top', 'gutter-bottom'); - - const visibleHeight = this.element.offsetHeight; - const scrollHeight = this.element.scrollHeight; - const hiddenHeight = scrollHeight - visibleHeight; - - if (visibleHeight < scrollHeight) { - if (this.element.scrollTop > 0) { - this.element.classList.add('gutter-top'); - } - if (this.element.scrollTop < hiddenHeight) { - this.element.classList.add('gutter-bottom'); - } - } - } - hide () { if (this.panel != null) { if (this.element.parentNode) { diff --git a/styles/tool-bar.less b/styles/tool-bar.less index 4599f0e..c3c86f6 100644 --- a/styles/tool-bar.less +++ b/styles/tool-bar.less @@ -123,24 +123,6 @@ &::-webkit-scrollbar { display: none; } - - &.gutter-top::before, - &.gutter-bottom::after { - content: ""; - height: 100%; - left: 0; - pointer-events: none; - position: absolute; - top: 0; - width: 100%; - z-index: 1; - } - &.gutter-top::before { - box-shadow: inset 0px 20px 25px -20px rgb(0, 0, 0); - } - &.gutter-bottom::after { - box-shadow: inset 0px -20px 25px -20px rgb(0, 0, 0); - } } .tool-bar-btn {