Skip to content

Retina support #89

@gblazex

Description

@gblazex
  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/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions