[added] toPolar operator
Needs ReviewPublic

Authored by appsforartists on Nov 1 2017, 9:36 PM.

Details

Summary

This is useful for building marking menus. Like distanceFrom, it accepts an origin$ argument, which allows us to ensure it can only be called on Observable<Point2D>. (Another solution would have been point$.subtractedBy(origin$).toPoint(), but without the argument, we can't constrain T).

I inlined the Pythagorean theorem rather than returning combineLatest({ distance: this.distanceFrom(origin$), angle: … }) to avoid emitting separately for each of distance and angle.

Part of https://github.com/material-motion/material-motion-js/issues/231

Diff Detail

Repository
R13 material-motion/material-motion-js
Branch
marking-menu (branched from develop)
Lint
Lint OK
Unit
No Unit Test Coverage
appsforartists created this revision.Nov 1 2017, 9:36 PM
Restricted Application added a reviewer: O2: Material Motion. · View Herald TranscriptNov 1 2017, 9:36 PM
Restricted Application added a project: Material Motion. · View Herald Transcript
Restricted Application added a reviewer: O3: Material JavaScript platform reviewers. · View Herald Transcript
Restricted Application added a reviewer: Material Motion. · View Herald Transcript
appsforartists planned changes to this revision.Nov 1 2017, 9:36 PM
Restricted Application failed to build Restricted Buildable!Nov 1 2017, 9:39 PM

Added origin$ argument

appsforartists edited the summary of this revision. (Show Details)Nov 1 2017, 10:21 PM
Restricted Application completed building Restricted Buildable.Nov 2 2017, 1:35 AM