OpenLayers OpenLayers

Ticket #2318 (closed feature: fixed)

Opened 5 months ago

Last modified 5 months ago

move pink tiles to css

Reported by: tschaub Assigned to:
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 (1.2 kB) - added by rdewit on 10/23/09 18:14:03.
2318-1.patch (10.8 kB) - added by rdewit on 10/23/09 21:31:38.
broken.png (223 bytes) - added by rdewit on 10/23/09 21:37:48.
Goes into theme/default/img/
2318-2.broken-images.patch (2.8 kB) - added by rdewit on 10/26/09 19:22:25.
This patch needs to be applied to trunk (so don't revert the old one please).

Change History

10/23/09 07:25:55 changed by rdewit

  • keywords set to foss4g09.

10/23/09 18:14:03 changed by rdewit

  • attachment 2318-0.patch added.

10/23/09 18:16:59 changed by rdewit

  • state set to Review.

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

10/23/09 18:52:19 changed by rdewit

  • state changed from Review to Needs More Work.

10/23/09 21:31:38 changed by rdewit

  • attachment 2318-1.patch added.

10/23/09 21:34:18 changed by rdewit

  • state changed from Needs More Work to Review.

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

10/23/09 21:37:48 changed by rdewit

  • attachment broken.png added.

Goes into theme/default/img/

10/24/09 00:57:42 changed by ahocevar

  • keywords deleted.
  • 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)

10/26/09 19:21:19 changed by rdewit

  • status changed from closed to reopened.
  • state changed from Complete to Needs More Work.
  • resolution 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).

10/26/09 19:22:25 changed by rdewit

  • attachment 2318-2.broken-images.patch added.

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

(follow-up: ↓ 8 ) 10/26/09 19:30:43 changed 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 ) 10/26/09 20:29:12 changed 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.

11/02/09 03:51:46 changed by elemoine

2318-2.broken-images.patch 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.

11/02/09 03:55:20 changed 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)

11/02/09 07:21:24 changed by rdewit

  • status changed from closed to reopened.
  • resolution 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

11/03/09 00:53:29 changed by ahocevar

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