@easyv/charts 1.8.7 → 1.8.9

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.
@@ -64,7 +64,6 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
64
64
  active = _useState2[0],
65
65
  setActive = _useState2[1];
66
66
  var scaleRef = (0, _react.useRef)([1, 1]);
67
- var domRef = (0, _react.useRef)();
68
67
  var triggerOnRelative = (0, _react.useCallback)(function (action, data) {
69
68
  if (!interaction) return;
70
69
  var callbacks = interaction.callbacks,
@@ -122,16 +121,12 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
122
121
  var data = checkData(originData);
123
122
  return /*#__PURE__*/_react["default"].createElement(_context.chartContext.Provider, {
124
123
  value: context
125
- }, type == 'pie' ? /*#__PURE__*/_react["default"].createElement("div", {
126
- ref: domRef
127
- }, /*#__PURE__*/_react["default"].createElement(_.PieChart, (0, _extends2["default"])({
124
+ }, type == 'pie' ? /*#__PURE__*/_react["default"].createElement(_.PieChart, (0, _extends2["default"])({
128
125
  id: id,
129
126
  config: config,
130
127
  data: data,
131
128
  active: active
132
- }, props, {
133
- domRef: domRef
134
- }))) : /*#__PURE__*/_react["default"].createElement(_.CartesianChart, (0, _extends2["default"])({
129
+ }, props)) : /*#__PURE__*/_react["default"].createElement(_.CartesianChart, (0, _extends2["default"])({
135
130
  id: id,
136
131
  config: config,
137
132
  data: data,
@@ -148,6 +148,24 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
148
148
  return parseFloat(getCanvasTextWidth(percentStr, percentFont.letterSpacing || 0, "".concat(percentFont.fontSize || 12, "px ").concat(percentFont.fontFamily || 'Arial')));
149
149
  })));
150
150
  var nameMaxWidth = ((_config$name = config.name) === null || _config$name === void 0 ? void 0 : _config$name.maxWidth) || 80;
151
+ var stylePieOrAxis = formatter ? _objectSpread(_objectSpread({
152
+ display: 'flex',
153
+ alignContent: alignment.split(" ")[0] == "center" && (alignment.split(" ")[1] == "left" || alignment.split(" ")[1] == "right") ? alignment.split(" ")[1] == "left" ? "flex-start" : "flex-end" : alignment.split(" ")[0] == "left" ? "flex-start" : alignment.split(" ")[0] == "center" ? "center" : "flex-end",
154
+ flexDirection: "column",
155
+ position: 'absolute'
156
+ }, getPosition(position, _alignment, x, y)), {}, {
157
+ height: loop.show ? height : 'auto',
158
+ overflowY: loop.show ? 'scroll' : 'auto'
159
+ }) : _objectSpread(_objectSpread({
160
+ display: 'flex',
161
+ flexWrap: "wrap",
162
+ alignContent: alignment.split(" ")[0] == "center" && (alignment.split(" ")[1] == "left" || alignment.split(" ")[1] == "right") ? alignment.split(" ")[1] == "left" ? "flex-start" : "flex-end" : alignment.split(" ")[0] == "left" ? "flex-start" : alignment.split(" ")[0] == "center" ? "center" : "flex-end",
163
+ flexDirection: "column",
164
+ position: 'absolute'
165
+ }, getPosition(position, _alignment, x, y)), {}, {
166
+ height: loop.show ? height : 'auto',
167
+ overflowY: loop.show ? 'scroll' : 'auto'
168
+ });
151
169
  return LegendType == "FixedWidth" ? /*#__PURE__*/_react["default"].createElement("div", {
152
170
  className: "__easyv-legend-wrapper",
153
171
  style: _objectSpread(_objectSpread({
@@ -201,16 +219,7 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
201
219
  })));
202
220
  }))) : /*#__PURE__*/_react["default"].createElement("div", {
203
221
  className: "__easyv-legend-wrapper",
204
- style: _objectSpread(_objectSpread({
205
- display: 'flex',
206
- flexWrap: "wrap",
207
- alignContent: alignment.split(" ")[0] == "center" && (alignment.split(" ")[1] == "left" || alignment.split(" ")[1] == "right") ? alignment.split(" ")[1] == "left" ? "flex-start" : "flex-end" : alignment.split(" ")[0] == "left" ? "flex-start" : alignment.split(" ")[0] == "center" ? "center" : "flex-end",
208
- flexDirection: "column",
209
- position: 'absolute'
210
- }, getPosition(position, _alignment, x, y)), {}, {
211
- height: loop.show ? height : 'auto',
212
- overflowY: loop.show ? 'scroll' : 'auto'
213
- }),
222
+ style: stylePieOrAxis,
214
223
  ref: ref_container
215
224
  }, (0, _toConsumableArray2["default"])(Array(Math.ceil(series.length / gridTemplateColumns))).map(function (_, indexs) {
216
225
  return /*#__PURE__*/_react["default"].createElement("ul", {
@@ -232,8 +232,7 @@ var getCircleScale = function getCircleScale() {
232
232
  }));
233
233
  };
234
234
  var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
235
- var domRef = _ref5.domRef,
236
- width = _ref5.width,
235
+ var width = _ref5.width,
237
236
  height = _ref5.height,
238
237
  _ref5$config = _ref5.config,
239
238
  _ref5$config$chart = _ref5$config.chart,
@@ -615,8 +614,7 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
615
614
  x: halfChartWidth,
616
615
  y: maxRadius + marginTop
617
616
  },
618
- mousePos: mousePos,
619
- domRef: domRef
617
+ mousePos: mousePos
620
618
  })), /*#__PURE__*/_react["default"].createElement(_.Legend, (0, _extends2["default"])({}, legend, {
621
619
  height: chartHeight,
622
620
  series: _arcs.map(function (arc) {
@@ -780,8 +778,7 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
780
778
  x: halfChartWidth,
781
779
  y: maxRadius + marginTop
782
780
  },
783
- mousePos: mousePos,
784
- domRef: domRef
781
+ mousePos: mousePos
785
782
  })), /*#__PURE__*/_react["default"].createElement(_.Legend, (0, _extends2["default"])({}, legend, {
786
783
  height: chartHeight,
787
784
  series: _arcs.map(function (arc) {
@@ -17,7 +17,6 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
17
17
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
18
18
  var PieTooltip = exports.PieTooltip = /*#__PURE__*/(0, _react.memo)(function (props) {
19
19
  var mousePos = props.mousePos,
20
- domRef = props.domRef,
21
20
  pieCenter = props.pieCenter,
22
21
  _props$config$tip = props.config.tip,
23
22
  _props$config$tip$dat = _props$config$tip.data,
@@ -43,7 +42,6 @@ var PieTooltip = exports.PieTooltip = /*#__PURE__*/(0, _react.memo)(function (pr
43
42
  translateTip = _props$config$tip.translate,
44
43
  data = props.data,
45
44
  series = props.series;
46
- var screenRef = domRef.current.getBoundingClientRect();
47
45
  var Item = function Item() {
48
46
  var _data$data = data.data,
49
47
  s = _data$data.s,
@@ -99,84 +97,45 @@ var PieTooltip = exports.PieTooltip = /*#__PURE__*/(0, _react.memo)(function (pr
99
97
  centerY = pieCenter.y;
100
98
  var getTipPos = function getTipPos() {
101
99
  var getBigscreenScale = function getBigscreenScale() {
102
- // 优先使用全局提供的方法
103
- if (typeof window.getScreenScale === 'function') {
104
- try {
105
- var _result = window.getScreenScale();
106
- if (Array.isArray(_result) && _result.length >= 6) {
107
- return _result;
100
+ if (window.getScreenScale) {
101
+ return window.getScreenScale();
102
+ } else {
103
+ var bigscreenDom = document.getElementById('bigscreen-container');
104
+ if (!bigscreenDom) return [1, 1];
105
+ var transform = bigscreenDom.style.transform;
106
+ if (!transform) return [1, 1];
107
+ var match = transform.match(/scale\(([^)]+)\)/);
108
+ if (match) {
109
+ var scaleMatch = match[1].split(',');
110
+ var _scaleX = scaleMatch[0];
111
+ var _scaleY = scaleMatch[1];
112
+ if (_scaleY) {
113
+ return [Number(_scaleX), Number(_scaleY)];
114
+ } else {
115
+ return [Number(_scaleX), Number(_scaleX)];
108
116
  }
109
- } catch (e) {
110
- console.error('调用全局 getScreenScale 出错:', e);
117
+ } else {
118
+ return [1, 1];
111
119
  }
112
120
  }
113
-
114
- // 获取容器元素
115
- var bigscreenDom = document.getElementById('bigscreen-container');
116
-
117
- // 元素不存在时的处理
118
- if (!bigscreenDom) {
119
- console.warn('未找到 bigscreen-container 元素,使用视口尺寸');
120
- return [1, 1, window.innerWidth, window.innerHeight, 0, 0];
121
- }
122
-
123
- // 确保元素可见(未被隐藏)
124
- var isVisible = window.getComputedStyle(bigscreenDom).display !== 'none' && window.getComputedStyle(bigscreenDom).visibility !== 'hidden';
125
- if (!isVisible) {
126
- console.warn('bigscreen-container 元素不可见,使用视口尺寸');
127
- return [1, 1, window.innerWidth, window.innerHeight, 0, 0];
128
- }
129
-
130
- // 获取元素的布局矩形(最可靠的尺寸获取方式)
131
- var rect = bigscreenDom.getBoundingClientRect();
132
-
133
- // 提取基础尺寸(从布局矩形获取,不受样式影响)
134
- var screenWidth = rect.width || window.innerWidth;
135
- var screenHeight = rect.height || window.innerHeight;
136
- var screenLeft = rect.left || 0;
137
- var screenTop = rect.top || 0;
138
-
139
- // 处理缩放
140
- var scaleX = 1;
141
- var scaleY = 1;
142
- try {
143
- var computedStyle = window.getComputedStyle(bigscreenDom);
144
- var transform = computedStyle.transform;
145
- if (transform && transform !== 'none') {
146
- // 解析 transform matrix
147
- var matrix = new DOMMatrix(transform);
148
- scaleX = matrix.a; // 缩放X因子
149
- scaleY = matrix.d; // 缩放Y因子
150
- }
151
- } catch (e) {
152
- console.error('解析缩放样式出错:', e);
153
- }
154
-
155
- // 最终返回值(确保不会有undefined)
156
- var result = [isNaN(scaleX) ? 1 : scaleX, isNaN(scaleY) ? 1 : scaleY, isNaN(screenWidth) ? window.innerWidth : screenWidth, isNaN(screenHeight) ? window.innerHeight : screenHeight, isNaN(screenLeft) ? 0 : screenLeft, isNaN(screenTop) ? 0 : screenTop];
157
- return result;
158
121
  };
159
122
  var _getBigscreenScale = getBigscreenScale(),
160
- _getBigscreenScale2 = (0, _slicedToArray2["default"])(_getBigscreenScale, 6),
123
+ _getBigscreenScale2 = (0, _slicedToArray2["default"])(_getBigscreenScale, 2),
161
124
  scaleX = _getBigscreenScale2[0],
162
- scaleY = _getBigscreenScale2[1],
163
- screenWidth = _getBigscreenScale2[2],
164
- screenHeight = _getBigscreenScale2[3],
165
- screenLeft = _getBigscreenScale2[4],
166
- screenTop = _getBigscreenScale2[5];
167
- // const _mouseX = mouseX / scaleX
168
- // const _mouseY = mouseY / scaleY
125
+ scaleY = _getBigscreenScale2[1];
126
+ var _mouseX = mouseX / scaleX;
127
+ var _mouseY = mouseY / scaleY;
169
128
  var tipPosMap = {
170
- rightTop: "translate(".concat((screenRef.x + tipWidth) / scaleX + mouseX - screenLeft + translateTip.x > screenWidth ? mouseX - tipWidth - translateTip.x : mouseX + translateTip.x, "px,\n ").concat((screenRef.y - tipHeight) / scaleY + mouseY - screenTop + translateTip.y < 0 ? mouseY + translateTip.y : mouseY - tipHeight - translateTip.y, "px)"),
171
- leftTop: "translate(".concat((screenRef.x - tipWidth) / scaleX + mouseX - screenLeft + translateTip.x < 0 ? mouseX + translateTip.x : mouseX - tipWidth - translateTip.x, "px,\n ").concat((screenRef.y - tipHeight) / scaleY + mouseY - screenTop + translateTip.y < 0 ? mouseY + translateTip.y : mouseY - tipHeight - translateTip.y, "px)"),
172
- leftBottom: "translate(".concat((screenRef.x - tipWidth) / scaleX + mouseX - screenLeft + translateTip.x < 0 ? mouseX + translateTip.x : mouseX - tipWidth - translateTip.x, "px,\n ").concat((screenRef.y + tipHeight) / scaleY + mouseY - screenTop + translateTip.y > screenHeight ? mouseY - tipHeight - translateTip.y : mouseY + translateTip.y, "px)"),
173
- rightBottom: "translate(".concat((screenRef.x + tipWidth) / scaleX + mouseX - screenLeft + translateTip.x > screenWidth ? mouseX - tipWidth - translateTip.x : mouseX + translateTip.x, "px,\n ").concat((screenRef.y + tipHeight) / scaleY + mouseY - screenTop + translateTip.y > screenHeight ? mouseY - tipHeight - translateTip.y : mouseY + translateTip.y, "px)")
129
+ rightTop: "translate(".concat(_mouseX + translateTip.x, "px,").concat(_mouseY - tipHeight - translateTip.y, "px)"),
130
+ leftTop: "translate(".concat(_mouseX - tipWidth - translateTip.x, "px,").concat(_mouseY - tipHeight - translateTip.y, "px)"),
131
+ leftBottom: "translate(".concat(_mouseX - tipWidth - translateTip.x, "px,").concat(_mouseY + translateTip.y, "px)"),
132
+ rightBottom: "translate(".concat(_mouseX + translateTip.x, "px,").concat(_mouseY + translateTip.y, "px)")
174
133
  };
175
- if (mouseX < centerX && mouseY < centerY) {
134
+ if (_mouseX < centerX && _mouseY < centerY) {
176
135
  return tipPosMap.leftTop;
177
- } else if (mouseX > centerX && mouseY < centerY) {
136
+ } else if (_mouseX > centerX && _mouseY < centerY) {
178
137
  return tipPosMap.rightTop;
179
- } else if (mouseX >= centerX && mouseY >= centerY) {
138
+ } else if (_mouseX >= centerX && _mouseY >= centerY) {
180
139
  return tipPosMap.rightBottom;
181
140
  } else {
182
141
  return tipPosMap.leftBottom;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyv/charts",
3
- "version": "1.8.7",
3
+ "version": "1.8.9",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -47,7 +47,6 @@ const Chart = memo(
47
47
  const chartHeight = height - marginTop - marginBottom;
48
48
  const [active, setActive] = useState(true);
49
49
  const scaleRef = useRef([1,1]);
50
- const domRef=useRef()
51
50
  const triggerOnRelative = useCallback(
52
51
  (action,data) => {
53
52
  if (!interaction) return;
@@ -116,7 +115,7 @@ const Chart = memo(
116
115
  return (
117
116
  <chartContext.Provider value={context}>
118
117
  {type == 'pie' ? (
119
- <div ref={domRef}><PieChart id={id} config={config} data={data} active={active} {...props} domRef={domRef} /></div>
118
+ <PieChart id={id} config={config} data={data} active={active} {...props} />
120
119
  ) : (
121
120
  <CartesianChart id={id} config={config} data={data} active={active} {...props} />
122
121
  )}
@@ -123,6 +123,24 @@ export default memo(
123
123
  );
124
124
  const nameMaxWidth = config.name?.maxWidth || 80;
125
125
 
126
+ const stylePieOrAxis=formatter?{
127
+ display:'flex',
128
+ alignContent:alignment.split(" ")[0]=="center"&&(alignment.split(" ")[1]=="left"||alignment.split(" ")[1]=="right")?alignment.split(" ")[1]=="left"?"flex-start":"flex-end":alignment.split(" ")[0]=="left"?"flex-start":alignment.split(" ")[0]=="center"?"center":"flex-end",
129
+ flexDirection:"column",
130
+ position: 'absolute',
131
+ ...getPosition(position, _alignment, x, y),
132
+ height: loop.show ? height : 'auto',
133
+ overflowY: loop.show ? 'scroll' : 'auto'
134
+ }:{
135
+ display:'flex',
136
+ flexWrap:"wrap",
137
+ alignContent:alignment.split(" ")[0]=="center"&&(alignment.split(" ")[1]=="left"||alignment.split(" ")[1]=="right")?alignment.split(" ")[1]=="left"?"flex-start":"flex-end":alignment.split(" ")[0]=="left"?"flex-start":alignment.split(" ")[0]=="center"?"center":"flex-end",
138
+ flexDirection: "column",
139
+ position: 'absolute',
140
+ ...getPosition(position, _alignment, x, y),
141
+ height: loop.show ? height : 'auto',
142
+ overflowY: loop.show ? 'scroll' : 'auto'
143
+ }
126
144
  return (
127
145
  LegendType=="FixedWidth"?
128
146
  <div
@@ -180,16 +198,7 @@ export default memo(
180
198
  </ul>
181
199
  </div>:<div
182
200
  className='__easyv-legend-wrapper'
183
- style={{
184
- display:'flex',
185
- flexWrap:"wrap",
186
- alignContent:alignment.split(" ")[0]=="center"&&(alignment.split(" ")[1]=="left"||alignment.split(" ")[1]=="right")?alignment.split(" ")[1]=="left"?"flex-start":"flex-end":alignment.split(" ")[0]=="left"?"flex-start":alignment.split(" ")[0]=="center"?"center":"flex-end",
187
- flexDirection: "column",
188
- position: 'absolute',
189
- ...getPosition(position, _alignment, x, y),
190
- height: loop.show ? height : 'auto',
191
- overflowY: loop.show ? 'scroll' : 'auto'
192
- }}
201
+ style={stylePieOrAxis}
193
202
  ref={ref_container}
194
203
  >
195
204
 
@@ -247,7 +247,6 @@ const getCircleScale = ({ count, color, width, length } = tick, radius) => {
247
247
 
248
248
  const Component = memo(
249
249
  ({
250
- domRef,
251
250
  width,
252
251
  height,
253
252
  config: {
@@ -636,7 +635,6 @@ const Component = memo(
636
635
  y: maxRadius + marginTop,
637
636
  }}
638
637
  mousePos={mousePos}
639
- domRef={domRef}
640
638
  />
641
639
  </div>
642
640
  )}
@@ -898,7 +896,6 @@ const Component = memo(
898
896
  y: maxRadius + marginTop,
899
897
  }}
900
898
  mousePos={mousePos}
901
- domRef={domRef}
902
899
  />
903
900
  </div>
904
901
  )}
@@ -3,7 +3,7 @@ import { getFontStyle, getMargin, getTranslate3d, getTranslate2d, getIcon } from
3
3
 
4
4
 
5
5
  export const PieTooltip = memo((props) => {
6
- const { mousePos,domRef,
6
+ const { mousePos,
7
7
  pieCenter,
8
8
  config: {
9
9
  tip: {
@@ -19,7 +19,7 @@ export const PieTooltip = memo((props) => {
19
19
  },
20
20
  data,
21
21
  series } = props
22
- const screenRef = domRef.current.getBoundingClientRect();
22
+
23
23
  const Item = () => {
24
24
  const { data: { s, y }, percent } = data
25
25
  const { type, icon, displayName } = [...series.values()].find(
@@ -88,88 +88,38 @@ export const PieTooltip = memo((props) => {
88
88
  const getTipPos = () => {
89
89
 
90
90
  const getBigscreenScale = () => {
91
- // 优先使用全局提供的方法
92
- if (typeof window.getScreenScale === 'function') {
93
- try {
94
- const result = window.getScreenScale();
95
- if (Array.isArray(result) && result.length >= 6) {
96
- return result;
91
+ if (window.getScreenScale) {
92
+ return window.getScreenScale()
93
+ } else {
94
+ const bigscreenDom = document.getElementById('bigscreen-container')
95
+ if (!bigscreenDom) return [1, 1]
96
+ const transform = bigscreenDom.style.transform
97
+ if (!transform) return [1, 1]
98
+ let match = transform.match(/scale\(([^)]+)\)/)
99
+ if (match) {
100
+ const scaleMatch = match[1].split(',')
101
+ let scaleX = scaleMatch[0];
102
+ let scaleY = scaleMatch[1];
103
+ if (scaleY) {
104
+ return [Number(scaleX), Number(scaleY)]
105
+ } else {
106
+ return [Number(scaleX), Number(scaleX)]
107
+ }
108
+ } else {
109
+ return [1, 1]
97
110
  }
98
- } catch (e) {
99
- console.error('调用全局 getScreenScale 出错:', e);
100
- }
101
- }
102
-
103
- // 获取容器元素
104
- const bigscreenDom = document.getElementById('bigscreen-container');
105
-
106
- // 元素不存在时的处理
107
- if (!bigscreenDom) {
108
- console.warn('未找到 bigscreen-container 元素,使用视口尺寸');
109
- return [1, 1, window.innerWidth, window.innerHeight, 0, 0];
110
- }
111
-
112
- // 确保元素可见(未被隐藏)
113
- const isVisible = window.getComputedStyle(bigscreenDom).display !== 'none'
114
- && window.getComputedStyle(bigscreenDom).visibility !== 'hidden';
115
- if (!isVisible) {
116
- console.warn('bigscreen-container 元素不可见,使用视口尺寸');
117
- return [1, 1, window.innerWidth, window.innerHeight, 0, 0];
118
- }
119
-
120
- // 获取元素的布局矩形(最可靠的尺寸获取方式)
121
- const rect = bigscreenDom.getBoundingClientRect();
122
-
123
- // 提取基础尺寸(从布局矩形获取,不受样式影响)
124
- const screenWidth = rect.width || window.innerWidth;
125
- const screenHeight = rect.height || window.innerHeight;
126
- const screenLeft = rect.left || 0;
127
- const screenTop = rect.top || 0;
128
-
129
- // 处理缩放
130
- let scaleX = 1;
131
- let scaleY = 1;
132
-
133
- try {
134
- const computedStyle = window.getComputedStyle(bigscreenDom);
135
- const transform = computedStyle.transform;
136
-
137
- if (transform && transform !== 'none') {
138
- // 解析 transform matrix
139
- const matrix = new DOMMatrix(transform);
140
- scaleX = matrix.a; // 缩放X因子
141
- scaleY = matrix.d; // 缩放Y因子
142
- }
143
- } catch (e) {
144
- console.error('解析缩放样式出错:', e);
145
111
  }
146
-
147
- // 最终返回值(确保不会有undefined)
148
- const result = [
149
- isNaN(scaleX) ? 1 : scaleX,
150
- isNaN(scaleY) ? 1 : scaleY,
151
- isNaN(screenWidth) ? window.innerWidth : screenWidth,
152
- isNaN(screenHeight) ? window.innerHeight : screenHeight,
153
- isNaN(screenLeft) ? 0 : screenLeft,
154
- isNaN(screenTop) ? 0 : screenTop
155
- ];
156
- return result;
157
- };
158
-
159
- const [scaleX, scaleY,screenWidth,screenHeight,screenLeft,screenTop] = getBigscreenScale()
112
+ }
113
+ const [scaleX, scaleY] = getBigscreenScale()
160
114
  const _mouseX = mouseX / scaleX
161
115
  const _mouseY = mouseY / scaleY
162
116
  const tipPosMap = {
163
- rightTop: `translate(${(screenRef.x+tipWidth)/scaleX+_mouseX-screenLeft+translateTip.x>screenWidth?_mouseX -tipWidth- translateTip.x: _mouseX + translateTip.x}px,
164
- ${(screenRef.y-tipHeight)/scaleY+_mouseY-screenTop+translateTip.y<0?_mouseY + translateTip.y: _mouseY - tipHeight - translateTip.y}px)`,
165
- leftTop: `translate(${(screenRef.x-tipWidth)/scaleX+_mouseX-screenLeft+translateTip.x<0?_mouseX+translateTip.x: _mouseX - tipWidth - translateTip.x}px,
166
- ${(screenRef.y-tipHeight)/scaleY+_mouseY-screenTop+translateTip.y<0?_mouseY + translateTip.y: _mouseY - tipHeight - translateTip.y}px)`,
167
- leftBottom: `translate(${(screenRef.x-tipWidth)/scaleX+_mouseX-screenLeft+translateTip.x<0?_mouseX+translateTip.x: _mouseX - tipWidth - translateTip.x}px,
168
- ${(screenRef.y+tipHeight)/scaleY+_mouseY-screenTop+translateTip.y>screenHeight? _mouseY- tipHeight- translateTip.y: _mouseY + translateTip.y}px)`,
169
- rightBottom: `translate(${(screenRef.x+tipWidth)/scaleX+_mouseX-screenLeft+translateTip.x>screenWidth?_mouseX -tipWidth- translateTip.x:_mouseX + translateTip.x}px,
170
- ${(screenRef.y+tipHeight)/scaleY+_mouseY-screenTop+translateTip.y>screenHeight? _mouseY- tipHeight- translateTip.y: _mouseY + translateTip.y}px)`,
171
- }
172
- if (_mouseX < centerX && _mouseY < centerY) {
117
+ rightTop: `translate(${_mouseX + translateTip.x}px,${_mouseY - tipHeight - translateTip.y}px)`,
118
+ leftTop: `translate(${_mouseX - tipWidth - translateTip.x}px,${_mouseY - tipHeight - translateTip.y}px)`,
119
+ leftBottom: `translate(${_mouseX - tipWidth - translateTip.x}px,${_mouseY + translateTip.y}px)`,
120
+ rightBottom: `translate(${_mouseX + translateTip.x}px,${(_mouseY + translateTip.y)}px)`,
121
+ }
122
+ if (_mouseX < centerX && _mouseY < centerY) {
173
123
  return tipPosMap.leftTop
174
124
  } else if (_mouseX > centerX && _mouseY < centerY) {
175
125
  return tipPosMap.rightTop