Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
refs #5983: gate all viewport changes with equality check first
Browse files Browse the repository at this point in the history
  • Loading branch information
incanus committed Aug 16, 2016
1 parent 56e39b5 commit 4ef336e
Showing 1 changed file with 175 additions and 32 deletions.
Loading

3 comments on commit 4ef336e

@incanus
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re: all your commit comments here to date @1ec5, per 4ef336e#commitcomment-18678302 I am trying more to introduce a pattern of checking the viewport using utility methods rather than doing all sorts of potentially lengthy direct comparisons right in each setter.

@1ec5
Copy link
Contributor

@1ec5 1ec5 commented on 4ef336e Aug 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that approach is untenable for the time being, given #2259. Furthermore, this approach merely adds more boilerplate code and points of failure for any given check. If we only discovered #2259 once this branch lands, we’d have a wild goose chase involving power consumption before understanding the root cause.

@1ec5
Copy link
Contributor

@1ec5 1ec5 commented on 4ef336e Aug 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, there’s no need for lengthy direct comparisons: in -setDirection:, you only need to check whether the new direction equals the old one – no need to look at the rest of the state. This is a best practice for writing a setter, anyways. If you want to be sure that calling easeTo() with the same camera options results in no animation, that would be an ideal candidate for an mbgl unit test.

Please sign in to comment.