Skip to content

Commit

Permalink
Prepare for Release 1.2.0
Browse files Browse the repository at this point in the history
- update dependencies to address security vulnerabilities
- insert widget as child of the target image container (previously just appended to page) fixes issue with images in bootstrap modals
- use $img.position() instead of $img.offset() to determine location of image
  • Loading branch information
waynegm committed Jun 23, 2018
1 parent 797f92e commit 8a53d45
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion dist/imgViewer2.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions docs/lib/imgViewer2.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var waitForFinalEvent = (function () {
* a copy of the original image to be positioned over it and manipulated to
* provide zoom and pan
*/
self.view = $("<div class='viewport' />").uniqueId().appendTo("body");
self.view = $("<div class='viewport' />").uniqueId().appendTo($img.parent());
var $view = $(self.view);
self.map = {};
self.bounds = {};
Expand All @@ -64,7 +64,7 @@ var waitForFinalEvent = (function () {
self.ready = true;
var width = $img.width(),
height = $img.height(),
offset = $img.offset();
offset = $img.position();
// cache the image padding information
self.offsetPadding = {
top: parseInt($img.css('padding-top'),10),
Expand Down Expand Up @@ -103,7 +103,7 @@ var waitForFinalEvent = (function () {
trackresize: false,
maxBoundsViscosity: 1.0,
attributionControl: false,
inertia: true,
inertia: false,
zoomSnap: 0,
wheelPxPerZoomLevel: Math.round(36/self.options.zoomStep),
zoomDelta: self.options.zoomStep
Expand Down Expand Up @@ -187,7 +187,7 @@ var waitForFinalEvent = (function () {
$img = $(this.img),
width = $img.width(),
height = $img.height(),
offset = $img.offset(),
offset = $img.position(),
vTop = Math.round(offset.top + this.offsetBorder.y + this.offsetPadding.top),
vLeft = Math.round(offset.left + this.offsetBorder.x + this.offsetPadding.left);
$view.css({
Expand Down
Loading

0 comments on commit 8a53d45

Please sign in to comment.