MCSM:WebConsole: несколько исправлений функционала скроллинга
This commit is contained in:
@@ -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);
|
||||
},
|
||||
|
||||
@@ -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,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="30"><text x="7" y="24" style="font-size: 1.5em; font-family: monospace" fill="#ffffff">></text></svg>');
|
||||
|
||||
Reference in New Issue
Block a user