diff --git a/drape_frontend/animation/follow_animation.cpp b/drape_frontend/animation/follow_animation.cpp index eddfa3fdc7..055db50f41 100644 --- a/drape_frontend/animation/follow_animation.cpp +++ b/drape_frontend/animation/follow_animation.cpp @@ -140,4 +140,9 @@ bool MapFollowAnimation::HasScale() const return m_scaleInterpolator.IsActive(); } +bool MapFollowAnimation::HasPixelOffset() const +{ + return m_pixelPosInterpolator.IsActive(); +} + } // namespace df diff --git a/drape_frontend/animation/follow_animation.hpp b/drape_frontend/animation/follow_animation.hpp index d5fa8ba4fa..bf83492139 100644 --- a/drape_frontend/animation/follow_animation.hpp +++ b/drape_frontend/animation/follow_animation.hpp @@ -47,6 +47,7 @@ public: bool GetProperty(TObject object, TProperty property, PropertyValue & value) const override; bool HasScale() const; + bool HasPixelOffset() const; private: double CalculateDuration() const; diff --git a/drape_frontend/user_event_stream.cpp b/drape_frontend/user_event_stream.cpp index ca053cd3ce..116b2e6777 100644 --- a/drape_frontend/user_event_stream.cpp +++ b/drape_frontend/user_event_stream.cpp @@ -322,6 +322,18 @@ bool UserEventStream::SetScale(m2::PointD const & pxScaleCenter, double factor, if (isAnim) { + auto const & followAnim = m_animationSystem.FindAnimation(Animation::MapFollow); + if (followAnim != nullptr) + { + // Scaling is not possible if current follow animation does pixel offset. + if (followAnim->HasPixelOffset()) + return false; + + // Reset follow animation with scaling if we apply scale explicitly. + if (followAnim->HasScale()) + ResetAnimations(Animation::MapFollow); + } + m2::PointD glbScaleCenter = m_navigator.PtoG(m_navigator.P3dtoP(scaleCenter)); if (m_listener) m_listener->CorrectGlobalScalePoint(glbScaleCenter); @@ -335,11 +347,6 @@ bool UserEventStream::SetScale(m2::PointD const & pxScaleCenter, double factor, m_listener->OnAnimatedScaleEnded(); }); - // Reset follow animation with scaling if we apply scale explicitly. - auto const & followAnim = m_animationSystem.FindAnimation(Animation::MapFollow); - if (followAnim != nullptr && followAnim->HasScale()) - ResetAnimations(Animation::MapFollow); - m_animationSystem.CombineAnimation(move(anim)); return false; } diff --git a/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj b/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj index 2ac290d4bf..649c2296a9 100644 --- a/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj +++ b/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj @@ -30,6 +30,10 @@ 454C19BB1CCE3EC0002A2C86 /* animation_constants.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 454C19B81CCE3EC0002A2C86 /* animation_constants.hpp */; }; 454C19BC1CCE3EC0002A2C86 /* animation_system.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 454C19B91CCE3EC0002A2C86 /* animation_system.cpp */; }; 454C19BD1CCE3EC0002A2C86 /* animation_system.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 454C19BA1CCE3EC0002A2C86 /* animation_system.hpp */; }; + 45B4B8CB1CF5C16B00A54761 /* screen_animations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45B4B8C71CF5C16B00A54761 /* screen_animations.cpp */; }; + 45B4B8CC1CF5C16B00A54761 /* screen_animations.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 45B4B8C81CF5C16B00A54761 /* screen_animations.hpp */; }; + 45B4B8CD1CF5C16B00A54761 /* screen_operations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45B4B8C91CF5C16B00A54761 /* screen_operations.cpp */; }; + 45B4B8CE1CF5C16B00A54761 /* screen_operations.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 45B4B8CA1CF5C16B00A54761 /* screen_operations.hpp */; }; 56BF56DA1C7608C0006DD7CB /* choose_position_mark.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 56BF56D81C7608C0006DD7CB /* choose_position_mark.cpp */; }; 56BF56DB1C7608C0006DD7CB /* choose_position_mark.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 56BF56D91C7608C0006DD7CB /* choose_position_mark.hpp */; }; 56D545661C74A44900E3719C /* overlay_batcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 56D545641C74A44900E3719C /* overlay_batcher.cpp */; }; @@ -225,6 +229,10 @@ 454C19B81CCE3EC0002A2C86 /* animation_constants.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = animation_constants.hpp; sourceTree = ""; }; 454C19B91CCE3EC0002A2C86 /* animation_system.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = animation_system.cpp; sourceTree = ""; }; 454C19BA1CCE3EC0002A2C86 /* animation_system.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = animation_system.hpp; sourceTree = ""; }; + 45B4B8C71CF5C16B00A54761 /* screen_animations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = screen_animations.cpp; sourceTree = ""; }; + 45B4B8C81CF5C16B00A54761 /* screen_animations.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = screen_animations.hpp; sourceTree = ""; }; + 45B4B8C91CF5C16B00A54761 /* screen_operations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = screen_operations.cpp; sourceTree = ""; }; + 45B4B8CA1CF5C16B00A54761 /* screen_operations.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = screen_operations.hpp; sourceTree = ""; }; 56BF56D81C7608C0006DD7CB /* choose_position_mark.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = choose_position_mark.cpp; sourceTree = ""; }; 56BF56D91C7608C0006DD7CB /* choose_position_mark.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = choose_position_mark.hpp; sourceTree = ""; }; 56D545641C74A44900E3719C /* overlay_batcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = overlay_batcher.cpp; sourceTree = ""; }; @@ -430,6 +438,10 @@ 670947411BDF9B99005014C0 /* drape_frontend */ = { isa = PBXGroup; children = ( + 45B4B8C71CF5C16B00A54761 /* screen_animations.cpp */, + 45B4B8C81CF5C16B00A54761 /* screen_animations.hpp */, + 45B4B8C91CF5C16B00A54761 /* screen_operations.cpp */, + 45B4B8CA1CF5C16B00A54761 /* screen_operations.hpp */, 454C19B81CCE3EC0002A2C86 /* animation_constants.hpp */, 454C19B91CCE3EC0002A2C86 /* animation_system.cpp */, 454C19BA1CCE3EC0002A2C86 /* animation_system.hpp */, @@ -673,6 +685,7 @@ 452C9ED91CEDCF3200A55E57 /* follow_animation.hpp in Headers */, 670947A01BDF9BE1005014C0 /* message_queue.hpp in Headers */, 452C9ED51CEDCF3200A55E57 /* animation.hpp in Headers */, + 45B4B8CE1CF5C16B00A54761 /* screen_operations.hpp in Headers */, 670947C71BDF9BE1005014C0 /* text_layout.hpp in Headers */, 670948791BDF9C7F005014C0 /* glyph_cache.hpp in Headers */, 670947FF1BDF9BF5005014C0 /* batchers_pool.hpp in Headers */, @@ -752,6 +765,7 @@ 6709484A1BDF9C48005014C0 /* ruler_helper.hpp in Headers */, 6743D36E1C3A9F090095054B /* arrow3d.hpp in Headers */, 670947B81BDF9BE1005014C0 /* route_builder.hpp in Headers */, + 45B4B8CC1CF5C16B00A54761 /* screen_animations.hpp in Headers */, 670948751BDF9C7F005014C0 /* geometry_processors.hpp in Headers */, 6709487A1BDF9C7F005014C0 /* icon_info.hpp in Headers */, 670948151BDF9C39005014C0 /* base_interpolator.hpp in Headers */, @@ -867,6 +881,7 @@ 670947BD1BDF9BE1005014C0 /* rule_drawer.cpp in Sources */, 6709481E1BDF9C39005014C0 /* show_hide_animation.cpp in Sources */, F6B283131C1B04680081957A /* gps_track_shape.cpp in Sources */, + 45B4B8CB1CF5C16B00A54761 /* screen_animations.cpp in Sources */, 6709483D1BDF9C48005014C0 /* copyright_label.cpp in Sources */, 670947C81BDF9BE1005014C0 /* text_shape.cpp in Sources */, 670947CC1BDF9BE1005014C0 /* tile_info.cpp in Sources */, @@ -892,6 +907,7 @@ 670947B91BDF9BE1005014C0 /* route_renderer.cpp in Sources */, 670E393C1C46C59000E9C0A6 /* color_constants.cpp in Sources */, 677A2DE51C0DD55D00635A00 /* requested_tiles.cpp in Sources */, + 45B4B8CD1CF5C16B00A54761 /* screen_operations.cpp in Sources */, 670947B31BDF9BE1005014C0 /* render_group.cpp in Sources */, 675D21911BFB871D00717E4F /* text_engine.cpp in Sources */, 670947FE1BDF9BF5005014C0 /* batchers_pool.cpp in Sources */,