Skip to content

Conversation

@BJap
Copy link

@BJap BJap commented Sep 23, 2014

Half fixed so far. Still WIP

@BJap
Copy link
Author

BJap commented Sep 24, 2014

This of course does not cover the edge cases (literally edge) but to program more defensively, one could handle cases such as:

The element is partly off the screen: yOffset becomes Math.min(element height / 2, center to nearest vertical edge)

The element's vertical center is off screen: center is half the distance from the nearest vertical edge to the vertical edge of the element still on screen added or subtracted to that y coordinate and yOffset becomes that distance

@BJap
Copy link
Author

BJap commented Sep 24, 2014

I am ready for input, ideas, suggestions, and so on. I still am hesitant to use a hard-coded '100' value and adjust if this creates a negative coordinate for one of the outer points. Still, the if else statement is solid because an element's center cannot be less than '100' distance from both edges of the phone at the same time in worst case. This would be for instance, if the phone were to be rotated sideways and the smallest width has always been 320 points.

@Jonahss
Copy link
Member

Jonahss commented Sep 24, 2014

Couldn't you have a smaller width on an Android Wear device?

@Jonahss
Copy link
Member

Jonahss commented Sep 24, 2014

Ahh I see what you did. I like it. These are convenience methods anyways, and don't have to work in every possible case. You have certainly made them more convenient :)

@Jonahss
Copy link
Member

Jonahss commented Sep 24, 2014

Will merge after I run the test suite.

@BJap
Copy link
Author

BJap commented Sep 24, 2014

@Jonahss you're right outside of the iOS infrastructure for sure. I hadn't explored wearables yet on Android to know better haha.

Hopefully more people can use these methods. I did read the documentation but I would love for more people to be able to use them even if it's just for 'quick and dirty'. They are really good methods for sure.

Thanks! btw this is my first open-source contibution. You made this possible 👍 I hope to contribute more as I continue to use this.

Jonahss added a commit that referenced this pull request Sep 25, 2014
Fixed methods that use dimensions relative to a given WebElement
@Jonahss Jonahss merged commit d4bf1e1 into appium:master Sep 25, 2014
@Jonahss
Copy link
Member

Jonahss commented Sep 25, 2014

Congrats!
Will be included in next release, which will be soon!

@BJap BJap deleted the pinch_zoom_fix branch September 25, 2014 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants