Skip to content

Commit

Permalink
Cosmetic changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
djalbat committed Oct 15, 2018
1 parent 064a188 commit bdb8e1d
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 107 deletions.
58 changes: 30 additions & 28 deletions es6/cursor.js
Expand Up @@ -8,44 +8,46 @@ const body = new Body();

let previousCursor; ///

class cursor {
static columnResize() {
const currentCursor = this.getCurrentCursor();
function columnResize() {
const currentCursor = getCurrentCursor();

if (currentCursor !== 'col-resize') {
previousCursor = currentCursor;
if (currentCursor !== 'col-resize') {
previousCursor = currentCursor;

this.setCursor('col-resize');
}
setCursor('col-resize');
}
}

static rowResize() {
const currentCursor = this.getCurrentCursor();
function rowResize() {
const currentCursor = getCurrentCursor();

if (currentCursor !== 'row-resize') {
previousCursor = currentCursor;
if (currentCursor !== 'row-resize') {
previousCursor = currentCursor;

this.setCursor('row-resize');
}
setCursor('row-resize');
}
}

static reset() {
this.setCursor(previousCursor); ///
}
function reset() {
setCursor(previousCursor); ///
}

static getCurrentCursor() {
const currentCursor = body.css('cursor'); ///
module.exports = {
columnResize,
rowResize,
reset
};

return currentCursor || 'auto'; ///
}
function setCursor(cursor) {
const css = {
cursor
};

static setCursor(cursor) {
const css = {
cursor
};

body.css(css);
}
body.css(css);
}

module.exports = cursor;
function getCurrentCursor() {
const currentCursor = body.css('cursor'); ///

return currentCursor || 'auto'; ///
}
8 changes: 4 additions & 4 deletions es6/splitter.js
Expand Up @@ -4,10 +4,10 @@ const easy = require('easy');

const options = require('./options');

const ESCAPE_KEYCODE = 27;
const { window, Element } = easy,
{ ESCAPE_KEY_STOPS_DRAGGING } = options;

const { ESCAPE_KEY_STOPS_DRAGGING } = options,
{ window, Element } = easy;
const ESCAPE_KEY_CODE = 27;

class Splitter extends Element {
constructor(selector, beforeSizeableElement, afterSizeableElement, startDraggingHandler, stopDraggingHandler, dragHandler, options) {
Expand Down Expand Up @@ -133,7 +133,7 @@ class Splitter extends Element {
}

keyDownHandler(keyCode) {
if (keyCode === ESCAPE_KEYCODE) {
if (keyCode === ESCAPE_KEY_CODE) {
const dragging = this.isDragging();

if (dragging) {
Expand Down
14 changes: 12 additions & 2 deletions es6/splitter/horizontal.js
Expand Up @@ -89,9 +89,19 @@ class HorizontalSplitter extends Splitter {
}
}

getPreviousMouseTop() { return this.fromState('previousMouseTop'); }
getPreviousMouseTop() {
const state = this.getState(),
{ previousMouseTop } = state;

getPreviousSizeableElementHeight() { return this.fromState('previousSizeableElementHeight'); }
return previousMouseTop;
}

getPreviousSizeableElementHeight() {
const state = this.getState(),
{ previousSizeableElementHeight } = state;

return previousSizeableElementHeight;
}

setPreviousMouseTop(previousMouseTop) {
this.updateState({
Expand Down
14 changes: 12 additions & 2 deletions es6/splitter/vertical.js
Expand Up @@ -89,9 +89,19 @@ class VerticalSplitter extends Splitter {
}
}

getPreviousMouseLeft() { return this.fromState('previousMouseLeft'); }
getPreviousMouseLeft() {
const state = this.getState(),
{ previousMouseLeft } = state;

getPreviousSizeableElementWidth() { return this.fromState('previousSizeableElementWidth'); }
return previousMouseLeft;
}

getPreviousSizeableElementWidth() {
const state = this.getState(),
{ previousSizeableElementWidth } = state;

return previousSizeableElementWidth;
}

setPreviousMouseLeft(previousMouseLeft) {
this.updateState({
Expand Down
99 changes: 42 additions & 57 deletions lib/cursor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bdb8e1d

Please sign in to comment.