Skip to content
Snippets Groups Projects
Commit 5398aca0 authored by hpr-odoo's avatar hpr-odoo Committed by Barad Mahendra
Browse files

[FIX] web: Fix the bug while zoom on image


Currently when zoom slowly from right to left on employee image it
will not zoom the image.

currently to hide the zoom image we used target.width() and the method width
gives the width of the selected element (excluding padding, border
and margin) so due to border excluded it will hide the zooming image.
Aslo the offsetHeight property returns the viewable height of an
element in pixels, including padding, border and scrollbar, but not
the margin.

The reason why the 'viewable' word is specified, is because if the
element's content is taller than the actual height of the element,
this property will only return the height that is visible.

so instead of method width we used method outerWidth which gives
width of the selected element (including padding and border, excluding
margin).

closes odoo/odoo#46619

Co-authered-by: default avatarMahendra Barad <mba@odoo.com>
Task: 2199218
Closes: #46619
Signed-off-by: default avatarAaron Bohy (aab) <aab@odoo.com>
parent a545f9ed
Branches
Tags
No related merge requests found
......@@ -168,8 +168,8 @@ ZoomOdoo.prototype.show = function (e, testMouseOver) {
this.$flyout.css('transform', 'translate3d(' + left + 'px, ' + top + 'px, 0px)');
}
w1 = this.$target.width();
h1 = this.$target.height();
w1 = this.$target[0].offsetWidth;
h1 = this.$target[0].offsetHeight;
w2 = this.$flyout.width();
h2 = this.$flyout.height();
......@@ -291,7 +291,7 @@ ZoomOdoo.prototype._move = function (e) {
var xl = Math.ceil(pl * rw);
// Close if outside
if (xl < 0 || xt < 0 || xl > dw || xt > dh || lx > (offset.left + this.$target.width())) {
if (xl < 0 || xt < 0 || xl > dw || xt > dh || lx > (offset.left + this.$target.outerWidth())) {
this.hide();
} else {
var top = xt * -1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment