hqchart 1.1.14817 → 1.1.14824

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.
@@ -7413,6 +7413,73 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7413
7413
  this.FastSlideConfig={ MinDistance:500, MinSpeed:3, MaxTime:250, Enable:false }; //快速滑动配置 MinDistance=最小的距离 MinSpeed=最小速度 MaxTime=最大间隔时间(ms)
7414
7414
  this.KeyboardMove={ Timer:null, Delay:100 , Enable:false, Event:null }; //键盘左右移动
7415
7415
 
7416
+ this.MapEventListenerCache=new Map(); //addEventListener 监听事件 key=type:"keydown|keyup ....", value:{ Callback:, Option: }
7417
+
7418
+ this.AddEventListener=function(eventTarget, type, listener, option)
7419
+ {
7420
+ if (!eventTarget || !type || !listener) return false;
7421
+
7422
+ var callback=listener.bind(this);
7423
+ var item={ Callback:callback, Option:option, Type:type, Element:eventTarget };
7424
+
7425
+ eventTarget.addEventListener(type, callback, option);
7426
+
7427
+ this.MapEventListenerCache.set(item.Type, item);
7428
+
7429
+ return true;
7430
+ }
7431
+
7432
+ this.RemoveEventListener=function(eventTarget, type)
7433
+ {
7434
+ if (!eventTarget || !type) return false;
7435
+ if (!this.MapEventListenerCache.has(type)) return false;
7436
+
7437
+ var item=this.MapEventListenerCache.get(type);
7438
+ if (!item.Element || !item.Callback) return false;
7439
+
7440
+ this.MapEventListenerCache.delete(item.Type);
7441
+ item.Element.removeEventListener(item.Type, item.Callback, item.Option);
7442
+ }
7443
+
7444
+ //option={ KeyDown:, Wheel }
7445
+ this.AddDefaultEventListener=function(option)
7446
+ {
7447
+ var bRegisterKeydown=true;
7448
+ var bRegisterWheel=true;
7449
+
7450
+ if (option)
7451
+ {
7452
+ if (IFrameSplitOperator.IsBool(option.KeyDown)) bRegisterKeydown=option.KeyDown;
7453
+ if (IFrameSplitOperator.IsBool(option.Wheel)) bRegisterWheel=option.Wheel;
7454
+ }
7455
+
7456
+ if (bRegisterKeydown)
7457
+ {
7458
+ this.AddEventListener(this.UIElement,"keydown", this.OnKeyDown, true);
7459
+ this.AddEventListener(this.UIElement,"keyup", this.OnKeyUp, true);
7460
+ }
7461
+
7462
+ if (bRegisterWheel)
7463
+ {
7464
+ this.AddEventListener(this.UIElement,"wheel", this.OnWheel, true);
7465
+ }
7466
+
7467
+ JSConsole.Chart.Log(`[JSChartContainer::AddDefaultEventListener] [keydown,keyup]=${bRegisterKeydown}, [wheel]=${bRegisterWheel}`);
7468
+ }
7469
+
7470
+ this.RemoveAllEventListener=function()
7471
+ {
7472
+ for(var mapItem of this.MapEventListenerCache)
7473
+ {
7474
+ var item=mapItem[1];
7475
+ if (!item.Element || !item.Callback) continue;
7476
+
7477
+ item.Element.removeEventListener(item.Type, item.Callback, item.Option);
7478
+ }
7479
+
7480
+ this.MapEventListenerCache.clear();
7481
+ }
7482
+
7416
7483
  this.RestoreFocus=function(delay)
7417
7484
  {
7418
7485
  var value=1000;
@@ -7716,6 +7783,14 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7716
7783
  this.DialogModifyDraw=null;
7717
7784
  }
7718
7785
 
7786
+ this.DestroyPopMenu=function()
7787
+ {
7788
+ if (!this.JSPopMenu) return;
7789
+
7790
+ this.JSPopMenu.Destroy();
7791
+ this.JSPopMenu=null;
7792
+ }
7793
+
7719
7794
  //隐藏内置的弹框div
7720
7795
  this.HideAllPopDiv=function()
