Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected animation when changing Shape's fill color #692

Closed
devpolant opened this issue Jun 1, 2020 · 3 comments
Closed

Unexpected animation when changing Shape's fill color #692

devpolant opened this issue Jun 1, 2020 · 3 comments
Milestone

Comments

@devpolant
Copy link
Contributor

Precondition

  • I have the following code to change node's fill color by tap on it:
guard let node = svgView.node.nodeBy(tag: nodeId) as? Shape else {
    return
}
node.onTap { [weak self] _ in
    guard let self = self, let node = self.svgView.node.nodeBy(tag: nodeId) as? Shape else {
        return
    }
    let color = node.fill != self.selectedColor ? self.selectedColor : self.normalColor
    node.fillVar.animate(to: color, during: 0.3)
}

Problem

  • Node is scaling and translating as you could see at the following video:

Demo project

  • Please download this demo project with reproduced issue:
    SVGDemo.zip
  • Do you have any idea how to resolve this issue? Thanks in advance!
@f3dm76
Copy link
Collaborator

f3dm76 commented Jun 2, 2020

Hello @AntonPoltoratskyi , thank you very much for your report, and a working example. Just wanted to let you know we started working on this issue, and will let you know once it's fixed. Have a great day!

@ystrot ystrot closed this as completed in d89e204 Jun 3, 2020
ystrot added a commit that referenced this issue Jun 3, 2020
Fix #692: Consider layout transform in findNode
@f3dm76
Copy link
Collaborator

f3dm76 commented Jun 3, 2020

Greetings @AntonPoltoratskyi ! Glad to let you know the issue is resolved, the fix will be included in future release, but for now please kindly check out the master Macaw branch. Could I also ask you a favour - may I please use your svg file (and basically the idea to highlight pieces on tap) to add a new example to Macaw?

@devpolant
Copy link
Contributor Author

Thanks a lot! Sure, you can use it - it is downloaded from open source https://www.amcharts.com/svg-maps/?map=argentina. Original idea is from this tutorial https://medium.com/@fede_nieto/interactive-svg-images-in-swift-with-macaw-1b0d7875511f but color was updated without animation there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants