I was trying to maintain my own transform state and update it incrementally with zoom events. This was so that I can maintain a history of zoom states and switch between them (go back and next).
I was hoping to use the zoom event similar to the scaleBy and translateBy functions. This requires resetting the transform for the node at the end of each event. However, I noticed that when the event is fired again, the transform contained in e.transform does not care about the existing transform of the node. It gives a transform that keeps growing larger and larger.
I asked a question on here on stackoverflow. The answer works but is quite hacky.
Can the zoom event be made to honor the current zoom transform? Can the transform be reset without firing an event and creating an infinite loop?
I was trying to maintain my own transform state and update it incrementally with zoom events. This was so that I can maintain a history of zoom states and switch between them (go back and next).
I was hoping to use the zoom event similar to the
scaleBy
andtranslateBy
functions. This requires resetting the transform for the node at the end of each event. However, I noticed that when the event is fired again, the transform contained ine.transform
does not care about the existing transform of the node. It gives a transform that keeps growing larger and larger.I asked a question on here on stackoverflow. The answer works but is quite hacky.
Can the zoom event be made to honor the current zoom transform? Can the transform be reset without firing an event and creating an infinite loop?