Bureaucrats, Check users, Interface administrators, Moderators, Suppressors, Administrators, Widget editors
1,054
edits
(Created page with "<html> <?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <svg version="1.2" id="Layer_1" baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 502.532 435.281" xml:space="preserve"> <g id="Zimbabwe"> <a xlink:href="Zimbabwe" > <title>Zimbabwe</title> <polygon fill-rule="evenodd" fill="#C0C0C0" stroke="#F9F9F9...") |
No edit summary Tag: Reverted |
||
Line 7,395: | Line 7,395: | ||
</g> | </g> | ||
</svg> | </svg> | ||
<script> | |||
// Don't use window.onLoad like this in production, because it can only listen to one function. | |||
window.onload = function() { | |||
var beforePan | |||
beforePan = function(oldPan, newPan){ | |||
var stopHorizontal = false | |||
, stopVertical = false | |||
, gutterWidth = 100 | |||
, gutterHeight = 100 | |||
// 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 | |||
} | |||
// Expose to window namespace for testing purposes | |||
window.panZoom = svgPanZoom('#limit-svg', { | |||
zoomEnabled: true | |||
, controlIconsEnabled: true | |||
, fit: 1 | |||
, center: 1 | |||
, beforePan: beforePan | |||
}); | |||
// panZoom.setBeforePan(beforePan) | |||
}; | |||
</script> | |||
</html> | </html> |