修复UITable在拖拽时也会点选的问题

This commit is contained in:
monitor1394
2024-11-25 08:39:48 +08:00
parent 1dd31f747e
commit 756df47fe3
2 changed files with 42 additions and 9 deletions

View File

@@ -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`设置无效的问题

View File

@@ -259,17 +259,27 @@ namespace XUGL
/// <returns>相交则返回 true, 否则返回 false</returns>
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;