Brion VIBBER has uploaded a new change for review. https://gerrit.wikimedia.org/r/158824
Change subject: Possible fix for scroll top/bottom oddity ...................................................................... Possible fix for scroll top/bottom oddity Change-Id: I1b5180584cd92e7ddc26670e0b9e26b7a5e904cf --- M wikipedia/Categories/UIWebView+ElementLocation.m M wikipedia/assets/bundle.js M www/js/elementLocation.js 3 files changed, 4 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/apps/ios/wikipedia refs/changes/24/158824/1 diff --git a/wikipedia/Categories/UIWebView+ElementLocation.m b/wikipedia/Categories/UIWebView+ElementLocation.m index ecd8c32..09ca2ec 100644 --- a/wikipedia/Categories/UIWebView+ElementLocation.m +++ b/wikipedia/Categories/UIWebView+ElementLocation.m @@ -67,11 +67,6 @@ - (CGRect)getWebViewRectForHtmlElementWithId:(NSString *)elementId { CGRect r = [self getScreenRectForHtmlElementWithId:elementId]; - CGPoint p = CGPointMake( - r.origin.x + floor(self.scrollView.contentOffset.x), - r.origin.y + floor(self.scrollView.contentOffset.y) - ); - r.origin = p; return r; } diff --git a/wikipedia/assets/bundle.js b/wikipedia/assets/bundle.js index efc8924..9473dec 100644 --- a/wikipedia/assets/bundle.js +++ b/wikipedia/assets/bundle.js @@ -72,8 +72,8 @@ var rect = element.getBoundingClientRect(); var zoom = getZoomLevel(); var zoomedRect = new Object(); - zoomedRect['top'] = rect.top * zoom; - zoomedRect['left'] = rect.left * zoom; + zoomedRect['top'] = (rect.top + window.scrollY) * zoom; + zoomedRect['left'] = (rect.left + window.scrollX) * zoom; zoomedRect['width'] = rect.width * zoom; zoomedRect['height'] = rect.height * zoom; return zoomedRect; diff --git a/www/js/elementLocation.js b/www/js/elementLocation.js index f701809..7f5d91b 100644 --- a/www/js/elementLocation.js +++ b/www/js/elementLocation.js @@ -27,8 +27,8 @@ var rect = element.getBoundingClientRect(); var zoom = getZoomLevel(); var zoomedRect = new Object(); - zoomedRect['top'] = rect.top * zoom; - zoomedRect['left'] = rect.left * zoom; + zoomedRect['top'] = (rect.top + window.scrollY) * zoom; + zoomedRect['left'] = (rect.left + window.scrollX) * zoom; zoomedRect['width'] = rect.width * zoom; zoomedRect['height'] = rect.height * zoom; return zoomedRect; -- To view, visit https://gerrit.wikimedia.org/r/158824 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1b5180584cd92e7ddc26670e0b9e26b7a5e904cf Gerrit-PatchSet: 1 Gerrit-Project: apps/ios/wikipedia Gerrit-Branch: master Gerrit-Owner: Brion VIBBER <br...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits