jmgraph 3.2.4 → 3.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/jmgraph.js CHANGED
@@ -1891,8 +1891,6 @@ exports.jmEvents = exports["default"] = void 0;
1891
1891
 
1892
1892
  var _jmUtils = require("./jmUtils.js");
1893
1893
 
1894
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1895
-
1896
1894
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1897
1895
 
1898
1896
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -2001,7 +1999,7 @@ var jmMouseEvent = /*#__PURE__*/function () {
2001
1999
  key: "init",
2002
2000
  value: function init(instance, container, target) {
2003
2001
  var canvas = this.target;
2004
- var doc = typeof (typeof document === "undefined" ? "undefined" : _typeof(document)) != 'undefined' ? document : null; //禁用鼠标右健系统菜单
2002
+ var doc = typeof document != 'undefined' ? document : null; //禁用鼠标右健系统菜单
2005
2003
  //canvas.oncontextmenu = function() {
2006
2004
  // return false;
2007
2005
  //};
@@ -2135,7 +2133,7 @@ var jmKeyEvent = /*#__PURE__*/function () {
2135
2133
  _createClass(jmKeyEvent, [{
2136
2134
  key: "init",
2137
2135
  value: function init(container, target) {
2138
- var doc = typeof (typeof document === "undefined" ? "undefined" : _typeof(document)) != 'undefined' ? document : null;
2136
+ var doc = typeof document != 'undefined' ? document : null;
2139
2137
  /**
2140
2138
  * 检查是否触发健盘事件至画布
2141
2139
  * 如果触发对象为输入框等对象则不响应事件
@@ -2615,7 +2613,7 @@ var jmGraph = /*#__PURE__*/function (_jmControl) {
2615
2613
  canvas = canvas[0];
2616
2614
  }
2617
2615
 
2618
- if (canvas.tagName != 'CANVAS') {
2616
+ if (!canvas.getContext && typeof document != 'undefined') {
2619
2617
  _this.container = canvas;
2620
2618
  var cn = document.createElement('canvas');
2621
2619
  canvas.appendChild(cn);
@@ -6193,7 +6191,7 @@ var jmImage = /*#__PURE__*/function (_jmControl) {
6193
6191
  this.__img = src;
6194
6192
  }
6195
6193
 
6196
- this.image = this.__img.src;
6194
+ if (this.__img) this.image = this.__img.src;
6197
6195
  return this.__img;
6198
6196
  }
6199
6197
  }]);
@@ -6387,14 +6385,14 @@ var jmLabel = /*#__PURE__*/function (_jmControl) {
6387
6385
  this.context.save && this.context.save(); // 修改字体,用来计算
6388
6386
 
6389
6387
  this.setStyle({
6390
- font: this.style.font || this.style.fontSize + 'px ' + this.style.fontFamily
6388
+ font: this.style.font || "".concat(this.style.fontSize, "px \"").concat(this.style.fontFamily, "\"")
6391
6389
  }); //计算宽度
6392
6390
 
6393
6391
  this.__size = this.context.measureText ? this.context.measureText(this.text) : {
6394
6392
  width: 15
6395
6393
  };
6396
6394
  this.context.restore && this.context.restore();
6397
- this.__size.height = this.style.fontSize ? this.style.fontSize : 15;
6395
+ if (!this.__size.height) this.__size.height = this.style.fontSize ? this.style.fontSize : 15;
6398
6396
  if (!this.width) this.width = this.__size.width;
6399
6397
  if (!this.height) this.height = this.__size.height;
6400
6398
  return this.__size;