-
Notifications
You must be signed in to change notification settings - Fork 786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iphone 4 dropzone displacement issue #264
Comments
Try doing the following with your dropzone Interactable(s) and see if it helps: interact(dropzoneSelector).rectChecker(function (element) {
return element.getClientRects()[0];
}); |
It did not. The Iphone does not call that function at all. I put an Alert in there and it didnt popout. Edit 2:
Firefox:
Edit 3: function getElementRect (element) {
var scroll = isIOS7orLower
? { x: 0, y: 0 }
: getScrollXY(getWindow(element)),
clientRect = (element instanceof SVGElement)?
element.getBoundingClientRect():
element.getClientRects()[0];
return clientRect && {
left : clientRect.left + scroll.x,
right : clientRect.right + scroll.x,
top : clientRect.top + scroll.y,
bottom: clientRect.bottom + scroll.y,
width : clientRect.width || clientRect.right - clientRect.left,
height: clientRect.heigh || clientRect.bottom - clientRect.top
};
} According to this, if IOS is lower or equal to 7 X and Y scrolls are 0, thats why when my dropzone is position:fixed I get displaced zones. |
So removing the isIOS7orLower check and getting Scroll values fixed the issue. interact('.zone').rectChecker(function (element) {
var scroll = {
x: window.scrollX || window.document.documentElement.scrollLeft,
y: window.scrollY || window.document.documentElement.scrollTop
},
clientRect = (element instanceof SVGElement)?
element.getBoundingClientRect():
element.getClientRects()[0];
return clientRect && {
left : clientRect.left + scroll.x,
right : clientRect.right + scroll.x,
top : clientRect.top + scroll.y,
bottom: clientRect.bottom + scroll.y,
width : clientRect.width || clientRect.right - clientRect.left,
height: clientRect.heigh || clientRect.bottom - clientRect.top
};
}); I had to copy the whole function from the source because I dont want to mess with the core of the plugin. -Edit: And this broke the Safari for Windows and Ipad.... I seriously dont get why... If I revert the IsIOS7 check Iphone 4 gets broken rest get fixed :) I will just have to live with it... |
What version of iOS and what browser are you using? Can you try testing on both Chrome and Firefox? |
IOS 6.1.2 with Safari on Iphone 4. I cannot update it to 7.1.2 because its an Iphone ofc.... and nothing works as it should ... |
Have you tried the other browsers yet? |
Yes. When I changed the dropzone overlap to 0.1 everything got fixed 😄 I have no idea why... |
Haha that makes sense. When overlap is used the rects of the draggable and dropzone are compared so it doesn't matter if both of them are wrong by the same amount :D I guess Thanks for your help! |
I have an issue with Iphone 4 and only it where when I scroll the page, the dropzone area (be it position:fixed or not) does not change its zone screen pixels so to speak.
Meaning: If i do not scroll, the drop place is where the html element is on the screen. But when I scroll the page the element moves up, but when dragged over, it does not register an event. If I try to imagine where the dropzone was on the screen before scroll, and I drag the element there, THEN it registers a dragover event.
I tried to recreate this on jsfiddle but without luck... I will continue to try so I can show what I mean.
The text was updated successfully, but these errors were encountered: