Skip to content

Commit

Permalink
Use lodash get to simplify property access
Browse files Browse the repository at this point in the history
  • Loading branch information
tiffon committed Sep 19, 2017
1 parent ae4c69e commit b83dedd
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import * as React from 'react';
import cx from 'classnames';
import _clamp from 'lodash/clamp';
import _get from 'lodash/get';

import Ticks from './Ticks';
import TimelineRow from './TimelineRow';
Expand Down Expand Up @@ -108,8 +109,9 @@ class TimelineColumnResizer extends React.PureComponent<
window.addEventListener('mousemove', this._onWindowMouseMove);
window.addEventListener('mouseup', this._onWindowMouseUp);
this._isDragging = true;
if (document && document.body && document.body.style) {
(document.body.style: any).userSelect = 'none';
const style = _get(document, 'body.style');
if (style) {
(style: any).userSelect = 'none';
}
};

Expand All @@ -121,8 +123,9 @@ class TimelineColumnResizer extends React.PureComponent<
_onWindowMouseUp = function _onWindowMouseUp({ clientX }) {
window.removeEventListener('mousemove', this._onWindowMouseMove);
window.removeEventListener('mouseup', this._onWindowMouseUp);
if (document && document.body && document.body.style) {
(document.body.style: any).userSelect = undefined;
const style = _get(document, 'body.style');
if (style) {
(style: any).userSelect = undefined;
}
this._isDragging = false;
const dragPosition = this._getDraggedPosition(clientX);
Expand Down

0 comments on commit b83dedd

Please sign in to comment.