Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange + and - characters on zoom controls #164

Closed
csmale opened this issue Nov 23, 2012 · 14 comments
Closed

Strange + and - characters on zoom controls #164

csmale opened this issue Nov 23, 2012 · 14 comments

Comments

@csmale
Copy link

csmale commented Nov 23, 2012

Don't know if it is just me, but on the "+" and "-" zoom controls there seems to be a small "+"/"-" text character overlaid on the graphic, which (if you look closely) gains an underline on a mouseover.

@tomhughes
Copy link
Member

You're quite right - it is because the zoom controls are generated as links with +/- as the text which are then supposed to be styled to generate the actual buttons.

But @jfirebaugh used a different style that uses images instead, but the text is still there, and I don't see any way of getting rid of it just with styling...

@tomhughes
Copy link
Member

So it was OK until I updated zoomslider to fix IE8 which also pulled in kartena/Leaflet.zoomslider@40adeee which assigns the text to those links and causes this breakage.

What I'm unclear about is how zoomslider was generating it's default icons before that...

@jfirebaugh
Copy link
Member

One possible fix is:

.leaflet-control-zoomslider-in,
.leaflet-control-zoomslider-out {
  text-indent: -9999px;
}

@tomhughes
Copy link
Member

I've pushed 5edb4bf as a workaround for now.

@jfirebaugh
Copy link
Member

Prior to kartena/Leaflet.zoomslider@fcd9662 the zoomslider was using pngs for +/-.

@tomhughes
Copy link
Member

Pushed 4a26107 based on @jfirebaugh's text-indent idea.

@smsm1
Copy link
Contributor

smsm1 commented Nov 23, 2012

Actually there is a better method than using the -9999px hack, which causes performance issues as the browser has to draw a box that far off screen.

.hide-text {
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}

take from:
http://www.zeldman.com/2012/03/01/replacing-the-9999px-hack-new-image-replacement/ which has the explanation of why you should avoid the -9999px hack.

@smsm1
Copy link
Contributor

smsm1 commented Nov 23, 2012

http://37signals.com/svn/posts/3126-another-9999px is another explanation and slight variation.

@ghost
Copy link

ghost commented Nov 23, 2012

Hi all! I'm the maintainer of Leaflet.zoomslider at Kartena.
Because of some awesome patches from Bryan Shelton I've started to update the zoomslider for the coming 0.5 release, these changes are all happening in master. I'd recommend to follow the new 0.4 branch for now, which is tracking Leaflet 0.4.x.
This hasn't really been announced in any serious way, sorry about that. I'll add a note about this in README.md.

@tomhughes
Copy link
Member

The extra complication is that the version of leaflet we're using isn't really 0.4 or 0.5 at the moment, but rather some random commit from the master branch ;-)

@ghost
Copy link

ghost commented Nov 23, 2012

:) I see. Been there.
But ok, I think either adding an option to not set the +/- as chars or to do something like this:

if(link.style.background.match("url(") == null) { // or null, undefined or whatever
link.innerHtml = plusOrMinus;
} 

...would be the correct fix.

@tyrasd
Copy link
Member

tyrasd commented Nov 24, 2012

The modified workaround introduced in 3d40181 doesn't seem to fix this properly (Opera, Chrome still render the +/- icons). This is because it doesn't really make sense to use text-indent with a percentage value when the containing block does have a width of 0 (see specs).

But, as we already know the width of the object in question, one could simply use that fixed value text-indent: 26px. Also, white-space: nowrap is not needed, when the text to hide doesn't contain any whitespace.

@mattiasb
Copy link

I'll probably implement the option later today, meanwhile if you have a suggestion for a name... :)

@ghost
Copy link

ghost commented Nov 27, 2012

Merged a fix for this now that moves the +/- symbols into the CSS instead (where it is more easily overridable).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants