seisiuneer / abctools

ABC Transcription tools based on abcjs
MIT License
48 stars 25 forks source link

Transpose Down/Up only transposes first tune #7

Closed pszacherski closed 10 months ago

pszacherski commented 11 months ago

Expected behaviour

Given I have a set of n > 1 tunes, When I press the Transpose Down/Transpose Down button, Then all the tunes get transposed down/up respectively.

Actual behaviour

Only the first tune in the set gets transposed down/up.

Observations

I see that only the first tune is selected.

If there is an option that I need to activate, I must have overseen it.

Before click on button After click on button

seisiuneer commented 11 months ago

If you select across one or more tunes, they will be the only tunes transposed. If nothing is selected, it will transpose all the tunes.

On Fri, Dec 22, 2023 at 12:08 AM Pascal Szacherski @.***> wrote:

Expected behaviour

Given I have a set of n > 1 tunes, When I press the Transpose Down/Transpose Down button, Then all the tunes get transposed down/up respectively. Actual behaviour

Only the first tune in the set gets transposed down/up. Observations

I see that only the first tune is selected.

If there is an option that I need to activate, I must have overseen it.

Screenshot.from.2023-12-22.09-05-28.png (view on web) https://github.com/seisiuneer/abctools/assets/86947161/8b7dc7f0-eeea-4b56-b680-82e9e59cdacd Screenshot.from.2023-12-22.09-05-16.png (view on web) https://github.com/seisiuneer/abctools/assets/86947161/4a7ab97b-92da-4884-814f-976f280ecea2

— Reply to this email directly, view it on GitHub https://github.com/seisiuneer/abctools/issues/7, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4ZXLYMGEUJYQTAS3EWIEDYKU5XTAVCNFSM6AAAAABA7PUGVSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA2TGNJUGUZTIOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

--


Michael Eskin @.*** (619) 368-1854 (text/voice)

Home Page http://michaeleskin.com | Online Store https://michaeleskin.gumroad.com | Zoom Session http://michaeleskin.com/session | AppCordions http://appcordions.com | Flickr https://www.flickr.com/photos/eskin/albums


pszacherski commented 11 months ago

In my example, nothing was selected, but only the first tune got transposed.

I had the same experience on my phone with a Fennec browser (Firefox fork).

seisiuneer commented 11 months ago

Cool, I'll see if I can sort out why it might have done that...On Dec 22, 2023, at 3:59 AM, Pascal Szacherski @.***> wrote: In my example, nothing was selected, but only the first tune got transposed. I had the same experience on my phone with a Fennec browser (Firefox fork).

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

seisiuneer commented 11 months ago

If the text cursor is in a tune even without a selection area, generally that tune gets transposed and not the others. At least that's how it is meant to work. Looking into under what conditions I have it transpose all tunes.On Dec 22, 2023, at 3:59 AM, Pascal Szacherski @.***> wrote: In my example, nothing was selected, but only the first tune got transposed. I had the same experience on my phone with a Fennec browser (Firefox fork).

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

seisiuneer commented 11 months ago

Did you just add one or more tunes and then click a Transpose button?  After a tune is added the cursor is moved to the start of the ABC area, which would explain the first tune transpose.This code maps the range of selected tunes to which gets transposed. In theory the only way to transpose all is to select all and transpose.// // Tranpose the ABC up one semitone //

// // Find the tune range for the current select // function getTuneRangeForTranspose(){

var theNotes = gTheABC.value;

// Obtain the object reference for the <textarea>
var txtarea = gTheABC;

// Obtain the index of the first selected character
var theStart = txtarea.selectionStart;

if (theStart == 0) {

    // Common case where a set was just loaded and the cursor is at the start, go find the first position after an X:
    theStart = theNotes.indexOf("X:")+2;

}

var theEnd = txtarea.selectionEnd

if (theEnd == 0) {

    // Common case where a set was just loaded and the cursor is at the start, go find the first position after an X:
    theEnd = theNotes.indexOf("X:")+2;

}

var startTune = findTuneByOffset(theStart);

var endTune = findTuneByOffset(theEnd);

return {start:startTune,end:endTune};

} On Dec 22, 2023, at 5:22 AM, Michael Eskin @.> wrote:If the text cursor is in a tune even without a selection area, generally that tune gets transposed and not the others. At least that's how it is meant to work. Looking into under what conditions I have it transpose all tunes.On Dec 22, 2023, at 3:59 AM, Pascal Szacherski @.> wrote: In my example, nothing was selected, but only the first tune got transposed. I had the same experience on my phone with a Fennec browser (Firefox fork).

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

pszacherski commented 10 months ago

Ah! That means that I got my expectations wrong! Transpose Down/Up is only for the current tune. If I want my expected behaviour to work, then I have to select all the tunes, and this works.

Sorry for the hassle. Maybe you can add a check box Transpose all.

seisiuneer commented 10 months ago

Glad you got it figured out!I think it's easy enough to do a select all (Ctrl- A or CMD-A) and then do a transpose operation. I wanted a system that was flexible enough transpose a single tune, multiple tunes, or all tunes.This is all spelled out in the User Guide:Michael Eskin's ABC Transcription Tools User Guidemichaeleskin.comAll the best,MichaelOn Dec 23, 2023, at 10:43 PM, Pascal Szacherski @.***> wrote: Ah! That means that I got my expectations wrong! Transpose Down/Up is only for the current tune. If I want my expected behaviour to work, then I have to select all the tunes, and this works. Sorry for the hassle. Maybe you can add a check box Transpose all.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

pszacherski commented 10 months ago

Then this is all clear and the issue can be closed. 👍