From e8084f5d458ef2f4f711c352041c6a2157886c23 Mon Sep 17 00:00:00 2001 From: DmitriyMX Date: Wed, 7 Jun 2017 14:26:49 +0300 Subject: [PATCH] =?UTF-8?q?MCSM:WebConsole:=20=D0=BD=D0=B5=D1=81=D0=BA?= =?UTF-8?q?=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B9=20=D1=84=D1=83=D0=BD=D0=BA?= =?UTF-8?q?=D1=86=D0=B8=D0=BE=D0=BD=D0=B0=D0=BB=D0=B0=20=D1=81=D0=BA=D1=80?= =?UTF-8?q?=D0=BE=D0=BB=D0=BB=D0=B8=D0=BD=D0=B3=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mcserver-manager/src/main/resources/components.js | 11 +++++++++++ mcserver-manager/src/main/resources/moduleStyle.css | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/mcserver-manager/src/main/resources/components.js b/mcserver-manager/src/main/resources/components.js index 70bb06f..5e9e803 100644 --- a/mcserver-manager/src/main/resources/components.js +++ b/mcserver-manager/src/main/resources/components.js @@ -81,10 +81,17 @@ var ScrollingContent = React.createClass({ this.ownHeight = this.refs.content.clientHeight; this.scrollRatio = this.ownHeight / this.totalHeight; if (isNaN(this.scrollRatio)) this.scrollRatio = 0; + this.refs.scroll.style.height = this.scrollRatio * 100 + "%"; + this.refs.scroll.style.top = (this.refs.content.scrollTop / this.totalHeight) * 100 + "%"; }, + toggleSelect: function (value, event) { return value; }, handleScrollMouseDown: function (event) { this.lastPageY = event.pageY; + document.body.classList.add('scroll-grabbed'); + this.refs.scroll.classList.add('scroll-grabbed'); + + document.onselectstart = this.toggleSelect.bind(null, false); document.addEventListener('mousemove', this.handleScrollMouseMove); document.addEventListener('mouseup', this.handleScrollMouseUp); }, @@ -99,6 +106,10 @@ var ScrollingContent = React.createClass({ }); }, handleScrollMouseUp: function (event) { + document.body.classList.remove('scroll-grabbed'); + this.refs.scroll.classList.remove('scroll-grabbed'); + + document.onselectstart = this.toggleSelect.bind(null, true); document.removeEventListener('mousemove', this.handleScrollMouseMove); document.removeEventListener('mouseup', this.handleScrollMouseUp); }, diff --git a/mcserver-manager/src/main/resources/moduleStyle.css b/mcserver-manager/src/main/resources/moduleStyle.css index b3f7b82..063e814 100644 --- a/mcserver-manager/src/main/resources/moduleStyle.css +++ b/mcserver-manager/src/main/resources/moduleStyle.css @@ -36,6 +36,12 @@ right: 0; } +.scroll-grabbed, +.scroll-grabbed * { + cursor: -webkit-grabbing !important; + cursor: -moz-grabbing !important; +} + #webconsole input { background-color: #1e1e1e; background-image: url('data:image/svg+xml;utf-8,>');