Skip to content

Commit

Permalink
0.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
fuermosi777 committed Nov 8, 2016
1 parent a2fcd47 commit 755edd5
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 32 deletions.
2 changes: 1 addition & 1 deletion demo/src/entry.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ let Root = React.createClass({
<div className="col-md-6">
<h4>Horizontal</h4>
<div className="horizontal">
<FreeScrollBar>
<FreeScrollBar start={'bottom right'}>
<img src="http://designmodo.github.io/Flat-UI/docs/assets/img/example-image.jpg" className="img-rounded"/>
</FreeScrollBar>
</div>
Expand Down
20 changes: 12 additions & 8 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,17 @@ module.exports = React.createClass({
componentDidMount: function componentDidMount() {
document.addEventListener('mousemove', this.handleHandlerMouseMove);
document.addEventListener('mouseup', this.handleHandlerMouseUp);

window.onload = this.handleWindowLoad;
},
componentWillUnmount: function componentWillUnmount() {
document.removeEventListener('mousemove', this.handleHandlerMouseMove);
document.removeEventListener('mouseup', this.handleHandlerMouseUp);
window.removeEventListener('load', this.handleWindowLoad);
},
componentDidUpdate: function componentDidUpdate() {
this.updateTrackVisibilities();
},
handleWindowLoad: function handleWindowLoad() {
this.collectInfo();
this.updateTrackVisibilities();
this.handlerContainerScroll();
Expand All @@ -134,13 +144,6 @@ module.exports = React.createClass({
this.el.scrollLeft = this.el.scrollWidth;
}
},
componentWillUnmount: function componentWillUnmount() {
document.removeEventListener('mousemove', this.handleHandlerMouseMove);
document.removeEventListener('mouseup', this.handleHandlerMouseUp);
},
componentDidUpdate: function componentDidUpdate() {
this.updateTrackVisibilities();
},
collectInfo: function collectInfo() {
this.el = findDOMNode(this.refs.container);
this.offsetWidth = this.el.offsetWidth;
Expand Down Expand Up @@ -213,6 +216,7 @@ module.exports = React.createClass({
var scrollHeight = el.scrollHeight,
scrollWidth = el.scrollWidth;
if (scrollHeight === this.lastScrollHeight && scrollWidth === this.lastScrollWidth) return;
console.log(scrollHeight, this.offsetHeight);
this.setState({
showVeriticalTrack: scrollHeight > this.offsetHeight,
showHorizontalTrack: scrollWidth > this.offsetWidth
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-free-scrollbar",
"version": "0.2.2",
"version": "0.2.3",
"description": "A react module for creating customizable scroll area",
"main": "dist/index.js",
"scripts": {
Expand Down
28 changes: 16 additions & 12 deletions site/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
/******/ }

/******/ var hotApplyOnUpdate = true;
/******/ var hotCurrentHash = "c828347c0b967fdb09bb"; // eslint-disable-line no-unused-vars
/******/ var hotCurrentHash = "19aa799e26772e227bea"; // eslint-disable-line no-unused-vars
/******/ var hotCurrentModuleData = {};
/******/ var hotCurrentParents = []; // eslint-disable-line no-unused-vars

Expand Down Expand Up @@ -723,7 +723,7 @@
{ className: 'quick-start' },
_react2.default.createElement(
_index2.default,
null,
{ start: "top" },
_react2.default.createElement(
'div',
{ className: 'inner' },
Expand Down Expand Up @@ -751,7 +751,7 @@
{ className: 'horizontal' },
_react2.default.createElement(
_index2.default,
null,
{ start: 'bottom right' },
_react2.default.createElement('img', { src: 'http://designmodo.github.io/Flat-UI/docs/assets/img/example-image.jpg', className: 'img-rounded' })
)
)
Expand Down Expand Up @@ -794,7 +794,7 @@
_react2.default.createElement(
'h4',
null,
'Auto hide'
'Auto hide, and the starting position is on the "bottom right".'
),
_react2.default.createElement(
'div',
Expand Down Expand Up @@ -22760,7 +22760,17 @@
componentDidMount: function componentDidMount() {
document.addEventListener('mousemove', this.handleHandlerMouseMove);
document.addEventListener('mouseup', this.handleHandlerMouseUp);

window.onload = this.handleWindowLoad;
},
componentWillUnmount: function componentWillUnmount() {
document.removeEventListener('mousemove', this.handleHandlerMouseMove);
document.removeEventListener('mouseup', this.handleHandlerMouseUp);
window.removeEventListener('load', this.handleWindowLoad);
},
componentDidUpdate: function componentDidUpdate() {
this.updateTrackVisibilities();
},
handleWindowLoad: function handleWindowLoad() {
this.collectInfo();
this.updateTrackVisibilities();
this.handlerContainerScroll();
Expand All @@ -22772,13 +22782,6 @@
this.el.scrollLeft = this.el.scrollWidth;
}
},
componentWillUnmount: function componentWillUnmount() {
document.removeEventListener('mousemove', this.handleHandlerMouseMove);
document.removeEventListener('mouseup', this.handleHandlerMouseUp);
},
componentDidUpdate: function componentDidUpdate() {
this.updateTrackVisibilities();
},
collectInfo: function collectInfo() {
this.el = findDOMNode(this.refs.container);
this.offsetWidth = this.el.offsetWidth;
Expand Down Expand Up @@ -22851,6 +22854,7 @@
var scrollHeight = el.scrollHeight,
scrollWidth = el.scrollWidth;
if (scrollHeight === this.lastScrollHeight && scrollWidth === this.lastScrollWidth) return;
console.log(scrollHeight, this.offsetHeight);
this.setState({
showVeriticalTrack: scrollHeight > this.offsetHeight,
showHorizontalTrack: scrollWidth > this.offsetWidth
Expand Down
25 changes: 15 additions & 10 deletions src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,22 @@ module.exports = React.createClass({
componentDidMount() {
document.addEventListener('mousemove', this.handleHandlerMouseMove);
document.addEventListener('mouseup', this.handleHandlerMouseUp);
window.onload = this.handleWindowLoad;
},

componentWillUnmount() {
document.removeEventListener('mousemove', this.handleHandlerMouseMove);
document.removeEventListener('mouseup', this.handleHandlerMouseUp);
window.removeEventListener('load', this.handleWindowLoad);
},

componentDidUpdate() {
this.updateTrackVisibilities();
},

handleWindowLoad() {
this.collectInfo();
this.updateTrackVisibilities();
this.updateTrackVisibilities();
this.handlerContainerScroll();

if (this.props.start.includes('bottom')) {
Expand All @@ -131,15 +144,6 @@ module.exports = React.createClass({
}
},

componentWillUnmount() {
document.removeEventListener('mousemove', this.handleHandlerMouseMove);
document.removeEventListener('mouseup', this.handleHandlerMouseUp);
},

componentDidUpdate() {
this.updateTrackVisibilities();
},

collectInfo() {
this.el = findDOMNode(this.refs.container);
this.offsetWidth = this.el.offsetWidth;
Expand Down Expand Up @@ -212,6 +216,7 @@ module.exports = React.createClass({
var el = this.el;
var scrollHeight = el.scrollHeight, scrollWidth = el.scrollWidth;
if (scrollHeight === this.lastScrollHeight && scrollWidth === this.lastScrollWidth) return;
console.log(scrollHeight, this.offsetHeight);
this.setState({
showVeriticalTrack: scrollHeight > this.offsetHeight,
showHorizontalTrack: scrollWidth > this.offsetWidth
Expand Down

0 comments on commit 755edd5

Please sign in to comment.