7721
7796
  {
@@ -7791,6 +7866,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7791
7866
  this.DestroyDialogModifyDraw();
7792
7867
 
7793
7868
  this.DestroyDialogSelectRect();
7869
+
7870
+ this.DestroyPopMenu();
7871
+
7872
+ document.oncontextmenu=null;
7873
+ this.RemoveAllEventListener();
7794
7874
  }
7795
7875
 
7796
7876
  this.ChartDestory=this.ChartDestroy; //老版本写错了,需要兼容下
@@ -16128,6 +16208,12 @@ function OnKeyDown(e) //键盘事件
16128
16208
  this.JSChartContainer.OnKeyDown(e);
16129
16209
  }
16130
16210
 
16211
+ function OnKeyUp(e) //键盘事件
16212
+ {
16213
+ if(this.JSChartContainer && this.JSChartContainer.OnKeyUp)
16214
+ this.JSChartContainer.OnKeyUp(e);
16215
+ }
16216
+
16131
16217
  function OnWheel(e) //上下滚动事件
16132
16218
  {
16133
16219
  if(this.JSChartContainer && this.JSChartContainer.OnWheel)
@@ -84047,32 +84133,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
84047
84133
  this.ChartCorssCursor.StringFormatX.Frame=this.Frame.SubFrame[0].Frame;
84048
84134
  this.ChartCorssCursor.StringFormatY.Frame=this.Frame;
84049
84135
 
84050
- var bRegisterKeydown=true;
84051
- var bRegisterWheel=true;
84052
-
84053
- if (option && option.Listener)
84054
- {
84055
- var item=option.Listener;
84056
- if (item.KeyDown===false)
84057
- {
84058
- bRegisterKeydown=false;
84059
- JSConsole.Chart.Log('[KLineChartContainer::Create] not register keydown event.');
84060
- }
84061
-
84062
- if (item.Wheel===false)
84063
- {
84064
- bRegisterWheel=false;
84065
- JSConsole.Chart.Log('[KLineChartContainer::Create] not register wheel event.');
84066
- }
84067
- }
84068
-
84069
- if (bRegisterKeydown)
84070
- {
84071
- this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
84072
- this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
84073
- }
84074
-
84075
- if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
84136
+ if (option) this.AddDefaultEventListener(option.Listener);
84076
84137
 
84077
84138
  this.InitalPopMinuteChart(option);
84078
84139
  }
@@ -93954,27 +94015,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
93954
94015
  if (this.ChartCorssCursor.CallAcutionXOperator)
93955
94016
  this.ChartCorssCursor.CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;
93956
94017
 
93957
- var bRegisterKeydown=true;
93958
- var bRegisterWheel=true;
93959
-
93960
- if (option && option.Listener)
93961
- {
93962
- var item=option.Listener;
93963
- if (item.KeyDown===false)
93964
- {
93965
- bRegisterKeydown=false;
93966
- JSConsole.Chart.Log('[MinuteChartContainer::Create] not register keydown event.');
93967
- }
93968
-
93969
- if (item.Wheel===false)
93970
- {
93971
- bRegisterWheel=false;
93972
- JSConsole.Chart.Log('[MinuteChartContainer::Create] not register wheel event.');
93973
- }
93974
- }
93975
-
93976
- if (bRegisterKeydown) this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e);} , true); //键盘消息
93977
- if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
94018
+ if (option) this.AddDefaultEventListener(option.Listener);
93978
94019
  }
93979
94020
 
93980
94021
  //创建子窗口
@@ -95870,7 +95911,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
95870
95911
  return;
95871
95912
  }
95872
95913
 
95873
- if (this.IsOnTouch==true) //正在操作中不更新数据
95914
+ if (this.IsOnTouch==true || this.IsPressKeyboard==true) //正在操作中不更新数据
95874
95915
  {
95875
95916
  if (this.SourceData && IFrameSplitOperator.IsNonEmptyArray(this.SourceData.Data))
95876
95917
  {
@@ -99503,7 +99544,7 @@ function KLineChartHScreenContainer(uielement)
99503
99544
  this.TitlePaint.push(titlePaint);
99504
99545
  }
99505
99546
 
99506
- this.UIElement.addEventListener("keydown", OnKeyDown, true); //键盘消息
99547
+ this.AddDefaultEventListener({ KeyDown:true, Wheel:false });
99507
99548
  }
