tvcharts 0.9.12 → 0.9.13

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.
@@ -44,6 +44,7 @@
44
44
  import { subPixelOptimize } from '../../util/graphic.js';
45
45
  import createRenderPlanner from '../helper/createRenderPlanner.js';
46
46
  import { map } from 'tvrender/lib/core/util.js';
47
+ import { isMobileRender } from "../../util/mobile.js";
47
48
  var positiveBorderColorQuery = ['itemStyle', 'borderColor'];
48
49
  var negativeBorderColorQuery = ['itemStyle', 'borderColor0'];
49
50
  var dojiBorderColorQuery = ['itemStyle', 'borderColorDoji'];
@@ -82,9 +83,8 @@ var candlePlotLayout = {
82
83
  }
83
84
  var showLast = seriesModel.get('showLast');
84
85
  var ignoreParentColor = seriesModel.get('ignoreParentColor');
85
- var isMobile = seriesModel.get('isMobile');
86
- var offsetX = isMobile ? 0 : 0.5;
87
- var formatY = isMobile ? function (y) {
86
+ var offsetX = isMobileRender ? 0 : 0.5;
87
+ var formatY = isMobileRender ? function (y) {
88
88
  return y;
89
89
  } : function (y) {
90
90
  return Math.floor(y);
@@ -203,7 +203,7 @@ var EventsView = /** @class */function (_super) {
203
203
  imgGroup.onmouseout = mouseout;
204
204
  imgGroup.onmousemove = mouseMove;
205
205
  imgGroup.onmouseover = mouseover;
206
- imgGroup.onclick = click;
206
+ imgGroup.onmouseup = click;
207
207
  group.add(imgGroup);
208
208
  // rect.onmouseout = mouseout;
209
209
  // rect.onmousemove = mouseMove;
package/lib/coord/Axis.js CHANGED
@@ -44,28 +44,8 @@
44
44
  import { each, map } from 'tvrender/lib/core/util.js';
45
45
  import { linearMap, getPixelPrecision, round } from '../util/number.js';
46
46
  import { createAxisTicks, createAxisLabels, calculateCategoryInterval } from './axisTickLabelBuilder.js';
47
+ import { isMobileRender } from "../util/mobile.js";
47
48
  var NORMALIZED_EXTENT = [0, 1];
48
- function isMobileByWidth(breakPoint) {
49
- if (breakPoint === void 0) {
50
- breakPoint = 768;
51
- }
52
- // 服务端渲染(SSR)或非浏览器环境返回false
53
- if (typeof window === "undefined") return false;
54
- // 获取当前视口宽度(实时检测)
55
- var viewportWidth = window.innerWidth;
56
- // 判断是否小于断点
57
- return viewportWidth < breakPoint && window.devicePixelRatio !== 1;
58
- }
59
- function isMobileView() {
60
- // 其次检查 User Agent
61
- var userAgent = navigator.userAgent;
62
- var mobileRegex = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i;
63
- if (isMobileByWidth() && mobileRegex.test(userAgent)) {
64
- return true;
65
- }
66
- return false;
67
- }
68
- var isMobile = isMobileView();
69
49
  /**
70
50
  * Base class of Axis.
71
51
  */
@@ -124,7 +104,7 @@ var Axis = /** @class */function () {
124
104
  var deltaFromRight = dataCount + scale.lastBarRightSideDiffBarCount - dataIndex;
125
105
  // return this._extent[1] - (deltaFromRight + 0.5) * scale.barSpace - 1;
126
106
  // return Math.floor(this._extent[1] - deltaFromRight * scale.barSpace) + 0.5;
127
- return isMobile ? this._extent[1] - deltaFromRight * scale.barSpace : Math.round(this._extent[1] - deltaFromRight * scale.barSpace);
107
+ return isMobileRender ? this._extent[1] - deltaFromRight * scale.barSpace : Math.round(this._extent[1] - deltaFromRight * scale.barSpace);
128
108
  }
129
109
  if (this.onBand && scale.type === 'ordinal') {
130
110
  extent = extent.slice();
@@ -0,0 +1,47 @@
1
+
2
+ /*
3
+ * Licensed to the Apache Software Foundation (ASF) under one
4
+ * or more contributor license agreements. See the NOTICE file
5
+ * distributed with this work for additional information
6
+ * regarding copyright ownership. The ASF licenses this file
7
+ * to you under the Apache License, Version 2.0 (the
8
+ * "License"); you may not use this file except in compliance
9
+ * with the License. You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing,
14
+ * software distributed under the License is distributed on an
15
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ * KIND, either express or implied. See the License for the
17
+ * specific language governing permissions and limitations
18
+ * under the License.
19
+ */
20
+
21
+
22
+ /**
23
+ * AUTO-GENERATED FILE. DO NOT MODIFY.
24
+ */
25
+
26
+ function isMobileByWidth(breakPoint) {
27
+ if (breakPoint === void 0) {
28
+ breakPoint = 768;
29
+ }
30
+ // 服务端渲染(SSR)或非浏览器环境返回false
31
+ if (typeof window === "undefined") return false;
32
+ // 获取当前视口宽度(实时检测)
33
+ var viewportWidth = window.innerWidth;
34
+ // 判断是否小于断点
35
+ return viewportWidth < breakPoint && window.devicePixelRatio !== 1;
36
+ }
37
+ function isMobileView() {
38
+ // 其次检查 User Agent
39
+ var userAgent = navigator.userAgent;
40
+ var mobileRegex = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i;
41
+ if (isMobileByWidth() && mobileRegex.test(userAgent)) {
42
+ return true;
43
+ }
44
+ return false;
45
+ }
46
+ var isMobileRender = isMobileView();
47
+ export { isMobileRender };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tvcharts",
3
- "version": "0.9.12",
3
+ "version": "0.9.13",
4
4
  "main": "dist/echarts.js",
5
5
  "module": "index.js",
6
6
  "jsdelivr": "dist/echarts.min.js",
@@ -0,0 +1,2 @@
1
+ declare const isMobileRender: boolean;
2
+ export { isMobileRender };