From 3eef5f0a637be4bbc6d9a042c3566c79d887bfdb Mon Sep 17 00:00:00 2001 From: nightwing Date: Mon, 26 Aug 2013 21:55:14 +0400 Subject: [PATCH] allow clicking through invisible mac scrollbars --- lib/ace/css/editor.css | 14 +++++--------- lib/ace/mouse/mouse_handler.js | 2 ++ lib/ace/scrollbar.js | 4 ++++ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/ace/css/editor.css b/lib/ace/css/editor.css index 0063ba2d..3413f99c 100644 --- a/lib/ace/css/editor.css +++ b/lib/ace/css/editor.css @@ -71,17 +71,19 @@ .ace_scrollbar { position: absolute; - overflow: hidden; + overflow-x: hidden; overflow-y: auto; right: 0; top: 0; bottom: 0; + z-index: 6; } .ace_scrollbar-inner { position: absolute; - width: 1px; + cursor: text; left: 0; + top: 0; } .ace_scrollbar-h { @@ -91,15 +93,9 @@ right: 0; left: 0; bottom: 0; + z-index: 6; } -.ace_scrollbar-inner { - position: absolute; - height: 1px; - left: 0; -} - - .ace_print-margin { position: absolute; height: 100%; diff --git a/lib/ace/mouse/mouse_handler.js b/lib/ace/mouse/mouse_handler.js index 76fedc3c..a0afd3b4 100644 --- a/lib/ace/mouse/mouse_handler.js +++ b/lib/ace/mouse/mouse_handler.js @@ -50,6 +50,8 @@ var MouseHandler = function(editor) { event.addListener(mouseTarget, "click", this.onMouseEvent.bind(this, "click")); event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this, "mousemove")); event.addMultiMouseDownListener(mouseTarget, [300, 300, 250], this, "onMouseEvent"); + event.addMultiMouseDownListener(editor.renderer.scrollBarV.inner, [300, 300, 250], this, "onMouseEvent"); + event.addMultiMouseDownListener(editor.renderer.scrollBarH.inner, [300, 300, 250], this, "onMouseEvent"); event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this, "mousewheel")); var gutterEl = editor.renderer.$gutter; diff --git a/lib/ace/scrollbar.js b/lib/ace/scrollbar.js index 83e6c467..6d72979b 100644 --- a/lib/ace/scrollbar.js +++ b/lib/ace/scrollbar.js @@ -64,7 +64,10 @@ var ScrollBarV = function(parent, renderer) { // make element a little bit wider to retain scrollbar when page is zoomed renderer.$scrollbarWidth = this.width = dom.scrollbarWidth(parent.ownerDocument); + renderer.$scrollbarWidth = + this.width = dom.scrollbarWidth(parent.ownerDocument); this.fullWidth = this.width; + this.inner.style.width = this.element.style.width = (this.width || 15) + 5 + "px"; this.setVisible(false); this.element.style.overflowY = "scroll"; @@ -89,6 +92,7 @@ var ScrollBarH = function(parent, renderer) { // make element a little bit wider to retain scrollbar when page is zoomed this.height = renderer.$scrollbarWidth; this.fullHeight = this.height; + this.inner.style.height = this.element.style.height = (this.height || 15) + 5 + "px"; this.setVisible(false); this.element.style.overflowX = "scroll";