IITC-CE / ingress-intel-total-conversion

intel.ingress.com total conversion user script with some new features. Should allow easier extension of the intel map.
https://iitc.app
ISC License
279 stars 105 forks source link

A strange dialog "warping" in one browser profile but not another #738

Open nexushoratio opened 4 weeks ago

nexushoratio commented 4 weeks ago

I'm seeing a strange issue, but only in one of two Firefox profiles that I use on my Linux desktop. Both profiles are using the same FF binary, same ViolentMonkey extension, same IITC code built by me using ./build.py dev. In my testing, I have limited it to the only userscript I have enabled is core IITC, no plugins. I've deleted all local storage and cookies in both profiles, restarted the browser, and everything else normally suggested.

In my main profile, which is a moderately tweaked configuration, everything works normally.

But, in a "test" profile that only has VM and IITC installed, I am seeing this strange issue:

I drag a dialog (e.g., About IITC), to the right of the screen so the right edge of the dialog is offscreen. When I release the mouse button, the dialog will warp to the left edge of the screen with the left edge of the dialog offscreen in what looks to be the same amount of space as it had been off to the right side, be it a single pixel or half-way offscreen. The same will happen if I resize a dialog so the right edge goes offscreen

While debugging, it seems to happen when dialog sizeFix resets the width option: https://github.com/IITC-CE/ingress-intel-total-conversion/blob/199c9f7bdc0acb79db3855f9f5cd7c0cd516ec66/core/code/dialog.js#L83

If I comment out that line, or add a line like widget.off('dialogdragstop'); in a test plugin, the problem goes away (in the case of editing a plugin, only for that specific dialog, of course).

Since this only happens in my "test" profile, I'm not too worried about it. But, it is kind of annoying as I regularly move dialogs off to the right under the sidebar.

But, it would be interesting to know how two different profiles can act so differently and what I may have done wrong in my "test" profile. Any thoughts?

FF: 126.0/mozilla-deb/Linux 6.1.0-21-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.90-1 (2024-05-03) VM: 2.19.0 IITC: 0.38.1.20240606.025650 (well, synced to head from GH)

McBen commented 3 weeks ago

works normally.

For me the other case is "normal". When draging dialogs the screen will be scrolled and on release the dialog will be repositioned. But it depends on where I grab the dialog titlebar.

AFAIK sizeFix was added to fix a jqueryui bug ( https://bugs.jqueryui.com/ticket/15354/ ?).

maybe a better solution is to limit dialogs to the screen boundaries.

something like here https://github.com/IITC-CE/ingress-intel-total-conversion/blob/199c9f7bdc0acb79db3855f9f5cd7c0cd516ec66/core/code/dialog.js#L99-L102 add:

       open: function () {
            var ui = $(this).closest(".ui-dialog");
            if (!options.modal) {
                ui.draggable("option", "containment", '#map');
            }
            ui.resizable("option", "containment", '#map');

            var titlebar = ui.find('.ui-dialog-titlebar');
            titlebar.find(".ui-dialog-title") ......
nexushoratio commented 3 weeks ago

For me the other case is "normal". When draging dialogs the screen will be scrolled and on release the dialog will be repositioned.

Oh, I have that issue as well. Well, the causing the screen the scroll a bit, but the dialogs do not reposition themselves. I figured that'd be another problem to eventually look at solving!

For me, in this case, I'm really confused as to why I have different experiences in different profiles. Though if the containment method fixes my warping issue as well, I guess it doesn't matter. But still... Well, I guess there are enough unsolved mysteries in the world; one more probably won't matter. :->