heremaps / here-sdk-examples

Android, iOS and Flutter example apps for the HERE SDK 4.x (Lite Edition, Explore Edition, Navigate Edition)
https://developer.here.com/products/here-sdk
Apache License 2.0
171 stars 135 forks source link

Camera Principal Point dosent work at 4.14 version #239

Closed pedroicandido closed 1 year ago

pedroicandido commented 1 year ago

Hey, guys! I'm having trouble trying set camera principal point. In the 4.12.7 version it was working, but when upgrading to 4.14 stopped. Can anyone help me? The code i`m using is the same of the link: https://developer.here.com/documentation/flutter-sdk-explore/4.13.5.0/dev_guide/topics/camera.html#change-the-tranform-center

HERE-SDK-Support-Team commented 1 year ago

Thanks, @pedroicandido. We will take a look.

HERE-SDK-Support-Team commented 1 year ago

Hi @pedroicandido, we tried to reproduce the issue with the _cameraapp example. If you add the code as shown in the guide it still works. Please also check if the _hereMapController.viewportSize is as expected when you execute the code. In case no render target is attached to it yet, width and height will be 0.

If you can still reproduce the issue, please provide more details how you experienced the issue. Thanks. Hope this helps.

pedroicandido commented 1 year ago

Hey @HERE-SDK-Support-Team, apologies for the delay! I tried again, but it still has the same error. I recorded two videos to show the behavior: The first one, is the old version, that works fine:

https://github.com/heremaps/here-sdk-examples/assets/49328524/0e78dd32-20dc-4740-ba7f-74522a99176a

the second, is the latest sdk version, 4.14.2:

https://github.com/heremaps/here-sdk-examples/assets/49328524/18788e01-86a8-4f5e-8d5c-ee7eb1f42d73

As we can see, the two versions has the _hereMapController.viewportSize values, but in the latest version the camera does not behave as it should. There was no code change, just the sdk change.

HERE-SDK-Support-Team commented 1 year ago

Hi @pedroicandido,

thanks for the feedback. When using the visual navigator, this is different, as the navigator controls the principal point. When you want to use a custom principal point during tbt, you have to set this for the camera behavior and not the map view:

      FixedCameraBehavior fixedCameraBehavior = FixedCameraBehavior();
      _visualNavigator.cameraBehavior = fixedCameraBehavior;

      // Repositions principal point higher than default during navigation.
      Anchor2D newTransformCenter = Anchor2D.withHorizontalAndVertical(0.5, 0.5);
      fixedCameraBehavior.normalizedPrincipalPoint = newTransformCenter;

In earlier HERE SDK versions, indeed this was not possible and customers tried to alter the pp via map view which led to issues.

Hope this helps.

pedroicandido commented 1 year ago

THAAANKS @HERE-SDK-Support-Team

This worked perfectly! Thanks a lot for the help!