From 756df47fe31fc8f374e94f6e66a422de357cfebf Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Mon, 25 Nov 2024 08:39:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D`UITable`=E5=9C=A8=E6=8B=96?= =?UTF-8?q?=E6=8B=BD=E6=97=B6=E4=B9=9F=E4=BC=9A=E7=82=B9=E9=80=89=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Documentation~/zh/changelog.md | 22 ++++++++++++++++++++++ Runtime/XUGL/UGLHelper.cs | 29 ++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index bce5b86e..a87c6fad 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -77,6 +77,7 @@ slug: /changelog ## master +* (2024.11.24) 修复`UITable`在拖拽时也会点选的问题 * (2024.11.22) 修复`Time`时间轴在开启`Animation`时动态变更效果异常的问题 * (2024.11.18) 优化`Line`在数据点过密时有更好的绘制效果 * (2024.11.16) 修复`Animation`无法通过代码开启的问题 (#334) @@ -137,6 +138,8 @@ slug: /changelog 日志详情: + + * (2024.06.16) 发布`v3.11.0`版本 * (2024.06.15) 增加`Editor`下`Data`的添加、删除、上下移动操作按钮 * (2024.06.11) 修复`Axis`的`IndicatorLabel`可能会遮挡住`Tooltip`的问题 @@ -196,12 +199,19 @@ slug: /changelog * (2024.01.23) 增加`{y}`通配符用于获取Y轴的类目名 * (2024.01.23) 增加`Line`支持X轴和Y轴都为`Category`类目轴 * (2024.01.18) 修复`Animation`的`type`代码动态修改无效的问题 +* (2024.01.16) 增加`UIImage`图片组件 +* (2024.01.16) 优化`Background`组件,可设置圆角和边框 * (2024.01.13) 增加`Chart`的更多快捷创建图表菜单 * (2024.01.09) 增加`Background`的`borderStyle`,给图表默认设置圆角 * (2024.01.07) 修复`Tooltop`的第一个`ContentLabelStyle`设置`color`无效的问题 +* (2024.01.03) 增加`UITable`的`carouselStyle`的`hoverPause` +* (2024.01.02) 增加`UITable`的`scrollStyle`的`borderStyle` +* (2024.01.02) 增加`UITable`的`columnHeadStyle`的`opaque` +* (2024.01.01) 调整`UITable`的`border`边框相关设置,用`BorderStyle`代替 * (2024.01.01) 增加`BorderStyle`边框样式 * (2023.12.26) 增加`Heatmap`的`maxCache`参数支持 * (2023.12.25) 优化`Line`开启`clip`时绘制的顶点数 +* (2023.12.22) 增加`UITable`的行边框 * (2023.12.22) 修复`Scatter`散点图部分边界数据不显示的问题 * (2023.12.21) 修复`TriggerTooltip()`接口在指定0或最大index时可能无法触发的问题 * (2023.12.19) 修复`Legend`的`LabelStyle`设置`formatter`后不生效的问题 @@ -240,15 +250,27 @@ slug: /changelog * (2023.11.23) 增加`Axis`的`Animation`支持动画效果 * (2023.11.16) 取消`Legend`的`formatter`,用`LabelStyle`的代替 * (2023.11.14) 完善`LabelStyle`的`formatter`的注释和文档(#291) +* (2023.11.14) 增加`UITable`的`GetData()`和`GetContent()`接口 +* (2023.11.12) 增加`UITable`的`onTableClick`点击表格回调 +* (2023.11.11) 重构`UITable`的`SeparatorStyle`,可分开设置行列的分割线 * (2023.11.11) 修复`Documentation`部分注释生成文档不完整的问题 (#290) * (2023.11.11) 修复`Legend`的`formatter`在数据变更时没有自动刷新的问题 +* (2023.11.05) 增加`UITable`的`ColumnStyle`,重构Column相关参数 +* (2023.11.05) 增加`UITable`的`RowStyle`,重构Row相关参数 * (2023.11.05) 修复`SerieEventData`的`value`一直是0的问题 (#287) * (2023.11.03) 修复`Bar`设置渐变色时鼠标移出效果异常的问题 (#285) * (2023.11.02) 优化`SerieData`设置`ignore`时`formatter`的忽略问题 +* (2023.11.01) 增加`UITable`的`CarouselStyle`轮播功能 +* (2023.11.01) 增加`UITable`的`AddColumn()`和`UpdateColumn()`接口 * (2023.11.01) 增加`MarkLine`的`onTop`设置是否显示在最上层 +* (2023.10.23) 修复`UITable`点击`Rebuild Object`异常的问题 +* (2023.10.23) 修复`UITable`尺寸变化时不刷新的问题 * (2023.10.21) 修复`Pie`有0数据时`Label`的位置异常的问题 * (2023.10.21) 增加`Axis`的对数轴支持子刻度 * (2023.10.19) 修复`Pie`设置玫瑰图时引导线异常的问题 +* (2023.10.17) 修复`UITable`首次初始化异常的问题 +* (2023.10.17) 增加`UITable`的数据操作接口 +* (2023.10.17) 增加`UITable`的`RefreshTable()`刷新接口 * (2023.10.15) 修复`Line`设置`Animation`为`AlongPath`时动画异常的问题 (#281) * (2023.10.12) 修复`MarkLine`指定`yValue`时对数值轴无效的问题 * (2023.10.11) 修复`Serie`的`showDataDimension`设置无效的问题 diff --git a/Runtime/XUGL/UGLHelper.cs b/Runtime/XUGL/UGLHelper.cs index 07e56538..32db5443 100644 --- a/Runtime/XUGL/UGLHelper.cs +++ b/Runtime/XUGL/UGLHelper.cs @@ -259,17 +259,27 @@ namespace XUGL /// 相交则返回 true, 否则返回 false public static bool GetIntersection(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4, ref Vector3 intersection) { - var d = (p2.x - p1.x) * (p4.y - p3.y) - (p2.y - p1.y) * (p4.x - p3.x); - if (d == 0) + float dx1 = p2.x - p1.x; + float dy1 = p2.y - p1.y; + float dx2 = p4.x - p3.x; + float dy2 = p4.y - p3.y; + + float d = dx1 * dy2 - dy1 * dx2; + if (Mathf.Abs(d) < 1e-6f) return false; - var u = ((p3.x - p1.x) * (p4.y - p3.y) - (p3.y - p1.y) * (p4.x - p3.x)) / d; - var v = ((p3.x - p1.x) * (p2.y - p1.y) - (p3.y - p1.y) * (p2.x - p1.x)) / d; - if (u < 0 || u > 1 || v < 0 || v > 1) - return false; + float dx3 = p3.x - p1.x; + float dy3 = p3.y - p1.y; - intersection.x = p1.x + u * (p2.x - p1.x); - intersection.y = p1.y + u * (p2.y - p1.y); + float u = (dx3 * dy2 - dy3 * dx2) / d; + if (u < 0 || u > 1) return false; + + float v = (dx3 * dy1 - dy3 * dx1) / d; + if (v < 0 || v > 1) return false; + + intersection.x = p1.x + u * dx1; + intersection.y = p1.y + u * dy1; + intersection.z = p1.z; return true; } @@ -337,7 +347,8 @@ namespace XUGL clp = cp - dir2v; crp = cp + dir2v; - if (Vector3.Cross(dir1, dir2) == Vector3.zero && np != cp) + float crossMagnitude = Vector3.Cross(dir1, dir2).sqrMagnitude; + if (crossMagnitude < 1e-6f && np != cp) { itp = clp; ibp = crp;