Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
martinnov92 committed Dec 7, 2017
1 parent c4d5007 commit 317fef5
Show file tree
Hide file tree
Showing 5 changed files with 245 additions and 247 deletions.
25 changes: 17 additions & 8 deletions lib/HandleBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,30 @@ var __extends = (this && this.__extends) || (function () {
})();
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var HandleBar = (function (_super) {
var ReactDOM = require("react-dom");
var HandleBar = /** @class */ (function (_super) {
__extends(HandleBar, _super);
function HandleBar() {
return _super !== null && _super.apply(this, arguments) || this;
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.getDivInstance = function () {
return ReactDOM.findDOMNode(_this.div);
};
return _this;
}
HandleBar.prototype.render = function () {
var _this = this;
var _a = this.props, position = _a.position, handleMouseDown = _a.handleMouseDown, allowResize = _a.allowResize;
var allowResizeClass = allowResize ? '' : 'resize-not-allowed';
return (React.createElement("div", { className: "handle-bar " + position + " " + allowResizeClass, onMouseDown: function (e) { return handleMouseDown(e); }, onTouchStart: function (e) { return handleMouseDown(e); } },
var classNames = [
'handle-bar',
position,
!allowResize && 'resize-not-allowed',
].filter(function (cls) { return cls; }).join(' ');
return (React.createElement("div", { className: classNames, ref: function (node) { return _this.div = node; }, onMouseDown: function (e) { return handleMouseDown(e); }, onTouchStart: function (e) { return handleMouseDown(e); } },
React.createElement("span", { className: "handle-bar_drag" })));
};
;
HandleBar.defaultProps = {
allowResize: true
};
return HandleBar;
}(React.Component));
HandleBar.defaultProps = {
allowResize: true
};
exports.default = HandleBar;
32 changes: 32 additions & 0 deletions lib/Helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,35 @@ function unselectAll() {
}
}
exports.unselectAll = unselectAll;
function getPrimaryPaneWidth(position, lastX, lastY, maxMousePosition, handleBarOffsetFromParent, primaryPaneMinHeight, primaryPaneMinWidth) {
var primaryPanePosition;
switch (position) {
case 'horizontal': {
if (lastY > maxMousePosition) {
primaryPanePosition = maxMousePosition - handleBarOffsetFromParent;
}
else if ((lastY - handleBarOffsetFromParent) <= primaryPaneMinHeight) {
primaryPanePosition = primaryPaneMinHeight + 0.001;
}
else {
primaryPanePosition = lastY - handleBarOffsetFromParent;
}
break;
}
case 'vertical':
default: {
if (lastX >= maxMousePosition) {
primaryPanePosition = maxMousePosition - handleBarOffsetFromParent;
}
else if ((lastX - handleBarOffsetFromParent) <= primaryPaneMinWidth) {
primaryPanePosition = primaryPaneMinWidth + 0.001;
}
else {
primaryPanePosition = lastX - handleBarOffsetFromParent;
}
break;
}
}
return primaryPanePosition;
}
exports.getPrimaryPaneWidth = getPrimaryPaneWidth;
19 changes: 15 additions & 4 deletions lib/Pane.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,26 @@ var __extends = (this && this.__extends) || (function () {
})();
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var Pane = (function (_super) {
var ReactDOM = require("react-dom");
var Pane = /** @class */ (function (_super) {
__extends(Pane, _super);
function Pane() {
return _super !== null && _super.apply(this, arguments) || this;
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.getDivInstance = function () {
return ReactDOM.findDOMNode(_this.div);
};
return _this;
}
Pane.prototype.render = function () {
var _this = this;
var _a = this.props, hasDetailPane = _a.hasDetailPane, id = _a.id, style = _a.style, position = _a.position, className = _a.className;
var isDetailPane = hasDetailPane ? 'bottom-detail-pane' : '';
return (React.createElement("div", { id: id, className: "pane " + position + " " + isDetailPane + " " + (className || ''), style: style }, this.props.children));
var classNames = [
'pane',
hasDetailPane && 'bottom-detail-pane',
position,
className
].filter(function (cls) { return cls; }).join(' ');
return (React.createElement("div", { id: id, ref: function (node) { return _this.div = node; }, className: classNames, style: style }, this.props.children));
};
return Pane;
}(React.Component));
Expand Down
Loading

0 comments on commit 317fef5

Please sign in to comment.