Skip to content

Commit

Permalink
Fix code style
Browse files Browse the repository at this point in the history
Replace unary increments/decrements to num += 1 and num -= 1 and add
missing new lines for better code readability.

Issue: #4708
  • Loading branch information
budnix committed Feb 15, 2018
1 parent 6df6ef0 commit 6b6b3a2
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
11 changes: 5 additions & 6 deletions src/3rdparty/walkontable/src/border.js
Expand Up @@ -326,7 +326,7 @@ class Border {

const rowsCount = this.wot.wtTable.getRenderedRowsCount();

for (let i = 0; i < rowsCount; i++) {
for (let i = 0; i < rowsCount; i += 1) {
let s = this.wot.wtTable.rowFilter.renderedToSource(i);

if (s >= corners[0] && s <= corners[2]) {
Expand All @@ -335,7 +335,7 @@ class Border {
}
}

for (let i = rowsCount - 1; i >= 0; i--) {
for (let i = rowsCount - 1; i >= 0; i -= 1) {
let s = this.wot.wtTable.rowFilter.renderedToSource(i);

if (s >= corners[0] && s <= corners[2]) {
Expand All @@ -346,7 +346,7 @@ class Border {

const columnsCount = this.wot.wtTable.getRenderedColumnsCount();

for (let i = 0; i < columnsCount; i++) {
for (let i = 0; i < columnsCount; i += 1) {
let s = this.wot.wtTable.columnFilter.renderedToSource(i);

if (s >= corners[1] && s <= corners[3]) {
Expand All @@ -355,7 +355,7 @@ class Border {
}
}

for (let i = columnsCount - 1; i >= 0; i--) {
for (let i = columnsCount - 1; i >= 0; i -= 1) {
let s = this.wot.wtTable.columnFilter.renderedToSource(i);

if (s >= corners[1] && s <= corners[3]) {
Expand All @@ -374,12 +374,11 @@ class Border {
const fromOffset = offset(fromTD);
const toOffset = isMultiple ? offset(toTD) : fromOffset;
const containerOffset = offset(this.wot.wtTable.TABLE);

const minTop = fromOffset.top;
const minLeft = fromOffset.left;

let height = toOffset.top + outerHeight(toTD) - minTop;
let width = toOffset.left + outerWidth(toTD) - minLeft;

let top = minTop - containerOffset.top - 1;
let left = minLeft - containerOffset.left - 1;
let style = getComputedStyle(fromTD);
Expand Down
2 changes: 1 addition & 1 deletion src/3rdparty/walkontable/src/selection.js
Expand Up @@ -160,7 +160,7 @@ class Selection {
let index = previousIndex >= 0 ? previousIndex : layerLevelOwner;
let className = baseClassName;

index--;
index -= 1;

const previousClassName = index === 0 ? baseClassName : `${baseClassName}-${index}`;

Expand Down
1 change: 1 addition & 0 deletions src/helpers/array.js
Expand Up @@ -89,6 +89,7 @@ export function arrayFilter(array, predicate) {
if (!Array.isArray(array)) {
iterable = Array.from(array);
}

const length = iterable.length;
const result = [];
let resIndex = -1;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/contextMenu/menu.js
Expand Up @@ -667,7 +667,7 @@ class Menu {
* @param {Object} preventScrolling Object with `value` property where its value change will be observed.
* @param {Number} selectionLayerLevel The number which indicates what selection layer is currently modified.
*/
onAfterSelection(r, c, r2, c2, preventScrolling, selectionLayer) {
onAfterSelection(r, c, r2, c2, preventScrolling) {
if (this.keyEvent === false) {
preventScrolling.value = true;
}
Expand Down
1 change: 1 addition & 0 deletions src/selection/selection.js
Expand Up @@ -243,6 +243,7 @@ class Selection {
}
}
}

if (this.highlight.isEnabledFor(HEADER_TYPE)) {
if (this.settings.selectionMode === 'single') {
headerHighlight.add(cellRange.highlight);
Expand Down
4 changes: 2 additions & 2 deletions src/utils/keyStateObserver.js
Expand Up @@ -28,15 +28,15 @@ function startObserving() {
});
}

refCount++;
refCount += 1;
}

/**
* Stops observing keyboard keys states and clear all previously saved states.
*/
function stopObserving() {
if (refCount > 0) {
refCount--;
refCount -= 1;
}

if (refCount === 0) {
Expand Down

0 comments on commit 6b6b3a2

Please sign in to comment.