Ticket #1836 (closed bug: fixed)

Opened 5 years ago

Last modified 4 years ago

non symetric graphicName symbols rendered symetric in IE

Reported by: pgiraud Owned by: pgiraud
Priority: minor Milestone: 2.9 Release
Component: Renderer.VML Version: 2.8
Keywords: Cc:
State: Complete

Description

A rectangle graphicName symbol appears like a square in IE (VML). I think this is something related to coordorigin and coordsize. I'm digging into it, and hope I'll be able to provide a patch soon.

OpenLayers.Renderer.symbol.rectangle = [0,0, 10,0, 10,4, 0,4, 0,0];

Attachments

patch-1836.diff Download (2.5 KB) - added by pgiraud 5 years ago.
patch with extended example
1836-r8924-A1.patch Download (4.5 KB) - added by ahocevar 4 years ago.
aspect.patch Download (4.6 KB) - added by ahocevar 4 years ago.
leaner, faster and breaks nothing
openlayers-1836.patch Download (2.4 KB) - added by ahocevar 4 years ago.

Change History

Changed 5 years ago by pgiraud

patch with extended example

Changed 5 years ago by pgiraud

  • state set to Review

In the VML graphicName manager, we were calling drawCircle even if the symbol was not symetric. The size (width and height) and position (top and left) computation code was effectless as everything was recalculated in the drawCircle method.

Please review the patch.

I think there is still some work to do to factorize part of the code also used for externalGraphic.

Changed 5 years ago by pgiraud

  • type changed from feature to bug

Changed 4 years ago by ahocevar

Changed 4 years ago by ahocevar

  • milestone set to 2.8 Release

The attached patch does the refactoring proposed by fredj. Visual tests pass. Thanks for any review.

Changed 4 years ago by ahocevar

  • owner changed from ahocevar to fredj

I can confirm that fredj's patch does the right thing, but I refactored it to factor out the aspect ratio related stuff that external graphics have already been using into a separate function. So I think someone else should review this now.

Changed 4 years ago by pgiraud

  • owner changed from fredj to pgiraud

Reassigned to me as I was the one who fist proposed a patch. Andreas, I'll look into it tomorrow morning. Thanks.

Changed 4 years ago by pgiraud

  • state changed from Review to Commit

Your factorization patch looks fine. If you can confirm that tests are still OK, you can go ahead and commit. Thanks

Changed 4 years ago by ahocevar

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

(In [9026]) Preserve aspect ratio for custom symbols in the vml renderer. Original patch by fredj, refactored by me, r=pgiraud. (closes #1836)

Changed 4 years ago by ahocevar

  • status changed from closed to reopened
  • resolution fixed deleted

This changeset breaks rotation of external graphics (see styles-rotation example).

Changed 4 years ago by ahocevar

leaner, faster and breaks nothing

Changed 4 years ago by ahocevar

  • state changed from Complete to Review

aspect.path solves the issue with a different approach: symbols in the symbol cache will always have a square extent, not a rectangle. This saves us some calculation and therefore makes rendering even a bit faster.

Changed 4 years ago by ahocevar

Relevant tests still pass in IE. Please review.

Changed 4 years ago by pgiraud

  • state changed from Review to Commit

OK, I checked the code out and this looks pretty good. I can confirm that this now works in IE6. You can commit.

Changed 4 years ago by ahocevar

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

(In [9217]) fixed aspect ratio rendering in IE to not break rotation any more. r=pgiraud (closes #1836)

Changed 4 years ago by openlayers

  • status changed from closed to reopened
  • resolution fixed deleted

Looks like there is a typo in aspect.patch, within importSymbol function. When the diff is negative, the symbol's width is decreased, and it will never be equal to the symbol's height. This leads to incorrect sizing of symbols which height is larger than the width.

I think this code

            symbolExtent.left = symbolExtent.left + diff;
            symbolExtent.right = symbolExtent.right - diff;

is the correct solution.

Sorry, I don't (and shall not) provide any patch. I've no time for this.

Changed 4 years ago by ahocevar

Changed 4 years ago by ahocevar

  • state changed from Complete to Review
  • version changed from 2.7 to 2.8
  • milestone changed from 2.8 Release to 2.9 Release

I created a patch for this, with tests and visual tests to make sure that everything works as expected now.

Note that the failing test in IE is due to #2198, which also has a patch that is awaiting review.

Please review (and maybe also review #2198). Thanks!

Changed 4 years ago by ahocevar

And thanks anonymous for making us aware of this issue.

Changed 4 years ago by ahocevar

  • state changed from Review to Needs More Work

There are still issues. The following symbols render incorrectly in IE:

[2,0, 4,5, 0,5, 2,0]
[0.5,0, 10,8, 0,8, 0.5,0]

Better patches are welcome...

Changed 4 years ago by ahocevar

  • state changed from Needs More Work to Review

The patch is ok. According to http://openlayers.org/pipermail/users/2009-September/013826.html. IE just does not like floats and behaves better with larger numbers. So for the above definitions, equal symbols defined as follows will work:

[20,0, 40,50, 0,50, 20,0]
[5,0, 100,80, 0,80, 5,0]

Setting this to Review again.

Changed 4 years ago by pgiraud

  • state changed from Review to Commit

Your patch looks good, you can commit.

Changed 4 years ago by ahocevar

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

(In [9665]) Fix for rendering custom symbols with aspect ratio differnt than 1. r=pgiraud (closes #1836)

Note: See TracTickets for help on using tickets.