Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 566e97a

Browse files
committed
Fix path and make mpl.js a UMD file
1 parent 3f42311 commit 566e97a

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

lib/matplotlib/backends/web_backend/js/mpl.js

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
/* Put everything inside the global mpl namespace */
2+
3+
// Universal Module Definition
4+
(function (root, factory) {
5+
if (typeof define === 'function' && define.amd) {
6+
// AMD
7+
define(['jquery'], factory);
8+
} else {
9+
// Browser globals (root is window)
10+
root.returnExports = factory(root.jQuery);
11+
}
12+
}(this, function ($) {
13+
214
window.mpl = {};
315

416

@@ -133,11 +145,11 @@ mpl.figure.prototype._init_canvas = function() {
133145
this.context = canvas[0].getContext("2d");
134146

135147
var backingStore = this.context.backingStorePixelRatio ||
136-
this.context.webkitBackingStorePixelRatio ||
137-
this.context.mozBackingStorePixelRatio ||
138-
this.context.msBackingStorePixelRatio ||
139-
this.context.oBackingStorePixelRatio ||
140-
this.context.backingStorePixelRatio || 1;
148+
this.context.webkitBackingStorePixelRatio ||
149+
this.context.mozBackingStorePixelRatio ||
150+
this.context.msBackingStorePixelRatio ||
151+
this.context.oBackingStorePixelRatio ||
152+
this.context.backingStorePixelRatio || 1;
141153

142154
mpl.ratio = (window.devicePixelRatio || 1) / backingStore;
143155

@@ -552,3 +564,7 @@ mpl.figure.prototype.toolbar_button_onclick = function(name) {
552564
mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {
553565
this.message.textContent = tooltip;
554566
};
567+
568+
return mpl;
569+
570+
}));

lib/matplotlib/backends/web_backend/js/nbagg_mpl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
define(['jupyter-js-widgets', './mpl.js'], function(widgets, mpl) {
2+
define(['jupyter-js-widgets', '/nbextensions/matplotlib/mpl.js'], function(widgets, mpl) {
33

44
var MPLCanvasView = widgets.WidgetView.extend({
55

0 commit comments

Comments
 (0)