99508
99549
 
99509
99550
  //创建子窗口
@@ -99691,7 +99732,7 @@ function MinuteChartHScreenContainer(uielement)
99691
99732
  this.ChartCorssCursor.StringFormatY.Frame=this.Frame;
99692
99733
  this.ChartCorssCursor.CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;
99693
99734
 
99694
- this.UIElement.addEventListener("keydown", OnKeyDown, true); //键盘消息
99735
+ this.AddDefaultEventListener({ KeyDown:false, Wheel:false });
99695
99736
  }
99696
99737
 
99697
99738
  //创建子窗口
@@ -99849,28 +99890,12 @@ function DepthChartContainer(uielement)
99849
99890
  chartItem.Name="深度图"
99850
99891
  this.ChartPaint.push(chartItem);
99851
99892
 
99852
- var bRegisterKeydown=true;
99853
- var bRegisterWheel=true;
99854
- if (option)
99855
- {
99856
- if (option.Wheel===false)
99857
- {
99858
- bRegisterWheel=false;
99859
- JSConsole.Chart.Log('[DepthChartContainer::Create] not register wheel event.');
99860
- }
99861
- }
99862
-
99863
- if (bRegisterKeydown)
99864
- {
99865
- this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
99866
- this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
99867
- }
99868
- if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
99893
+ if (option) this.AddDefaultEventListener(option.Listener);
99869
99894
  }
99870
99895
 
99871
99896
  this.OnWheel=function(e)
99872
99897
  {
99873
- JSConsole.Chart.Log('[KLineChartContainer::OnWheel]',e);
99898
+ JSConsole.Chart.Log('[DepthChartContainer::OnWheel]',e);
99874
99899
  var x = e.clientX-this.UIElement.getBoundingClientRect().left;
99875
99900
  var y = e.clientY-this.UIElement.getBoundingClientRect().top;
99876
99901
 
@@ -152876,6 +152901,8 @@ function JSPopMenu()
152876
152901
 
152877
152902
  this.RestoreFocusDelay=1000;
152878
152903
 
152904
+ this.MouseDownlistenerPtr=null;
152905
+
152879
152906
  this.AryTDClassName=
152880
152907
  [
152881
152908
  "UMyChart_MenuItem_Td_Status", //图标
@@ -152887,7 +152914,13 @@ function JSPopMenu()
152887
152914
  this.Inital=function(hqchart, option)
152888
152915
  {
152889
152916
  this.HQChart=hqchart;
152890
- window.addEventListener('mousedown', (e)=>{ this.OnWindowMouseDown(e)});
152917
+ this.MouseDownlistenerPtr=this.OnWindowMouseDown.bind(this);
152918
+ window.addEventListener('mousedown', this.MouseDownlistenerPtr);
152919
+ }
152920
+
152921
+ this.Destroy=function()
152922
+ {
152923
+ if (this.MouseDownlistenerPtr) window.removeEventListener('mousedown', this.MouseDownlistenerPtr);
152891
152924
  }
152892
152925
 
152893
152926
  //创建菜单
@@ -153917,7 +153950,7 @@ function JSDialogModifyDraw()
153917
153950
  this.ColorButton=null;
153918
153951
  if (this.DivDialog)
153919
153952
  {
153920
- document.body.remove(this.DivDialog);
153953
+ document.body.removeChild(this.DivDialog);
153921
153954
  this.DivDialog=null;
153922
153955
  }
153923
153956
  }
@@ -160048,7 +160081,7 @@ function JSDialogModifyIndexParam()
160048
160081
 
160049
160082
  if (this.DivDialog)
160050
160083
  {
160051
- document.body.removeChild(this.DivDialog);
160084
+ if (document && document.body && document.body.removeChild) document.body.removeChild(this.DivDialog);
160052
160085
  this.DivDialog=null;
160053
160086
  }
160054
160087
  }
@@ -160568,7 +160601,7 @@ function HQChartScriptWorker()
160568
160601
 
160569
160602
 
160570
160603
 
160571
- var HQCHART_VERSION="1.1.14816";
160604
+ var HQCHART_VERSION="1.1.14823";
160572
160605
 
160573
160606
  function PrintHQChartVersion()
160574
160607
  {