mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-07 04:39:06 +02:00
Merge pull request #1526 from etimberg/fix/responsive-config-setting
Use the correct merged responsive setting in the resize listener
This commit is contained in:
commit
6c4c4695d9
@ -57,20 +57,19 @@
|
||||
// High pixel density displays - multiply the size of the canvas height/width by the device pixel ratio, then scale.
|
||||
Chart.helpers.retinaScale(this);
|
||||
|
||||
if (config) {
|
||||
this.controller = new Chart.Controller(this);
|
||||
}
|
||||
|
||||
// Always bind this so that if the responsive state changes we still work
|
||||
var _this = this;
|
||||
Chart.helpers.addResizeListener(context.canvas.parentNode, function() {
|
||||
if (config.options.responsive) {
|
||||
if (_this.controller && _this.controller.config.options.responsive) {
|
||||
_this.controller.resize();
|
||||
}
|
||||
});
|
||||
|
||||
if (config) {
|
||||
this.controller = new Chart.Controller(this);
|
||||
return this.controller;
|
||||
}
|
||||
|
||||
return this;
|
||||
return this.controller ? this.controller : this;
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user