Skip to content

Commit

Permalink
gsuiSliderGroup: use gsui0ne's onptrdown/move/up
Browse files Browse the repository at this point in the history
  • Loading branch information
mr21 committed May 12, 2024
1 parent e0d1266 commit a2ada08
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 21 deletions.
26 changes: 7 additions & 19 deletions gsuiSliderGroup/gsuiSliderGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ class gsuiSliderGroup extends gsui0ne {
#selected = new Map();
#valueSaved = new Map();
#bcr = null;
#evMouseup = null;
#evMousemove = null;
#uiFn = Object.freeze( {
when: this.#sliderWhen.bind( this ),
value: this.#sliderValue.bind( this ),
Expand All @@ -36,7 +34,6 @@ class gsuiSliderGroup extends gsui0ne {
},
} );
Object.seal( this );
this.$element.oncontextmenu = GSUnoopFalse;
}

// .........................................................................
Expand All @@ -54,7 +51,6 @@ class gsuiSliderGroup extends gsui0ne {
this.$elements.$loopB = null;
}
this.#updatePxPerBeat();
this.$elements.$slidersParent.onmousedown = this.#mousedown.bind( this );
if ( beatlines ) {
GSUrecallAttributes( this, {
currenttime: 0,
Expand Down Expand Up @@ -189,22 +185,19 @@ class gsuiSliderGroup extends gsui0ne {
}

// .........................................................................
#mousedown( e ) {
if ( !this.#evMouseup && ( e.button === 0 || e.button === 2 ) ) {
$onptrdown( e ) {
if ( e.button === 0 || e.button === 2 ) {
this.#bcr = this.$elements.$slidersParent.getBoundingClientRect();
this.#button = e.button;
this.#valueSaved.clear();
this.#sliders.forEach( ( sli, id ) => this.#valueSaved.set( id, sli.value ) );
this.#evMouseup = this.#mouseup.bind( this );
this.#evMousemove = this.#mousemove.bind( this );
document.addEventListener( "mouseup", this.#evMouseup );
document.addEventListener( "mousemove", this.#evMousemove );
GSUunselectText();
GSUdragshield.show( "pointer" );
this.#mousemove( e );
this.$onptrmove( e );
return;
}
return false;
}
#mousemove( e ) {
$onptrmove( e ) {
const sliders = this.#selected.size > 0
? this.#selected
: this.#sliders;
Expand Down Expand Up @@ -232,14 +225,9 @@ class gsuiSliderGroup extends gsui0ne {
}
} );
}
#mouseup() {
$onptrup() {
const arr = [];

GSUdragshield.hide();
document.removeEventListener( "mouseup", this.#evMouseup );
document.removeEventListener( "mousemove", this.#evMousemove );
this.#evMouseup =
this.#evMousemove = null;
this.#sliders.forEach( ( sli, id ) => {
if ( sli.value !== this.#valueSaved.get( id ) ) {
arr.push( [ id, sli.value ] );
Expand Down
2 changes: 0 additions & 2 deletions gsuiSliderGroup/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<link rel="stylesheet" href="/gs-ui-components/test-assets/test.css"/>

<!-- ....................................................................... -->
<link rel="stylesheet" href="/gs-ui-components/gsuiDragshield/gsuiDragshield.css"/>
<link rel="stylesheet" href="/gs-ui-components/gsuiBeatlines/gsuiBeatlines.css"/>

<!-- ....................................................................... -->
Expand Down Expand Up @@ -45,7 +44,6 @@
<script src="/gs-ui-components/gsui0ne/gsui0ne.js"></script>

<!-- ....................................................................... -->
<script src="/gs-ui-components/gsuiDragshield/gsuiDragshield.js"></script>
<script src="/gs-ui-components/gsuiBeatlines/gsuiBeatlines.html.js"></script>
<script src="/gs-ui-components/gsuiBeatlines/gsuiBeatlines.js"></script>

Expand Down

0 comments on commit a2ada08

Please sign in to comment.