hqchart 1.1.14864 → 1.1.14874
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/lib/umychart.vue.js +96 -25
- package/package.json +1 -1
- package/src/jscommon/umychart.complier.js +59 -0
- package/src/jscommon/umychart.js +253 -21
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +313 -22
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +313 -22
package/src/jscommon/umychart.js
CHANGED
|
@@ -3806,6 +3806,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
3806
3806
|
|
|
3807
3807
|
this.DestroyPopMenu();
|
|
3808
3808
|
|
|
3809
|
+
if (this.DestroyPopMinuteChart) this.DestroyPopMinuteChart();
|
|
3810
|
+
|
|
3809
3811
|
this.StopLatestPointFlash();
|
|
3810
3812
|
|
|
3811
3813
|
document.oncontextmenu=null;
|
|
@@ -14559,6 +14561,7 @@ function AverageWidthFrame()
|
|
|
14559
14561
|
if (IFrameSplitOperator.IsNumber(item.Margin.Bottom)) lineInfo.Margin.Bottom=item.Margin.Bottom;
|
|
14560
14562
|
}
|
|
14561
14563
|
if (IFrameSplitOperator.IsNumber(item.YOffset)) lineInfo.YOffset=item.YOffset;
|
|
14564
|
+
if (IFrameSplitOperator.IsNumber(item.Align)) lineInfo.Align=item.Align;
|
|
14562
14565
|
|
|
14563
14566
|
lineInfo.Height=lineHeight+lineInfo.Margin.Top+lineInfo.Margin.Bottom;
|
|
14564
14567
|
|
|
@@ -14596,13 +14599,17 @@ function AverageWidthFrame()
|
|
|
14596
14599
|
|
|
14597
14600
|
if (width<=0 || height<=0) return null;
|
|
14598
14601
|
|
|
14599
|
-
|
|
14602
|
+
var drawInfo={ Width:width, Height:height, AryLine:aryLine, Align:2 }; //Align 1=left 2=center 3=right
|
|
14603
|
+
if (IFrameSplitOperator.IsNumber(obj.Align)) drawInfo.Align=obj.Align;
|
|
14604
|
+
|
|
14605
|
+
return drawInfo;
|
|
14600
14606
|
}
|
|
14601
14607
|
|
|
14602
14608
|
//X轴底部文字多行输出
|
|
14603
14609
|
this.DrawMultiLineVText=function(drawInfo)
|
|
14604
14610
|
{
|
|
14605
14611
|
var xLeft=drawInfo.XCenter-drawInfo.Width/2;
|
|
14612
|
+
if (drawInfo.Align==1) xLeft=drawInfo.XCenter;
|
|
14606
14613
|
if (drawInfo.TextRightPrev!=null && drawInfo.TextRightPrev>xLeft)
|
|
14607
14614
|
return false;
|
|
14608
14615
|
|
|
@@ -14614,8 +14621,19 @@ function AverageWidthFrame()
|
|
|
14614
14621
|
for(var i=0, j=0;i<drawInfo.AryLine.length;++i)
|
|
14615
14622
|
{
|
|
14616
14623
|
var lineItem=drawInfo.AryLine[i];
|
|
14617
|
-
if (
|
|
14618
|
-
|
|
14624
|
+
if (drawInfo.Align==1)
|
|
14625
|
+
{
|
|
14626
|
+
var xLeft=drawInfo.XCenter-drawInfo.Width/2;
|
|
14627
|
+
if (lineItem.Align==1) xLeft=drawInfo.XCenter;
|
|
14628
|
+
else if (lineItem.Align==2) xLeft=drawInfo.XCenter+drawInfo.Width-lineItem.Width;
|
|
14629
|
+
}
|
|
14630
|
+
else
|
|
14631
|
+
{
|
|
14632
|
+
var xLeft=drawInfo.XCenter-lineItem.Width/2;
|
|
14633
|
+
if (lineItem.Align==1) xLeft=drawInfo.XCenter-drawInfo.Width/2;
|
|
14634
|
+
else if (lineItem.Align==2) xLeft=drawInfo.XCenter+drawInfo.Width/2-lineItem.Width;
|
|
14635
|
+
}
|
|
14636
|
+
|
|
14619
14637
|
if (xLeft<1) xLeft=1;
|
|
14620
14638
|
yText+=lineItem.Height;
|
|
14621
14639
|
for(j=0;j<lineItem.AryText.length;++j)
|
|
@@ -19927,7 +19945,7 @@ function OverlayKLineFrame()
|
|
|
19927
19945
|
|
|
19928
19946
|
var text=item.Message[1];
|
|
19929
19947
|
if (Array.isArray(item.Message[1])) text=item.Message[1][0];
|
|
19930
|
-
|
|
19948
|
+
this.Canvas.fillStyle=item.TextColor;
|
|
19931
19949
|
if (rightExtendText && rightExtendText.Align)
|
|
19932
19950
|
{
|
|
19933
19951
|
var textWidth=rightWidth;
|
|
@@ -19939,7 +19957,6 @@ function OverlayKLineFrame()
|
|
|
19939
19957
|
{
|
|
19940
19958
|
var xText=right+2;
|
|
19941
19959
|
if (rightLine && rightLine.Width>0) xText+=rightLine.Width;
|
|
19942
|
-
this.Canvas.fillStyle=item.TextColor;
|
|
19943
19960
|
this.Canvas.textAlign="left";
|
|
19944
19961
|
this.Canvas.fillText(text,xText,y);
|
|
19945
19962
|
}
|
|
@@ -33770,6 +33787,7 @@ function ChartKLineTable()
|
|
|
33770
33787
|
|
|
33771
33788
|
this.TextFont;
|
|
33772
33789
|
this.TextColor='rgb(0,0,0)';
|
|
33790
|
+
this.Style=0; //0=全部窗口模式 1=顶部指定行数 2=底部指定行数;
|
|
33773
33791
|
|
|
33774
33792
|
this.AryTableData=[];
|
|
33775
33793
|
this.MapCache=null; //key=date/date-time value={ Date:, Time:, Data:[ ] }
|
|
@@ -33795,9 +33813,15 @@ function ChartKLineTable()
|
|
|
33795
33813
|
{
|
|
33796
33814
|
if (!this.BGColor) return;
|
|
33797
33815
|
|
|
33798
|
-
|
|
33816
|
+
this.Canvas.fillStyle=this.BGColor;
|
|
33817
|
+
if ((this.Style===1 || this.Style===2) && this.RowHeightType==1)
|
|
33818
|
+
{
|
|
33819
|
+
var height=this.RowCount*this.RowHeight;
|
|
33820
|
+
height=Math.min(rtBG.Height,height);
|
|
33821
|
+
this.Canvas.fillRect(rtBG.Left+1, rtBG.Top, rtBG.Width-2, height);
|
|
33822
|
+
}
|
|
33823
|
+
else
|
|
33799
33824
|
{
|
|
33800
|
-
this.Canvas.fillStyle=this.BGColor;
|
|
33801
33825
|
this.Canvas.fillRect(rtBG.Left+1, rtBG.Top, rtBG.Width-1, rtBG.Height);
|
|
33802
33826
|
}
|
|
33803
33827
|
}
|
|
@@ -33806,8 +33830,11 @@ function ChartKLineTable()
|
|
|
33806
33830
|
{
|
|
33807
33831
|
if (!this.BorderColor) return;
|
|
33808
33832
|
|
|
33833
|
+
var lineCount=30;
|
|
33834
|
+
if (this.Style===1 || this.Style===2) lineCount=this.RowCount+1;
|
|
33835
|
+
|
|
33809
33836
|
var yLine=rtBG.Top;
|
|
33810
|
-
for(var i=0;i<
|
|
33837
|
+
for(var i=0;i<lineCount;++i)
|
|
33811
33838
|
{
|
|
33812
33839
|
this.Canvas.beginPath();
|
|
33813
33840
|
this.Canvas.moveTo(rtBG.Left,ToFixedPoint(yLine));
|
|
@@ -33857,12 +33884,29 @@ function ChartKLineTable()
|
|
|
33857
33884
|
var bottom=border.Bottom;
|
|
33858
33885
|
|
|
33859
33886
|
//绘制背景
|
|
33860
|
-
|
|
33861
|
-
|
|
33862
|
-
|
|
33863
|
-
|
|
33864
|
-
|
|
33887
|
+
if (this.Style===1)
|
|
33888
|
+
{
|
|
33889
|
+
var rtBG={ Left:border.LeftEx, Top:border.TopTitle, Right:border.RightEx, Bottom:border.TopEx };
|
|
33890
|
+
rtBG.Width=rtBG.Right-rtBG.Left;
|
|
33891
|
+
rtBG.Height=rtBG.Bottom-rtBG.Top;
|
|
33892
|
+
}
|
|
33893
|
+
else if (this.Style===2)
|
|
33894
|
+
{
|
|
33895
|
+
var rtBG={ Left:border.LeftEx, Top:border.BottomEx, Right:border.RightEx, Bottom:border.Bottom };
|
|
33896
|
+
rtBG.Width=rtBG.Right-rtBG.Left;
|
|
33897
|
+
rtBG.Height=rtBG.Bottom-rtBG.Top;
|
|
33898
|
+
top=rtBG.Top;
|
|
33899
|
+
}
|
|
33900
|
+
else
|
|
33901
|
+
{
|
|
33902
|
+
var rtBG={ Left:border.LeftEx, Top:top, Right:border.RightEx, Bottom:bottom };
|
|
33903
|
+
rtBG.Width=rtBG.Right-rtBG.Left;
|
|
33904
|
+
rtBG.Height=rtBG.Bottom-rtBG.Top;
|
|
33905
|
+
}
|
|
33906
|
+
|
|
33865
33907
|
this.CalculateRowHeight(rtBG);
|
|
33908
|
+
|
|
33909
|
+
this.DrawBG(rtBG);
|
|
33866
33910
|
|
|
33867
33911
|
var itemHeight=this.RowHeight;
|
|
33868
33912
|
var itemWidth=dataWidth+distanceWidth;
|
|
@@ -33895,7 +33939,7 @@ function ChartKLineTable()
|
|
|
33895
33939
|
if (!bDrawName) this.DrawRow(mapItem, top, bottom, left, right); //绘制一列
|
|
33896
33940
|
}
|
|
33897
33941
|
|
|
33898
|
-
if (this.RowNamePosition==3) this.DrawRightRowName();
|
|
33942
|
+
if (this.RowNamePosition==3) this.DrawRightRowName(rtBG);
|
|
33899
33943
|
|
|
33900
33944
|
this.DrawBorder(rtBG);
|
|
33901
33945
|
}
|
|
@@ -33942,20 +33986,51 @@ function ChartKLineTable()
|
|
|
33942
33986
|
}
|
|
33943
33987
|
|
|
33944
33988
|
//绘制右侧行名
|
|
33945
|
-
this.DrawRightRowName=function()
|
|
33989
|
+
this.DrawRightRowName=function(rtBG)
|
|
33946
33990
|
{
|
|
33947
33991
|
var border=this.ChartFrame.GetBorder();
|
|
33948
33992
|
|
|
33949
33993
|
if (this.BGColor)
|
|
33950
33994
|
{
|
|
33951
|
-
|
|
33952
|
-
|
|
33953
|
-
|
|
33954
|
-
|
|
33955
|
-
|
|
33995
|
+
if (this.Style===1)
|
|
33996
|
+
{
|
|
33997
|
+
var height=this.RowCount*this.RowHeight;
|
|
33998
|
+
height=Math.min(rtBG.Height,height);
|
|
33999
|
+
var width=border.ChartWidth-rtBG.Right-2;
|
|
34000
|
+
var maxTextWidth=0;
|
|
34001
|
+
for(var i=0;i<this.RowName.length;++i)
|
|
34002
|
+
{
|
|
34003
|
+
var item=this.RowName[i];
|
|
34004
|
+
if (!item || !item.Name) continue;
|
|
34005
|
+
|
|
34006
|
+
var textWidth=this.Canvas.measureText(item.Name).width;
|
|
34007
|
+
if (textWidth>maxTextWidth) maxTextWidth=textWidth;
|
|
34008
|
+
}
|
|
34009
|
+
if (maxTextWidth>0)
|
|
34010
|
+
{
|
|
34011
|
+
maxTextWidth+=4;
|
|
34012
|
+
width=Math.min(width, maxTextWidth);
|
|
34013
|
+
}
|
|
34014
|
+
|
|
34015
|
+
var rtRightBG={Left:rtBG.Right+1, Top:rtBG.Top+1, Width:width, Height:height };
|
|
34016
|
+
rtRightBG.Right=rtRightBG.Left+rtRightBG.Width;
|
|
34017
|
+
rtRightBG.Bottom=rtRightBG.Top+rtRightBG.Height;
|
|
34018
|
+
|
|
34019
|
+
|
|
34020
|
+
this.Canvas.fillStyle=this.BGColor;
|
|
34021
|
+
this.Canvas.fillRect(rtRightBG.Left, rtRightBG.Top, rtRightBG.Width, rtRightBG.Height);
|
|
34022
|
+
}
|
|
34023
|
+
else
|
|
34024
|
+
{
|
|
34025
|
+
var rtRightBG={Left:border.RightEx, Top:border.Top, Right:border.ChartWidth, Bottom:border.Bottom };
|
|
34026
|
+
rtRightBG.Width=rtRightBG.Right-rtRightBG.Left;
|
|
34027
|
+
rtRightBG.Height=rtRightBG.Bottom-rtRightBG.Top;
|
|
34028
|
+
this.Canvas.fillStyle=this.BGColor;
|
|
34029
|
+
this.Canvas.fillRect(rtRightBG.Left+1, rtRightBG.Top, rtRightBG.Width-2, rtRightBG.Height);
|
|
34030
|
+
}
|
|
33956
34031
|
}
|
|
33957
34032
|
|
|
33958
|
-
var x=
|
|
34033
|
+
var x=rtBG.Right, y=rtBG.Top;
|
|
33959
34034
|
var yOffset=3;
|
|
33960
34035
|
if (this.ItemMergin.YOffset) yOffset=this.ItemMergin.YOffset;
|
|
33961
34036
|
for(var i=0;i<this.RowName.length;++i)
|
|
@@ -64303,9 +64378,14 @@ function IChartDrawPicture()
|
|
|
64303
64378
|
pt.X=this.Frame.GetXFromIndex(item.XValue-data.DataOffset);
|
|
64304
64379
|
pt.Y=this.Frame.GetYFromData(item.YValue);
|
|
64305
64380
|
}
|
|
64381
|
+
|
|
64382
|
+
if (Path2DHelper.PtInPoint(x,y,pt,radius))
|
|
64383
|
+
return i;
|
|
64384
|
+
/*
|
|
64306
64385
|
this.Canvas.beginPath();
|
|
64307
64386
|
this.Canvas.arc(pt.X,pt.Y,radius,0,360);
|
|
64308
64387
|
if (this.Canvas.isPointInPath(x,y)) return i;
|
|
64388
|
+
*/
|
|
64309
64389
|
}
|
|
64310
64390
|
|
|
64311
64391
|
return -1;
|
|
@@ -64323,6 +64403,20 @@ function IChartDrawPicture()
|
|
|
64323
64403
|
var pixel=GetDevicePixelRatio();
|
|
64324
64404
|
lineWidth*=pixel;
|
|
64325
64405
|
for(var i=0;i<this.LinePoint.length; ++i)
|
|
64406
|
+
{
|
|
64407
|
+
var item=this.LinePoint[i];
|
|
64408
|
+
var ptStart=item.Start;
|
|
64409
|
+
var ptEnd=item.End;
|
|
64410
|
+
|
|
64411
|
+
if (Path2DHelper.PtInLine(x, y, ptStart, ptEnd, lineWidth))
|
|
64412
|
+
{
|
|
64413
|
+
return i;
|
|
64414
|
+
}
|
|
64415
|
+
}
|
|
64416
|
+
return -1;
|
|
64417
|
+
|
|
64418
|
+
/*
|
|
64419
|
+
for(var i=0;i<this.LinePoint.length; ++i)
|
|
64326
64420
|
{
|
|
64327
64421
|
var item=this.LinePoint[i];
|
|
64328
64422
|
var ptStart=item.Start;
|
|
@@ -64351,6 +64445,7 @@ function IChartDrawPicture()
|
|
|
64351
64445
|
}
|
|
64352
64446
|
|
|
64353
64447
|
return -1;
|
|
64448
|
+
*/
|
|
64354
64449
|
}
|
|
64355
64450
|
|
|
64356
64451
|
//0-10 鼠标对应的点索引 100=鼠标在正个图形上 -1 鼠标不在图形上
|
|
@@ -67044,6 +67139,18 @@ function ChartDrawPictureRect()
|
|
|
67044
67139
|
//点是否在线段上 水平线段
|
|
67045
67140
|
this.IsPointInLine=function(aryPoint,x,y,option)
|
|
67046
67141
|
{
|
|
67142
|
+
var lineWidth=5;
|
|
67143
|
+
var pixel=GetDevicePixelRatio();
|
|
67144
|
+
if (IFrameSplitOperator.IsPlusNumber(this.LineWidth) && this.LineWidth>lineWidth) lineWidth=this.LineWidth;
|
|
67145
|
+
if (option && IFrameSplitOperator.IsNumber(option.Zoom)) lineWidth+=option.Zoom;
|
|
67146
|
+
else if (this.Option && IFrameSplitOperator.IsNumber(this.Option.Zoom)) lineWidth+=this.Option.Zoom;
|
|
67147
|
+
lineWidth*=pixel;
|
|
67148
|
+
if (Path2DHelper.PtInLine(x,y,aryPoint[0], aryPoint[1], lineWidth))
|
|
67149
|
+
return true;
|
|
67150
|
+
|
|
67151
|
+
return false;
|
|
67152
|
+
|
|
67153
|
+
/*
|
|
67047
67154
|
var radius=5;
|
|
67048
67155
|
if (option && IFrameSplitOperator.IsNumber(option.Zoom)) radius+=option.Zoom;
|
|
67049
67156
|
else if (this.Option && IFrameSplitOperator.IsNumber(this.Option.Zoom)) radius+=this.Option.Zoom;
|
|
@@ -67058,11 +67165,14 @@ function ChartDrawPictureRect()
|
|
|
67058
67165
|
this.Canvas.closePath();
|
|
67059
67166
|
if (this.Canvas.isPointInPath(x,y))
|
|
67060
67167
|
return true;
|
|
67168
|
+
*/
|
|
67061
67169
|
}
|
|
67062
67170
|
|
|
67063
67171
|
//垂直线段
|
|
67064
67172
|
this.IsPointInLine2=function(aryPoint,x,y,option)
|
|
67065
67173
|
{
|
|
67174
|
+
return this.IsPointInLine(aryPoint,x,y,option);
|
|
67175
|
+
/*
|
|
67066
67176
|
var radius=5;
|
|
67067
67177
|
if (option && IFrameSplitOperator.IsNumber(option.Zoom)) radius+=option.Zoom;
|
|
67068
67178
|
else if (this.Option && IFrameSplitOperator.IsNumber(this.Option.Zoom)) radius+=this.Option.Zoom;
|
|
@@ -67077,6 +67187,7 @@ function ChartDrawPictureRect()
|
|
|
67077
67187
|
this.Canvas.closePath();
|
|
67078
67188
|
if (this.Canvas.isPointInPath(x,y))
|
|
67079
67189
|
return true;
|
|
67190
|
+
*/
|
|
67080
67191
|
}
|
|
67081
67192
|
}
|
|
67082
67193
|
|
|
@@ -80721,6 +80832,13 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
80721
80832
|
this.PopMinuteChart=null;
|
|
80722
80833
|
}
|
|
80723
80834
|
|
|
80835
|
+
this.ClosePopMinuteChart=function()
|
|
80836
|
+
{
|
|
80837
|
+
if (!this.PopMinuteChart) return;
|
|
80838
|
+
|
|
80839
|
+
this.PopMinuteChart.Close();
|
|
80840
|
+
}
|
|
80841
|
+
|
|
80724
80842
|
this.ShowMinuteChartDialog=function(data, x,y)
|
|
80725
80843
|
{
|
|
80726
80844
|
if (!this.PopMinuteChart) return;
|
|
@@ -83309,6 +83427,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
83309
83427
|
//周期切换
|
|
83310
83428
|
this.ChangePeriod=function(period,option)
|
|
83311
83429
|
{
|
|
83430
|
+
this.ClosePopMinuteChart();
|
|
83431
|
+
|
|
83312
83432
|
var oldData={ Period:this.Period, Right:this.Right, KLineDrawType:this.KLineDrawType, Symbol:this.Symbol};
|
|
83313
83433
|
|
|
83314
83434
|
var isChangeKLineDrawType=false;
|
|
@@ -84867,6 +84987,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
84867
84987
|
this.ClearIndexRunCount();
|
|
84868
84988
|
this.UnlockCorssCursor();
|
|
84869
84989
|
this.Frame.ClearYCoordinateMaxMin();
|
|
84990
|
+
this.ClosePopMinuteChart();
|
|
84870
84991
|
|
|
84871
84992
|
|
|
84872
84993
|
this.Symbol=symbol;
|
|
@@ -103115,6 +103236,117 @@ function GetLocalTime(i) //得到标准时区的时间的函数
|
|
|
103115
103236
|
return new Date(utcTime + 3600000 * i);
|
|
103116
103237
|
}
|
|
103117
103238
|
|
|
103239
|
+
//图形路径方法
|
|
103240
|
+
function Path2DHelper() { }
|
|
103241
|
+
const PI2 = Math.PI * 2;
|
|
103242
|
+
|
|
103243
|
+
//点是否在线段上
|
|
103244
|
+
Path2DHelper.PtInLine=function(x, y, pt, pt2, lineWidth)
|
|
103245
|
+
{
|
|
103246
|
+
if (lineWidth<=0) return false;
|
|
103247
|
+
|
|
103248
|
+
var x0=pt.X, y0=pt.Y;
|
|
103249
|
+
var x1=pt2.X, y1=pt2.Y;
|
|
103250
|
+
|
|
103251
|
+
const _l = lineWidth;
|
|
103252
|
+
let _a = 0;
|
|
103253
|
+
let _b = x0;
|
|
103254
|
+
|
|
103255
|
+
// Quick reject
|
|
103256
|
+
if (
|
|
103257
|
+
(y > y0 + _l && y > y1 + _l)
|
|
103258
|
+
|| (y < y0 - _l && y < y1 - _l)
|
|
103259
|
+
|| (x > x0 + _l && x > x1 + _l)
|
|
103260
|
+
|| (x < x0 - _l && x < x1 - _l)
|
|
103261
|
+
)
|
|
103262
|
+
{
|
|
103263
|
+
return false;
|
|
103264
|
+
}
|
|
103265
|
+
|
|
103266
|
+
if (x0 !== x1)
|
|
103267
|
+
{
|
|
103268
|
+
_a = (y0 - y1) / (x0 - x1);
|
|
103269
|
+
_b = (x0 * y1 - x1 * y0) / (x0 - x1);
|
|
103270
|
+
}
|
|
103271
|
+
else
|
|
103272
|
+
{
|
|
103273
|
+
return Math.abs(x - x0) <= _l / 2;
|
|
103274
|
+
}
|
|
103275
|
+
|
|
103276
|
+
const tmp = _a * x - y + _b;
|
|
103277
|
+
const _s = tmp * tmp / (_a * _a + 1);
|
|
103278
|
+
return _s <= _l / 2 * _l / 2;
|
|
103279
|
+
}
|
|
103280
|
+
|
|
103281
|
+
//点是否在圆点上
|
|
103282
|
+
Path2DHelper.PtInPoint=function(x,y, ptCenter, radius)
|
|
103283
|
+
{
|
|
103284
|
+
if (radius<=0) return false;
|
|
103285
|
+
|
|
103286
|
+
var cx=ptCenter.X;
|
|
103287
|
+
var cy=ptCenter.Y;
|
|
103288
|
+
|
|
103289
|
+
x -= cx;
|
|
103290
|
+
y -= cy;
|
|
103291
|
+
const d = Math.sqrt(x * x + y * y); //到圆心的距离
|
|
103292
|
+
|
|
103293
|
+
if (d>radius) return false;
|
|
103294
|
+
|
|
103295
|
+
return true;
|
|
103296
|
+
}
|
|
103297
|
+
|
|
103298
|
+
Path2DHelper.PtInArc=function(x, y, ptCenter, radius, startAngle, endAngle,lineWidth, anticlockwise)
|
|
103299
|
+
{
|
|
103300
|
+
if (lineWidth<=0) return false;
|
|
103301
|
+
|
|
103302
|
+
const _l = lineWidth;
|
|
103303
|
+
var cx=ptCenter.X;
|
|
103304
|
+
var cy=ptCenter.Y;
|
|
103305
|
+
|
|
103306
|
+
x -= cx;
|
|
103307
|
+
y -= cy;
|
|
103308
|
+
const d = Math.sqrt(x * x + y * y);
|
|
103309
|
+
|
|
103310
|
+
if ((d - _l > r) || (d + _l < r))
|
|
103311
|
+
return false;
|
|
103312
|
+
|
|
103313
|
+
// TODO
|
|
103314
|
+
if (Math.abs(startAngle - endAngle) % PI2 < 1e-4)
|
|
103315
|
+
{
|
|
103316
|
+
// Is a circle
|
|
103317
|
+
return true;
|
|
103318
|
+
}
|
|
103319
|
+
|
|
103320
|
+
if (anticlockwise)
|
|
103321
|
+
{
|
|
103322
|
+
const tmp = startAngle;
|
|
103323
|
+
startAngle = Path2DHelper.FormatRadian(endAngle);
|
|
103324
|
+
endAngle = Path2DHelper.FormatRadian(tmp);
|
|
103325
|
+
}
|
|
103326
|
+
else
|
|
103327
|
+
{
|
|
103328
|
+
startAngle = Path2DHelper.FormatRadian(startAngle);
|
|
103329
|
+
endAngle = Path2DHelper.FormatRadian(endAngle);
|
|
103330
|
+
}
|
|
103331
|
+
|
|
103332
|
+
if (startAngle > endAngle)
|
|
103333
|
+
endAngle += PI2;
|
|
103334
|
+
|
|
103335
|
+
var angle = Math.atan2(y, x);
|
|
103336
|
+
if (angle < 0)
|
|
103337
|
+
angle += PI2;
|
|
103338
|
+
|
|
103339
|
+
return (angle >= startAngle && angle <= endAngle) || (angle + PI2 >= startAngle && angle + PI2 <= endAngle);
|
|
103340
|
+
}
|
|
103341
|
+
|
|
103342
|
+
//统一弧度方向
|
|
103343
|
+
Path2DHelper.FormatRadian=function(angle)
|
|
103344
|
+
{
|
|
103345
|
+
angle%= PI2;
|
|
103346
|
+
if (angle<0) angle += PI2;
|
|
103347
|
+
return angle;
|
|
103348
|
+
}
|
|
103349
|
+
|
|
103118
103350
|
|
|
103119
103351
|
|
|
103120
103352
|
|