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

Retina support #89

Open
gblazex opened this issue Dec 5, 2016 · 0 comments
Open

Retina support #89

gblazex opened this issue Dec 5, 2016 · 0 comments

Comments

@gblazex
Copy link

gblazex commented Dec 5, 2016

  getDataURL: function () {
    var canvas = document.createElement('canvas'), ctx = canvas.getContext('2d');
    var pixelRatio = window.devicePixelRatio || 1;
    canvas.width  = this.options.width  * pixelRatio;
    canvas.height = this.options.height * pixelRatio;
    ctx.scale(pixelRatio, pixelRatio);
    ctx.drawImage(this.$image.get(0), this.result.cropX, this.result.cropY, 
                  this.result.cropW, this.result.cropH, 0, 0, 
                  this.options.width, this.options.height);
    return canvas.toDataURL();
  },

see: https://tristandunn.com/2014/01/24/rendering-svg-on-canvas/

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

1 participant