X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=plugins%2Frange-selector.js;h=399ed3929d31d5d2ba588a686d9a4c4cf14b869d;hb=refs%2Fheads%2Fjshint;hp=717f85059442578e9e37a9aafc8cb351bc688938;hpb=3e644ed896f7184c93bc7d16f285a33a4c2e39f2;p=dygraphs.git diff --git a/plugins/range-selector.js b/plugins/range-selector.js index 717f850..399ed39 100644 --- a/plugins/range-selector.js +++ b/plugins/range-selector.js @@ -12,7 +12,6 @@ Dygraph.Plugins.RangeSelector = (function() { -/*jshint globalstrict: true */ /*global Dygraph:false */ "use strict"; @@ -57,7 +56,7 @@ rangeSelector.prototype.getOption_ = function(name, opt_series) { }; rangeSelector.prototype.setDefaultOption_ = function(name, value) { - return this.dygraph_.attrs_[name] = value; + this.dygraph_.attrs_[name] = value; }; /** @@ -166,13 +165,19 @@ rangeSelector.prototype.updateVisibility_ = function() { * Resizes the range selector. */ rangeSelector.prototype.resize_ = function() { - function setElementRect(canvas, rect) { + function setElementRect(canvas, context, rect) { + var canvasScale = Dygraph.getContextPixelRatio(context); + canvas.style.top = rect.y + 'px'; canvas.style.left = rect.x + 'px'; - canvas.width = rect.w; - canvas.height = rect.h; - canvas.style.width = canvas.width + 'px'; // for IE - canvas.style.height = canvas.height + 'px'; // for IE + canvas.width = rect.w * canvasScale; + canvas.height = rect.h * canvasScale; + canvas.style.width = rect.w + 'px'; + canvas.style.height = rect.h + 'px'; + + if(canvasScale != 1) { + context.scale(canvasScale, canvasScale); + } } var plotArea = this.dygraph_.layout_.getPlotArea(); @@ -188,8 +193,8 @@ rangeSelector.prototype.resize_ = function() { h: this.getOption_('rangeSelectorHeight') }; - setElementRect(this.bgcanvas_, this.canvasRect_); - setElementRect(this.fgcanvas_, this.canvasRect_); + setElementRect(this.bgcanvas_, this.bgcanvas_ctx_, this.canvasRect_); + setElementRect(this.fgcanvas_, this.fgcanvas_ctx_, this.canvasRect_); }; /**