Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/BooleanController.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default class BooleanController extends Controller {

this.$input.addEventListener( 'change', () => {
this.setValue( this.$input.checked );
this._callOnFinishChange();
} );

this.$disable = this.$input;
Expand Down
7 changes: 4 additions & 3 deletions src/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ export default class Controller {
*/
reset() {
this.setValue( this.initialValue );
this._callOnFinishChange();
return this;
}

Expand Down Expand Up @@ -401,12 +400,15 @@ export default class Controller {
* @param {any} value
* @returns {this}
*/
setValue( value ) {
setValue( value, finishChange = true ) {

if ( this.getValue() !== value ) {

this.object[ this.property ] = value;
this._callOnChange();
if ( finishChange ) {
this._callOnFinishChange();
}
this.updateDisplay();

}
Expand All @@ -426,7 +428,6 @@ export default class Controller {

load( value ) {
this.setValue( value );
this._callOnFinishChange();
return this;
}

Expand Down
16 changes: 8 additions & 8 deletions src/NumberController.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default class NumberController extends Controller {
value = this._snap( value );
}

this.setValue( this._clamp( value ) );
this.setValue( this._clamp( value ), false );

};

Expand All @@ -108,7 +108,7 @@ export default class NumberController extends Controller {

if ( isNaN( value ) ) return;

this._snapClampSetValue( value + delta );
this._snapClampSetValue( value + delta, false );

// Force the input to updateDisplay when it's focused
this.$input.value = this.getValue();
Expand Down Expand Up @@ -202,7 +202,7 @@ export default class NumberController extends Controller {
dragDelta = this._min - initValue;
}

this._snapClampSetValue( initValue + dragDelta );
this._snapClampSetValue( initValue + dragDelta, false );

}

Expand All @@ -226,8 +226,8 @@ export default class NumberController extends Controller {

const onBlur = () => {
this._inputFocused = false;
this.updateDisplay();
this._callOnFinishChange();
this.updateDisplay();
};

this.$input.addEventListener( 'input', onInput );
Expand Down Expand Up @@ -267,7 +267,7 @@ export default class NumberController extends Controller {
const setValueFromX = clientX => {
const rect = this.$slider.getBoundingClientRect();
let value = map( clientX, rect.left, rect.right, this._min, this._max );
this._snapClampSetValue( value );
this._snapClampSetValue( value, false );
};

// Mouse drag
Expand Down Expand Up @@ -382,7 +382,7 @@ export default class NumberController extends Controller {

// set value
const delta = this._normalizeMouseWheel( e ) * this._step;
this._snapClampSetValue( this.getValue() + delta );
this._snapClampSetValue( this.getValue() + delta, false );

// force the input to updateDisplay when it's focused
this.$input.value = this.getValue();
Expand Down Expand Up @@ -498,8 +498,8 @@ export default class NumberController extends Controller {
return value;
}

_snapClampSetValue( value ) {
this.setValue( this._clamp( this._snap( value ) ) );
_snapClampSetValue( value, finishChange = true ) {
this.setValue( this._clamp( this._snap( value ) ), finishChange );
}

get _hasScrollBar() {
Expand Down
1 change: 0 additions & 1 deletion src/OptionController.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default class OptionController extends Controller {

this.$select.addEventListener( 'change', () => {
this.setValue( this._values[ this.$select.selectedIndex ] );
this._callOnFinishChange();
} );

this.$select.addEventListener( 'focus', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/StringController.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class StringController extends Controller {
this.$input.setAttribute( 'aria-labelledby', this.$name.id );

this.$input.addEventListener( 'input', () => {
this.setValue( this.$input.value );
this.setValue( this.$input.value, false );
} );

this.$input.addEventListener( 'keydown', e => {
Expand Down