From de91b94e28d3e9a2979bab1ecdde7901b5d9d8d1 Mon Sep 17 00:00:00 2001 From: Fabian Hijlkema Date: Sun, 27 Aug 2017 13:22:00 +0200 Subject: [PATCH] Take into account possible CSS transforms on the element --- src/jquery.pep.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/jquery.pep.js b/src/jquery.pep.js index 64f8fa4..5a13213 100644 --- a/src/jquery.pep.js +++ b/src/jquery.pep.js @@ -866,13 +866,13 @@ upperYLimit = this.$container.height() - (this.options.useBoundingClientRect ? this.$el[0].getBoundingClientRect().height : this.$el.outerHeight()); // is our object trying to move outside lower X & Y limits? - if ( this.pos.x + dx < 0 ) hash.x = 0; - if ( this.pos.y + dy < 0 ) hash.y = 0; + if ( this.pos.x + dx < 0 ) hash.x = -this.xTranslation(); + if ( this.pos.y + dy < 0 ) hash.y = -this.yTranslation(); } // is our object trying to move outside upper X & Y limits? - if ( this.pos.x + dx > upperXLimit ) hash.x = upperXLimit; - if ( this.pos.y + dy > upperYLimit ) hash.y = upperYLimit; + if ( this.pos.x + dx > upperXLimit ) hash.x = upperXLimit - this.xTranslation(); + if ( this.pos.y + dy > upperYLimit ) hash.y = upperYLimit - this.yTranslation(); // Account for translation, which makes movement a little tricky. if ( this.shouldUseCSSTranslation() && accountForTranslation ){