bernii/gauge.js

Using gauge.js inside Shadow DOM

Opened this issue · 0 comments

With chrome browser, inside shadow dom element there is the problem, that canvas.clientHeight and canvas.clientWidth are both 0. Fortunately canvas.height and canvas.width are still correct, so to fix this it was enough to comment a few lines:
`

function Gauge(canvas) {
        // var h, w;
        this.canvas = canvas;
        Gauge.__super__.constructor.call(this);
        this.percentColors = null;
        if (typeof G_vmlCanvasManager !== 'undefined') {
          this.canvas = window.G_vmlCanvasManager.initElement(this.canvas);
        }
        this.ctx = this.canvas.getContext('2d');
        // h = this.canvas.clientHeight;
        // w = this.canvas.clientWidth;
        // this.canvas.height = h;
        // this.canvas.width = w;
        this.gp = [new GaugePointer(this)];
        this.setOptions();
}

`