-
Notifications
You must be signed in to change notification settings - Fork 195
Bug: problems when creating a map inside display:none element #135
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
Comments
After some research, there doesn't seem to be a way to have the correct boundary box for a text element without actually drawing it. Here are our options:
I don't like the second option. The code will become really bloated and complicated just for an edge case. Still, the first option bothers me as we will always have some users coming here asking why Mapael is not working. What do you think? |
Hello, Thank for having investigated on this issue. I agree with you, I don't like the second option and I prefer the third one too. However, I agree with you that we should warn users, as you said, through a new section "known issues" in the documentation page (or maybe in the wiki ?). But I wonder if mapael has to check that and throw an error if a user try to draw a map on a hidden container. Indeed, a fixed size map that contains no text should work fine even if drawn in an hidden div, no ? |
I fear that a user may discard mapael as "not working" if they encounter this issue while trying it, and go elsewhere. Maybe I'm thinking too much... |
If I had to choose, I would prefer throwing an explicit error than a new option 'force-hidden'. I think that in any cases there is always a way to call mapael only when the related container is shown anyway. |
Maybe you didn't understood me.
|
This is what I understood. However, I'm not fond of throwing an "optionnable" error, I think it will be misleading for the users and it will complicate the code without bringing a real solution for fixing it. Maybe we should do nothing in the code but add clear information in the documentation about this bug : after all, Raphael.js is also affected by the bug and lets its users deal with it. What do you think about it ? |
I think the main difference is that Raphael is a common low-level library, whereas Mapael is made to "ease the build of pretty [...] map". Of course, it will be your decision at the end ;-) Either way, we shall add clear information in the documentation with example and workaround. |
I'm ok with you for throwing an exception at first, and then add the option later, only if one or more users complain about not being able to add a map into an hidden div. But I confess, I'm still hesitating about this option. On the one hand, I think it's a good approach to prevent users from using the plugin in an way that is unstable. On the other, maybe some users will need to create a map in an hidden div while having no workaround to deal with it. |
I get your point. |
It's ok for me :) |
Good new, we won't even need to provide an option. The user can simply override the check by using: $.mapael.prototype.isPaperHidden = function() {return false;}; |
Well done, good new indeed ! |
Hi, I've been using Mapael for two days now. I have the same error, because I have three maps in different tabs. Only the map in the first displayed tab is drawn. The two others give me the same error as described on this thread. |
Hello Instead of using You just need to toggle the /* Default tab style, may not be needed */
.tab {
position: static;
visibility: visible;
top: 0;
left: 0;
}
/* Hidden tab style, to be toggled to show/hide tab */
.tab_hidden {
/* because display:none not compatible with Mapael */
position:absolute !important;
visibility: hidden !important;
top:-1000px !important;
left:-1000px !important;
} |
isRaphaelBBoxBugPresent: function() { |
Well, I post this here if anyone will face this issue :
|
This has been reported several times by users: #72 and #63
Here is a working example of the problem: http://jsfiddle.net/VqwUZ/361/
We hide the container, draw the map, then show the container.
As a result, no text is visible on the legend, and the map is not set to the screen width (a resize of the window is needed to force redraw).
This is related to Raphael issue DmitryBaranovskiy/raphael#760
My solution was to avoid using
display:none
and prefer using this kind of class:However, when using a CSS framework such as Bootstrap, you may not be able to change the behavior of certain element. I don't know what we can do.
The text was updated successfully, but these errors were encountered: