Skip to content

Fix tick placement for some legacy browsers #472

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

Closed
evanmcallaway opened this issue Dec 7, 2016 · 7 comments
Closed

Fix tick placement for some legacy browsers #472

evanmcallaway opened this issue Dec 7, 2016 · 7 comments

Comments

@evanmcallaway
Copy link

Some legacy browsers do not position tick labels correctly because they require the prefixed version of the transform rule but otherwise work fine. My primary target is Chrome 34 because some folks still use it for NPAPI support. I propose adding a mixin that automatically adds all the prefixed transform rules for us.

I've forked, made the change, and tested. Good to open a PR?

@ValentinH
Copy link
Member

Yes why not. I have also used a PostCSS plugin to prefix all the stuff that can be integrated in the Grunt pipeline. It might be easier to maintain don't you think?

@evanmcallaway
Copy link
Author

Automatic prefixing sounds like a win to me.

In either case we also need to modify the transform style that we're adding in updateTicksScale() to include prefixes.

@ValentinH
Copy link
Member

Indeed, I forgot the updateTicksScale part... It will be more complicated to handle all the prefix for it.

@ValentinH
Copy link
Member

Fix released via 5.8.9

@ValentinH
Copy link
Member

Tell me if it fixes your issue. I wasn't able to add prefix to the updateTicksScale function because it seems that ng-style automatically drops the prefix.

@evanmcallaway
Copy link
Author

Hmm...unfortunately updateTicksScale was the one that was really killing us. It's a bit verbose, but we are currently fixing it by doing the following:

         this.scope.ticks = ticksArray.map(function(value) {
           var position = self.valueToPosition(value);
 
            if (self.options.vertical)
              position = self.maxPos - position;
  
 +          var translation = translate + '(' + Math.round(position) + 'px)';
            var tick = {
              selected: self.isTickSelected(value),
              style: {
 -              transform: translate + '(' + Math.round(position) + 'px)'
 +                '-webkit-transform': translation,
 +	              '-moz-transform': translation,
 +	              '-o-transform': translation,
 +	              '-ms-transform': translation,
 +	              'transform': translation
              }
            };

Which seems to do the job.

@ValentinH
Copy link
Member

That's weird because when I tried that, ng-style was simply adding the 'transform' property without the prefixed version? Does this mean that it depends on the browser where it gets executed?

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

2 participants