[core] Cleaned up Transform
Eliminated many redundant methods on Transform. Minimized usage of TransformState::x and TransformState::y. Added convenient constructors for AnimationOptions. When scaling, passing in view’s origin as the anchor no longer anchors the scaling operation at the view’s center. To specify no anchor, use NaN. Increased precision of worldSize(), now that it’s used much more heavily in transform methods.
This commit is contained in:
committed by
Minh Nguyễn
parent
27b308a234
commit
d26b956a48
@@ -59,6 +59,13 @@ struct AnimationOptions {
|
||||
/** A function that is called once on the last frame of the transition, just
|
||||
before the corresponding screen update. */
|
||||
std::function<void()> transitionFinishFn;
|
||||
|
||||
/** Creates an animation with no options specified. */
|
||||
inline AnimationOptions() {}
|
||||
|
||||
/** Creates an animation with the specified duration. */
|
||||
inline AnimationOptions(Duration d)
|
||||
: duration(d) {}
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -111,8 +111,8 @@ public:
|
||||
void resetPosition();
|
||||
|
||||
// Scale
|
||||
void scaleBy(double ds, const PrecisionPoint& = { 0, 0 }, const Duration& = Duration::zero());
|
||||
void setScale(double scale, const PrecisionPoint& = { 0, 0 }, const Duration& = Duration::zero());
|
||||
void scaleBy(double ds, const PrecisionPoint& = { NAN, NAN }, const Duration& = Duration::zero());
|
||||
void setScale(double scale, const PrecisionPoint& = { NAN, NAN }, const Duration& = Duration::zero());
|
||||
double getScale() const;
|
||||
void setZoom(double zoom, const Duration& = Duration::zero());
|
||||
double getZoom() const;
|
||||
|
||||
Reference in New Issue
Block a user