From dae61d79f1d74080dc5cb01ed241e7b74232d513 Mon Sep 17 00:00:00 2001 From: nightwing Date: Tue, 16 Aug 2011 21:53:53 +0500 Subject: [PATCH 1/2] yet another worker loader tweak :) --- lib/ace/worker/worker_client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ace/worker/worker_client.js b/lib/ace/worker/worker_client.js index 525e8add..f024b274 100644 --- a/lib/ace/worker/worker_client.js +++ b/lib/ace/worker/worker_client.js @@ -104,7 +104,7 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) { this.$normalizePath = function(path) { if (!path.match(/^\w+:/)) - path = location.protocol + "//" + location.host + location.pathname.replace(/\/.*?$/, "") + "/" + path.replace(/^\//, ""); + path = location.protocol + "//" + location.host + location.pathname.replace(/\/[^\/]*$/, "") + "/" + path.replace(/^\//, ""); return path; }; From eaa38022e51e915ab2df906763a6eec158b68d2a Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 17 Aug 2011 00:21:32 +0500 Subject: [PATCH 2/2] allow editors parent nodes to handle mouse wheel when editor is fully scrolled --- lib/ace/mouse_handler.js | 5 +++-- lib/ace/virtual_renderer.js | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/ace/mouse_handler.js b/lib/ace/mouse_handler.js index 2f7b30a7..7b01be74 100644 --- a/lib/ace/mouse_handler.js +++ b/lib/ace/mouse_handler.js @@ -67,7 +67,7 @@ var MouseHandler = function(editor) { event.addMultiMouseDownListener(mouseTarget, 0, 2, 500, this.onMouseDoubleClick.bind(this)); event.addMultiMouseDownListener(mouseTarget, 0, 3, 600, this.onMouseTripleClick.bind(this)); event.addMultiMouseDownListener(mouseTarget, 0, 4, 600, this.onMouseQuadClick.bind(this)); - event.addMouseWheelListener(mouseTarget, this.onMouseWheel.bind(this)); + event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this)); }; (function() { @@ -304,7 +304,8 @@ var MouseHandler = function(editor) { var speed = this.$scrollSpeed * 2; this.editor.renderer.scrollBy(e.wheelX * speed, e.wheelY * speed); - return event.preventDefault(e); + if (this.editor.renderer.isScrollableBy(e.wheelX, e.wheelY)) + return event.preventDefault(e); }; diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js index ac5b3903..126f7744 100644 --- a/lib/ace/virtual_renderer.js +++ b/lib/ace/virtual_renderer.js @@ -712,6 +712,14 @@ var VirtualRenderer = function(container, theme) { deltaX && this.scrollToX(this.scroller.scrollLeft + deltaX); }; + this.isScrollableBy = function(deltaX, deltaY) { + if (deltaY < 0 && this.scrollTop > 0) + return true; + if (deltaY > 0 && this.scrollTop + this.$size.scrollerHeight < this.layerConfig.maxHeight) + return true; + // todo: handle horizontal scrolling + }; + this.screenToTextCoordinates = function(pageX, pageY) { var canvasPos = this.scroller.getBoundingClientRect();