Page 1 of 2

Image Zoom Bug?

Posted: 2018-08-25, 23:20
by pmBill
I assume this is some sort of a bug.

When I look at this image:

https://scontent.cdninstagram.com/vp/ba ... 4768_n.jpg

And then I right-click and Zoom In, it zooms, but I can't scroll to see the top. It just cuts it off.

(I also assume this is not an extension or Greasemonkey script problem)

PM 28.0.0 32-bit
Windows 10 64-bit

Re: Image Zoom Bug?

Posted: 2018-08-25, 23:28
by back2themoon
Scrolls normally here. Try Safe Mode, perhaps some extension/userscript is interfering.

Re: Image Zoom Bug?

Posted: 2018-08-25, 23:34
by doofy
I'm on Win7.

I had a look at your image in my main install of PM 28, on a fairly basic 28, and on FF 61.

I don't have rt click Zoom functionality. Maybe that's a Win10 thing? Or an extension thing?

You get same behaviour in safe mode?

Re: Image Zoom Bug?

Posted: 2018-08-25, 23:37
by back2themoon
If it's an extension or userscript that does the zooming, the problem is probably there.

However, this could be related: https://forum.palemoon.org/viewtopic.ph ... 2&p=149371

Re: Image Zoom Bug?

Posted: 2018-08-25, 23:43
by ron_1
Off-topic:
When I right click on the image, I get no zoom function. Is this missing from the Linux PM builds?

Re: Image Zoom Bug?

Posted: 2018-08-25, 23:51
by tenseys
I'm on Win 10 64 bit and I don't have right click zoom. I can press control + and zoom in and scroll normally with no issues.

(Can also be done by holding control and using scroll wheel)

Re: Image Zoom Bug?

Posted: 2018-08-26, 00:05
by ron_1
tenseys wrote:
(Can also be done by holding control and using scroll wheel)
Thanks for that bit of info. And I did get a scroll bar when I tested it with the OP's link.

Re: Image Zoom Bug?

Posted: 2018-08-26, 01:30
by pmBill
Yes, it is an extension, AND/OR a Greasemonkey script, that are changing the
zoom factor of the image and it is confusing Pale Moon.

I messed with it, and the Keyboard Ctrl++, Ctrl+-, Ctrl+0 and Control Scroll work,
UNLESS either the extension or Gm modifies the image size, and then there are
some weird side-effects, as well.

It used to work, though, prior to v28. Although there were a few anomalies then, just not as bad or as many.

I suppose the extension is Image Zoom 0.6.3.1.signed.1-signed.

See image snapshot attachment.

Below is my Gm Script that lets me double-Click the image to toggle through some sizing.

I think Pale Moon should deal with a GmScript changing the size of an image programmatically
and "see that" and then allow it to scroll.

So I think (am pretty sure) it is still a BUG.

Code: Select all

/*
   dblclkimgzoom.user.js

   Double Click Image Zoom.

   Author:   William Donnelly. Copyright (c) 2004-2013. All right reserved. Etc...
   Contact:  donnelly-house.net | bill
   See:      http://www.donnelly-house.net/

   Double Click Image Zoom.    (2013)
   Zoom images that are double clicked on, in and out, using integer scaling factors (* 2, * 3, etc.),
   until they fill the screen, and then reverse the zoom direction. Rinse, repeat.
   Also automatically makes very large images fit to screen instead of Zoom In. (toggled back to original size)
   If an image almost fits the screen, it is assumed that a full 2 * zoom in is desired.

   Ver 2.0.0  Revamped, recoded, extended.  (4/2013)
   Ver 1.0.0  First attempt.  (7/2005)
*/

// userscript metadata follows...

// ==UserScript==
// @name          Double Click Image Zoom
// @namespace     http://www.donnelly-house.net/
// @description   Zoom images in and out and fit to screen that are double clicked on
// @include       *
// @exclude       *.donnelly-house.net/programming/cdp1802/simelf/*

// @Version       2.0.0
// @Firefox       ~19+ (probably most/all lower versions)
// @GmVersion     1.8
// @Author        William Donnelly
// @Email         donnelly-house.net | bill
// ==/UserScript==

