Ticket #2596 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

Rotated graphics are positioned incorrectly when moved or zoom changes

Reported by: ahocevar Owned by: ahocevar
Priority: major Milestone: 2.9.1 Release
Component: Renderer.SVG Version: 2.9
Keywords: Cc:
State: Pullup

Description

See http://openlayers.org/pipermail/users/2010-April/017517.html.

This is a regression which was introduced with [10135].

The attached patch fixes the issue.

Attachments

openlayers-2596.patch Download (0.5 KB) - added by ahocevar 3 years ago.

Change History

Changed 3 years ago by ahocevar

  Changed 3 years ago by ahocevar

Tests still pass. Thanks for any review.

  Changed 3 years ago by elemoine

if ((rotation !== undefined || node._rotation !== rotation) && pos)

why isn't it

if (rotation !== undefined && node._rotation !== rotation && pos)

instead?

At a quick glance it'd make more sense to me, but you know this code better than me Andreas.

follow-up: ↓ 5   Changed 3 years ago by ahocevar

Eric: if it was like you propose, we would not gain much from the current situation: nodes that are already rotated would not get new transformation parameters with their new position (pos). What we need to do is:

  • draw when a rotation is set (rotation !== undefined)
  • draw when rotation is not set any more, but was set previously (rotation === undefined, but node._rotation !== rotation)

Makes sense?

  Changed 3 years ago by ahocevar

"draw" in the above context means "set new transformation parameters"

in reply to: ↑ 3   Changed 3 years ago by elemoine

  • state changed from Review to Commit

I better understand the issue now, thanks for the explanation.

I guess we could also do

if((rotation !== undefined || node._rotation !== undefined) && pos)

I personally prefer the above construct, but it may be just me.

Anyway, if your patch workd for people who have encountered the issue and if the tests still pass in FF3, please commit with your preferred construct.

follow-up: ↓ 7   Changed 3 years ago by bartvde

Andreas, do you think we should create a 2.9.1 release to fix this issue? My initial reaction would be that this warrants a 2.9.1 release. We've never done point fix releases though in the past, so I am not sure what the policy is.

in reply to: ↑ 6   Changed 3 years ago by elemoine

Replying to bartvde:

Andreas, do you think we should create a 2.9.1 release to fix this issue? My initial reaction would be that this warrants a 2.9.1 release. We've never done point fix releases though in the past, so I am not sure what the policy is.

Bart, I think this deserves reopening that discussion on the dev mailing list.

  Changed 3 years ago by ahocevar

  • status changed from new to closed
  • state changed from Commit to Complete
  • resolution set to fixed

(In [10258]) fixed a regression that caused incorrect positioning of rotated graphics when they are not rendered for the 1st time. r=elemoine (closes #2596)

  Changed 3 years ago by bartvde

  • status changed from closed to reopened
  • state changed from Complete to Pullup
  • resolution fixed deleted
  • milestone changed from 2.10 Release to 2.9.1 Release

  Changed 3 years ago by bartvde

  • status changed from reopened to closed
  • resolution set to fixed

Pulled up to 2.9 branch in r10265

  Changed 3 years ago by rautec

  • status changed from closed to reopened
  • resolution fixed deleted
  • summary changed from Rotated graphics are positioned incorrectly when moved or zoom changes to Rotated graphics are positioned incorrectly after zoom changes in IE

in my application I have features which have to be drawn rotated and with offset. after updating to OL 2.9.1 it works fine in all browser, but IE (does not matter if IE 6/7/8). I even tried it by modifying the OL example on http://openlayers.org/dev/examples/vector-features.html by adding a rotation with style_mark.rotation = 60 to figure out the problem.

Initially the feature is positioned correctly, but after zooming the feature is drawn wrong - seems that the rotation is ignored at the redrawing after zoom!

  Changed 3 years ago by ahocevar

  • status changed from reopened to closed
  • resolution set to fixed
  • summary changed from Rotated graphics are positioned incorrectly after zoom changes in IE to Rotated graphics are positioned incorrectly when moved or zoom changes

@rautec: Please create a new ticket for new issues. This ticket was about Renderer.SVG (see "Component" below), which is not used in IE. I have created #2733 for your issue.

Note: See TracTickets for help on using tickets.