Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions src/DragDropTouch.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,18 +298,13 @@ export default () => {
// if target element is an iframe, try propagating event to child element
if (el && el.nodeName === 'IFRAME') {
try {
var iframeDocument = el.contentWindow.document;
// get iframe absolute offset
var iframeAbsoluteOffset = { x: 0, y: 0 };
do {
iframeAbsoluteOffset.x += el.offsetLeft || 0;
iframeAbsoluteOffset.y += el.offsetTop || 0;
el = el.offsetParent;
} while (el);
// get iframe absolute offset relative to viewport
var rect = el.getBoundingClientRect();
// remove iframe absolute offset from touch position
var x = pt.x - iframeAbsoluteOffset.x,
y = pt.y - iframeAbsoluteOffset.y;
var x = pt.x - rect.x,
y = pt.y - rect.y;
// get element on that position from iframe document
var iframeDocument = el.contentWindow.document;
el = iframeDocument.elementFromPoint(x, y);
} catch (e) {
// iframe origin don't allow access
Expand Down