MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Tag: Reverted
No edit summary
Tag: Manual revert
Line 43: Line 43:
                 return true;
                 return true;
             }
             }
        };
          var beforePan
          beforePan = function(oldPan, newPan){
            var stopHorizontal = false
stopVertical = false
gutterWidth = 10
gutterHeight = 10
                // Computed variables
sizes = this.getSizes()
leftLimit = -((sizes.viewBox.x + sizes.viewBox.width) * sizes.realZoom) + gutterWidth
rightLimit = sizes.width - gutterWidth - (sizes.viewBox.x * sizes.realZoom)
topLimit = -((sizes.viewBox.y + sizes.viewBox.height) * sizes.realZoom) + gutterHeight
bottomLimit = sizes.height - gutterHeight - (sizes.viewBox.y * sizes.realZoom)
            customPan = {}
            customPan.x = Math.max(leftLimit, Math.min(rightLimit, newPan.x))
            customPan.y = Math.max(topLimit, Math.min(bottomLimit, newPan.y))
            return customPan
          });
  svgPanZoom.setBeforePan(beforePan)
         };
         };
     } catch (err) {}
     } catch (err) {}
});
});

Navigation menu