function zoomImage (eEvent) {    // 'this' refers to the image for this double click event handler

   if (unsafeWindow.whd_NoZoomImage)
      return;

   if (this.zoomInitialHeight == null) {      // set our initial values for the image object if not present
      this.zoomInitialWidth = this.width;
      this.zoomInitialHeight = this.height;
      this.zoomScalingFactor = 1;            // original size
      this.zoomScalingDirection = 1;         // zoom in (enlarge) -- (-1 = zoom out (reduce);  0 = special fit image toggle flag)
   }

   var nMaxWidth = window.innerWidth - 20;
   var nMaxHeight = window.innerHeight - 20;

   if (this.zoomScalingDirection == 1) {     // zoom in (enlarge),  or FIT image
      if (((this.width > nMaxWidth  ||  this.height > nMaxHeight)  &&
            !eEvent.ctrlKey)  ||  eEvent.shiftKey) {   // Fit 'small' images; Ctrl key overrides FIT image and does a zoom in; Shift key FIT's!
         if (this.zoomScalingFactor == 1  &&  ( ((this.zoomInitialWidth - nMaxWidth) < 100  &&  (this.zoomInitialHeight - 100) < nMaxHeight)   ||
               ((this.zoomInitialHeight - nMaxHeight) < 100  &&  (this.zoomInitialWidth - 100) < nMaxWidth) ) ) {   // if image is slightly larger than screen
            ++this.zoomScalingFactor;     // try to zoom in (enlarge)

            var nWidth = this.zoomScalingFactor * this.zoomInitialWidth;
            var nHeight = this.zoomScalingFactor * this.zoomInitialHeight;

            this.width = nWidth;
            this.height = nHeight;
            status = 'Image zoom = ' + this.zoomScalingFactor + '  on ' + nMaxWidth + 'w X ' + nMaxHeight + 'h';

         } else {
            var wfactor = nMaxWidth / this.zoomInitialWidth;
            var hfactor = nMaxHeight / this.zoomInitialHeight;

            nScalingFactor = ((wfactor < hfactor) ? wfactor : hfactor);
            status = 'Image zoom = ' + nScalingFactor + '  on ' + nMaxWidth + 'w X ' + nMaxHeight + 'h';

            this.width = (nScalingFactor * this.zoomInitialWidth).toFixed();
            this.height = (nScalingFactor * this.zoomInitialHeight).toFixed();

            this.zoomScalingDirection = -1;     // reverse zoom direction (to zoom out (reduce)), Scaling Factor unchanged

            if (this.zoomScalingFactor != 1) {
               this.zoomScalingFactor = nScalingFactor.toFixed() - 1;    // special correction needed for 'ctrlKey super-enlarged images'

               if (this.zoomScalingFactor < 1)
                  this.zoomScalingFactor = 1;
            }
         }

      } else {    // we're in zoom in (enlarge) mode
         ++this.zoomScalingFactor;     // try to zoom in (enlarge)

         var nWidth = this.zoomScalingFactor * this.zoomInitialWidth;
         var nHeight = this.zoomScalingFactor * this.zoomInitialHeight;
         var bAllowZoomIn = ( this.zoomScalingFactor == 2  &&
            ( ((nMaxWidth - this.zoomInitialWidth) < 500  &&  this.zoomInitialHeight < nMaxHeight)          ||
               ((nMaxHeight - this.zoomInitialHeight) < 200  &&  this.zoomInitialWidth < nMaxWidth)         ||
               ((this.zoomInitialWidth - nMaxWidth) < 100  &&  (this.zoomInitialHeight - 100) < nMaxHeight)   ||
               ((this.zoomInitialHeight - nMaxHeight) < 100  &&  (this.zoomInitialWidth - 100) < nMaxWidth) ) );

         if (((nWidth > nMaxWidth  ||  nHeight > nMaxHeight)  &&  !eEvent.ctrlKey  &&  !bAllowZoomIn)  ||  eEvent.shiftKey) {      // if zoom overflow, fit to screen and reverse zoom direction; Shift key FIT's!
            var wfactor = nMaxWidth / this.zoomInitialWidth;
            var hfactor = nMaxHeight / this.zoomInitialHeight;

            var nScalingFactor = ((wfactor < hfactor) ? wfactor : hfactor);
            status = 'Image zoom = ' + nScalingFactor + '  on ' + nMaxWidth + 'w X ' + nMaxHeight + 'h';

            this.width = (nScalingFactor * this.zoomInitialWidth).toFixed();
            this.height = (nScalingFactor * this.zoomInitialHeight).toFixed();

            --this.zoomScalingFactor;           // correct scaling factor for next zoom out
            this.zoomScalingDirection = -1;     // reverse zoom direction (to zoom out (reduce))

            if (this.zoomScalingFactor < 1)
               this.zoomScalingFactor = 1;

         } else {    // allow zoom in
            this.width = nWidth;
            this.height = nHeight;
            status = 'Image zoom = ' + this.zoomScalingFactor + '  on ' + nMaxWidth + 'w X ' + nMaxHeight + 'h';
         }
      }

   } else {    // zoom out (reduce) mode -- Scaling Factor should be set to 'next reduction value' (>= 1)
      if (eEvent.shiftKey) {     // Shift key FIT's now!
         var wfactor = nMaxWidth / this.zoomInitialWidth;
         var hfactor = nMaxHeight / this.zoomInitialHeight;

         nScalingFactor = ((wfactor < hfactor) ? wfactor : hfactor);
         status = 'Image zoom = ' + nScalingFactor + '  on ' + nMaxWidth + 'w X ' + nMaxHeight + 'h';

         this.width = (nScalingFactor * this.zoomInitialWidth).toFixed();
         this.height = (nScalingFactor * this.zoomInitialHeight).toFixed();

         if (this.zoomScalingFactor != 1) {
            this.zoomScalingFactor = nScalingFactor.toFixed() - 1;    // reduce to next smallest size

            if (this.zoomScalingFactor < 1)
               this.zoomScalingFactor = 1;
         }


      } else {    // normal zoom out (reduce) processing
         if (eEvent.ctrlKey) {      // assumes use immediately after FIT to screen
            ++this.zoomScalingFactor;           // correct Scaling Factor to previous value
            this.zoomScalingDirection = 1;      // reverse zoom direction (to zoom in (enlarge))

            this.width = this.zoomScalingFactor * this.zoomInitialWidth;
            this.height = this.zoomScalingFactor * this.zoomInitialHeight;
            status = 'Image zoom = ' + this.zoomScalingFactor + '  on ' + nMaxWidth + 'w X ' + nMaxHeight + 'h';

         } else {
            this.width = this.zoomScalingFactor * this.zoomInitialWidth;
            this.height = this.zoomScalingFactor * this.zoomInitialHeight;
            status = 'Image zoom = ' + this.zoomScalingFactor + '  on ' + nMaxWidth + 'w X ' + nMaxHeight + 'h';

            if (--this.zoomScalingFactor < 1) {
               this.zoomScalingFactor = 1;
               this.zoomScalingDirection = 1;      // reverse zoom direction (to zoom in (enlarge))
            }
         }
      }
   }

   return;
} // zoomImage


