Ticket #1173 (closed feature: fixed)

Opened 5 years ago

Last modified 5 years ago

New vector style property "display"

Reported by: ahocevar Owned by:
Priority: minor Milestone: 2.6 Release
Component: Renderer.Elements Version: 2.5
Keywords: Cc:
State: Complete

Description

Attached is a very small patch that adds a style property "display" to vector feature style hashes. This property can be used to render a style hidden, so the feature will be invisible.

Technically speaking, features with style:display="none" will not be rendered at all. If there is a DOM node for the feature, it will be removed.

This property will be used by the upcoming styles framework to hide features that are outside the minScale/maxScale range

Attachments

style-display.diff Download (1.8 KB) - added by ahocevar 5 years ago.
styles-display-r5342.diff Download (1.8 KB) - added by ahocevar 5 years ago.
Updated patch against r5342.
patch-1173-r5438-A0.diff Download (2.8 KB) - added by elemoine 5 years ago.
Andreas' patch + tests
patch-1173-r5535-A0.diff Download (3.1 KB) - added by ahocevar 5 years ago.
Fixed patch, successfully tested in FF2 and IE6.

Change History

Changed 5 years ago by ahocevar

follow-up: ↓ 2   Changed 5 years ago by crschmidt

Hm. I'm slightly concerned about this, only because I'm worried about what happens if for some reason we have a selected feature that has its style switch to 'none' -- do I need to be worried? I'm not sure, but it's the first thing that comes to mind.

in reply to: ↑ 1   Changed 5 years ago by ahocevar

Replying to crschmidt:

Hm. I'm slightly concerned about this, only because I'm worried about what happens if for some reason we have a selected feature that has its style switch to 'none' -- do I need to be worried? I'm not sure, but it's the first thing that comes to mind.

You do not need to worry. The only thing that will happen is that the feature will disappear on select, but you can still use e.g. OpenLayers.Control.SelectFeature.unselect to unselect it.

follow-up: ↓ 4   Changed 5 years ago by elemoine

Thanks Andreas. I'm in favor for your patch.

Note that I have tests for this patch, based on pgiraud's tests for the renderers (#1128). They also rely on my fix to test_Elements.html (#1172). I'll attach a patch here once my patch for #1172 is applied to trunk.

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

Replying to elemoine:

Thanks Andreas. I'm in favor for your patch. Note that I have tests for this patch, based on pgiraud's tests for the renderers (#1128). They also rely on my fix to test_Elements.html (#1172). I'll attach a patch here once my patch for #1172 is applied to trunk.

oops, my patch to test_Elements.html is in #1184, not in #1172. Sorry for the confusion.

Changed 5 years ago by ahocevar

Updated patch against r5342.

  Changed 5 years ago by crschmidt

elemoine: #1184 is in, do you still have tests for this?

  Changed 5 years ago by crschmidt

  • keywords commit added; review removed

If we can get some tests in, I'm fine with this being committed. Eric, please pull your tests in, then go ahead and commit when you feel comfortable with it.

  Changed 5 years ago by elemoine

  • state set to Unreviewed

Will do. But I'm in the office right now and I left the patch at home :-)

  Changed 5 years ago by crschmidt

  • state changed from Unreviewed to Commit

Changed 5 years ago by elemoine

Andreas' patch + tests

  Changed 5 years ago by elemoine

I attached a patch that includes tests. I'll test it tomorrow again and commit it if all tests pass on FF and IE.

Changed 5 years ago by ahocevar

Fixed patch, successfully tested in FF2 and IE6.

  Changed 5 years ago by ahocevar

Eric, there was a minor problem in test_Elements.js. Attached patch-1173-r5535-A0.diff. Tests pass in FF2 and IE6.

  Changed 5 years ago by elemoine

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

(In [5541]) Add style property "display" to vector feature style. If display is "none" the feature won't be rendered and there's a DOM node for that feature it'll be removed. Commiting this on behalf of ahocevar. Thanks Andreas for the patch. r=crschmidt. (closes #1173).

Note: See TracTickets for help on using tickets.