Ticket #2318 (closed feature: fixed)

Opened 4 years ago

Last modified 4 years ago

move pink tiles to css

Reported by: tschaub Owned by:
Priority: minor Milestone: 2.9 Release
Component: Util Version: 2.8
Keywords: Cc:
State: Complete

Description

When image loading fails, we should set a css class on the image instead of setting the background style color.

In OpenLayers.Util.onImageLoadError, if OpenLayers.Util.onImageLoadErrorColor is null, we could add an olImageLoadError class. Then we could set OpenLayers.Util.onImageLoadErrorColor to null and create a style declaration with pink to maintain backwards compatibility.

Attachments

2318-0.patch Download (1.2 KB) - added by rdewit 4 years ago.
2318-1.patch Download (10.8 KB) - added by rdewit 4 years ago.
broken.png Download (223 bytes) - added by rdewit 4 years ago.
Goes into theme/default/img/
2318-2.broken-images.patch Download (2.8 KB) - added by rdewit 4 years ago.
This patch needs to be applied to trunk (so don't revert the old one please).

Change History

  Changed 4 years ago by rdewit

  • keywords foss4g09 added

Changed 4 years ago by rdewit

  Changed 4 years ago by rdewit

  • state set to Review

Works in FF3.5, IE6/8. Please review.

  Changed 4 years ago by rdewit

  • state changed from Review to Needs More Work

Changed 4 years ago by rdewit

  Changed 4 years ago by rdewit

  • state changed from Needs More Work to Review

Now with tests and updated examples.Relevant tests pass in FF3.5

Changed 4 years ago by rdewit

Goes into theme/default/img/

  Changed 4 years ago by ahocevar

  • keywords foss4g09 removed
  • status changed from new to closed
  • state changed from Review to Complete
  • resolution set to fixed

(In [9758]) making pink tiles a css matter. p=rdewit, r=me (closes #2318)

  Changed 4 years ago by rdewit

  • status changed from closed to reopened
  • state changed from Complete to Needs More Work
  • resolution fixed deleted

The changed behaviour with regards to the src url of the image introduces a 'usability' regression: it's not easy any more to see the error behind a broken image (by right-clicking on it and viewing the image).

Changed 4 years ago by rdewit

This patch needs to be applied to trunk (so don't revert the old one please).

follow-up: ↓ 8   Changed 4 years ago by rdewit

  • state changed from Needs More Work to Review

Patch 2318-2 reverts the setting of the src URL of the broken image. If you want to completely hide a broken image, just use the following CSS in your project:

    <style type="text/css">
        .olImageLoadError {
            opacity: 0 !important;
            filter: alpha(opacity=0) !important;
        }
    </style>

If you only want to get rid of the pink in the tiles whilst still showing that the images are broken, you can do the following:

    <style type="text/css">
        .olImageLoadError {
            border-color: transparent !important;
        }
    </style>

You only need the !important bit if you set your CSS before the OL css gets loaded.

Please review. If all is well, please remove the image that has been added with patch 2318-1 (theme/default/broken.png) from trunk.

Thanks, Roald

in reply to: ↑ 7   Changed 4 years ago by rdewit

Oops, that last block of code should have been:

    <style type="text/css">
        .olImageLoadError {
            background-color: transparent !important;
        }
    </style>

Relevant tests pass and the solution works in FF3.5, Chromium 4, IE6/8 & Opera 10.

  Changed 4 years ago by elemoine

2318-2.broken-images.patch Download looks good to me. I tested it in FF3, Safari3, IE8 and IE6. I also ran the tests in these browsers. (Tests don't pass in several places! But the failures aren't related to this particular patch). Thanks for the work rdewit.

  Changed 4 years ago by elemoine

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

(In [9771]) do not change the src of broken images, as this prevents from being able to right-click on the image and see the server error, p=rdewit, r=me (closes #2318)

  Changed 4 years ago by rdewit

  • status changed from closed to reopened
  • resolution fixed deleted

Hi elemoine, thank you for committing the patch. Could you please also remove the file theme/default/img/broken.png since it is not needed anymore? Thanks, rdewit

  Changed 4 years ago by ahocevar

  • status changed from reopened to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.