function attachToImages() {

   try {

      var nImages = unsafeWindow.document.images.length;

      for (var nImgLoop = 0;  nImgLoop < nImages;  ++nImgLoop) {

         var wImage = unsafeWindow.document.images[nImgLoop];
         if (wImage.parentNode.nodeName.toUpperCase() != "A")  // don't do links
            if (wImage.getAttribute ('nodoubleclickzoom') != 'true')     // ignore specially-marked images
               wImage.addEventListener ("dblclick", zoomImage, false);

      }

      var nFrames = unsafeWindow.frames.length;

      for (var nFrmLoop = 0;  nFrmLoop < nFrames;  ++nFrmLoop) {

         nImages = unsafeWindow.frames[nFrmLoop].document.images.length;

         for (nImgLoop = 0;  nImgLoop < nImages;  ++nImgLoop) {

            var fImage = unsafeWindow.frames[nFrmLoop].document.images[nImgLoop];
            if (fImage.parentNode.nodeName.toUpperCase() != "A")  // don't do links
               if (fImage.getAttribute ('nodoubleclickzoom') != 'true')     // ignore specially-marked images
                  fImage.addEventListener ("dblclick", zoomImage, false);

         } // for

      } // for

   } catch (eErr) { };   // do nothing if something weird occurs

   return;
} // attachToImages

window.addEventListener ("load", attachToImages, false);    // perform mods at onload if non-image document
attachToImages();    // for image documents

Re: Image Zoom Bug?

Posted: 2018-08-26, 02:21
by doofy
pmBill wrote:So I think (am pretty sure) it is still a BUG.
Well, a browser's function is to be a browser, yes?

An extension's function is to modify the behaviour of a browser. Extension's functionality is browser specific as any fule no.
GM scripts are generally designed to modify a browser's behaviour. It is entirely irrelevant that you've modified the GM script.

So what do we have here?

We have PM 28, which is a major rebuild - it is *not* a simple PM 27 "upgrade".

And we have a user running a FF extension along with a modified GM script, complaining that functionality has changed between PM 27 and PM 28.

And then reporting as a "bug" the fact that PM has not adapted correctly to his (possibly unique) working environment.

This is not a PM bug; it's a bug at the chair/kb interface.

Re: Image Zoom Bug?

Posted: 2018-08-26, 02:33
by Trapper852
There is a very elegant & simple answer to get this functionality if you don't have it natively.

Install Image Zoom 0.6.3.1

Works beautifully! I've used it for years & would be lost without it. :thumbup:

Re: Image Zoom Bug?

Posted: 2018-08-26, 07:56
by pmBill
doofy wrote:
pmBill wrote:So I think (am pretty sure) it is still a BUG.
Well, a browser's function is to be a browser, yes?
{snip}
This is not a PM bug; it's a bug at the chair/kb interface.
NO.

