Skip to content

Commit

Permalink
Fix animation of small watch hands (don't zoom)
Browse files Browse the repository at this point in the history
  • Loading branch information
thirtythreeforty committed Jun 16, 2016
1 parent 2b24961 commit 3a0ef93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/face_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ static void draw_path_with(GContext *ctx, GPath* path, uint8_t stroke_width, GCo
gpath_draw_outline(ctx, path);
}

FaceLayer::Hand::Hand(Boulder::Layer& layer, const GPathInfo *path_info, GPoint center)
FaceLayer::Hand::Hand(Boulder::Layer& layer, const GPathInfo *path_info, GPoint center, bool large)
: angle(0, 1000)
, scale(0, 1000)
, scale(large ? 0 : ANIMATION_NORMALIZED_MAX, 1000)
, path(path_info)
, layer(layer)
{
Expand All @@ -23,7 +23,9 @@ FaceLayer::Hand::Hand(Boulder::Layer& layer, const GPathInfo *path_info, GPoint
gpath_move_to(path, center);

// initial state of scale does not trigger a callback
path.scale(0);
if(large) {
path.scale(0);
}
}

void FaceLayer::Hand::zoom(bool in)
Expand All @@ -48,9 +50,9 @@ void FaceLayer::Hand::on_animated_update(void *animated)

FaceLayer::FaceLayer(GRect frame, bool large)
: Layer(frame)
, hour_hand(*this, large ? &hour_hand_path : &small_hour_hand_path, grect_center_point(&frame))
, min_hand(*this, large ? &minute_hand_path : &small_minute_hand_path, grect_center_point(&frame))
, sec_hand(*this, large ? &second_hand_path : &small_second_hand_path, grect_center_point(&frame))
, hour_hand(*this, large ? &hour_hand_path : &small_hour_hand_path, grect_center_point(&frame), large)
, min_hand(*this, large ? &minute_hand_path : &small_minute_hand_path, grect_center_point(&frame), large)
, sec_hand(*this, large ? &second_hand_path : &small_second_hand_path, grect_center_point(&frame), large)
, large(large)
{
hour_hand.zoom(true);
Expand Down
2 changes: 1 addition & 1 deletion src/face_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class FaceLayer final: public Boulder::Layer
Boulder::Layer& layer;

public:
Hand(Boulder::Layer& layer, const GPathInfo *path_info, GPoint center);
Hand(Boulder::Layer& layer, const GPathInfo *path_info, GPoint center, bool large);

inline void set_angle(angle_t a) { angle = a; }
void zoom(bool in);
Expand Down

0 comments on commit 3a0ef93

Please sign in to comment.