It IS a BUG.

It doesn't matter WHY an image is resized.

The browser SHOULD understand that fact, and deal with it accordingly, AS IT ALWAYS HAS, as one would EXPECT it to do.
(as, NO DOUBT, ALL other browsers also do, as a person would EXPECT it to act)

Unless the developers blow this off and don't deal with it, it will most likely be acknowledged as a BUG and FIXED at some point, as it SHOULD BE.

It is NO DIFFERENT from some JavaScript executing as a script in the document and changing an image size programmatically.
In that instance, AS WELL, the browser should treat the re-sized image appropriately. And NOT not allow it to be scrolled because it
doesn't recognize, for whatever reasons, that is has been re-sized.

I have used that GmScript in Firefox AND Pale Moon for MANY years, and it most likely would work fine equivalently
in Opera, Chrome, Edge, and IE.

Re: Image Zoom Bug?

Posted: 2018-08-26, 07:59
by pmBill
Trapper852 wrote:There is a very elegant & simple answer to get this functionality if you don't have it natively.

Install Image Zoom 0.6.3.1

Works beautifully! I've used it for years & would be lost without it. :thumbup:
The version I'm using works fine.
(unless upgrading "fixes" the problem I am seeing, but, because it is also happening in a GmScript, I HIGHLY doubt that wold be the case)
I might upgrade to the newer version.
You have to be careful with that because they are making changes that ONLY work in the newer versions of Firefox
that break in Pale Moon, so I am wary of doing that -- I don't know why it is not auto-updating)

I looked at the latest (working) version and the release notes state: "Fixed defect with german language implementation", so, no.

Re: Image Zoom Bug?

Posted: 2018-08-26, 08:04
by JustOff
I'm pretty sure that the bug is in the script which does not scale images properly :coffee:

Re: Image Zoom Bug?

Posted: 2018-08-26, 11:53
by billmcct
I have had Image Zoom 0.6.3.1-signed.1-signed installed for quite some time and it is a problem in the addon. Has always had this problem except when using ctrl key.

Re: Image Zoom Bug?

Posted: 2018-08-26, 15:53
by therube
And then I right-click and Zoom In, it zooms, but I can't scroll to see the top. It just cuts it off.
Confirmed.
And yes, thinking it will be a bug in the extension.
Off-topic:
Also note, that when an image has focus, a right-click context-menu action takes two right-clicks for the context-menu to show up.
(Also related to Image Zoom.)

Re: Image Zoom Bug?

Posted: 2018-08-26, 21:04
by pmBill
billmcct wrote:I have had Image Zoom 0.6.3.1-signed.1-signed installed for quite some time and it is a problem in the addon. Has always had this problem except when using ctrl key.
I've never had any real problems with Image Zoom, and I've used it for years, in Pale Moon and Firefox.
It does act mildly tweaky at times, with THE BROWSER seemingly "getting confused".

But, because the problem I state also occurs in a GmScript, and (most likely) WOULD occur in ANY JavaScript
that is contained in a loaded (HTML) "document" (group -- w/inline and included JS; I don't know if that has an 'overall name'),
AND the fact that it worked fine for MANY years until now, STRONGLY suggests that it is obviously a BUG in Pale Moon, and
NOT some external thing.

I could do some additional testing and such, with Pale Moon and other browsers, but isn't that the Development Group's job?

Unless you would just rather ignore it until enough people complain about it or point it out that you can't.
(and/or 'you' personally notice something isn't right)

Re: Image Zoom Bug?

Posted: 2018-08-26, 21:48
by ron_1
It's the responsibility of the developer of the extension to make things compatible, not the developer of the browser.

Re: Image Zoom Bug?

Posted: 2018-08-26, 21:55
by JustOff
There is no such a kind of bug as "the browser does not work with the extension X". Until someone is narrowed down the problem to the specific browser API call used by this extension that does not work as promised, the bug is assumed to be in the extension itself. Here's how it works.

Re: Image Zoom Bug?

Posted: 2018-09-03, 23:49
by pm4eva
Tested it with Firefox ESR 52.9.0 and the pic also is cutted.
So its a problem with the addon itself.

Re: Image Zoom Bug?

Posted: 2018-09-04, 04:23
by pmBill
No.

There is NO SUCH THING as "didn't 'zoom' (modify the size of) the image correctly."

IT IS SIMPLE JAVASCRIPT. (executed in the Greasemonkey script, but it could be executed ANYWHERE JS can be executed)

You SHOULD NOT be able to modify the size of an image and the browser not display that image correctly AT ALL TIMES.

AS IT HAS ALWAYS DONE. (and "ALL BROWSERS DO")

You can try to make excuses or justifications or rationalizations or anything like that, but they are complete and utter BULLSHIT and WRONG.