hqchart 1.1.14820 → 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; //老版本写错了,需要兼容下
@@ -84053,32 +84133,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
84053
84133
  this.ChartCorssCursor.StringFormatX.Frame=this.Frame.SubFrame[0].Frame;
84054
84134
  this.ChartCorssCursor.StringFormatY.Frame=this.Frame;
84055
84135
 
84056
- var bRegisterKeydown=true;
84057
- var bRegisterWheel=true;
84058
-
84059
- if (option && option.Listener)
84060
- {
84061
- var item=option.Listener;
84062
- if (item.KeyDown===false)
84063
- {
84064
- bRegisterKeydown=false;
84065
- JSConsole.Chart.Log('[KLineChartContainer::Create] not register keydown event.');
84066
- }
84067
-
84068
- if (item.Wheel===false)
84069
- {
84070
- bRegisterWheel=false;
84071
- JSConsole.Chart.Log('[KLineChartContainer::Create] not register wheel event.');
84072
- }
84073
- }
84074
-
84075
- if (bRegisterKeydown)
84076
- {
84077
- this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
84078
- this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
84079
- }
84080
-
84081
- if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
84136
+ if (option) this.AddDefaultEventListener(option.Listener);
84082
84137
 
84083
84138
  this.InitalPopMinuteChart(option);
84084
84139
  }
@@ -93960,31 +94015,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
93960
94015
  if (this.ChartCorssCursor.CallAcutionXOperator)
93961
94016
  this.ChartCorssCursor.CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;
93962
94017
 
93963
- var bRegisterKeydown=true;
93964
- var bRegisterWheel=true;
93965
-
93966
- if (option && option.Listener)
93967
- {
93968
- var item=option.Listener;
93969
- if (item.KeyDown===false)
93970
- {
93971
- bRegisterKeydown=false;
93972
- JSConsole.Chart.Log('[MinuteChartContainer::Create] not register keydown event.');
93973
- }
93974
-
93975
- if (item.Wheel===false)
93976
- {
93977
- bRegisterWheel=false;
93978
- JSConsole.Chart.Log('[MinuteChartContainer::Create] not register wheel event.');
93979
- }
93980
- }
93981
-
93982
- if (bRegisterKeydown)
93983
- {
93984
- this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e);} , true); //键盘消息
93985
- this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
93986
- }
93987
- if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
94018
+ if (option) this.AddDefaultEventListener(option.Listener);
93988
94019
  }
93989
94020
 
93990
94021
  //创建子窗口
@@ -99513,8 +99544,7 @@ function KLineChartHScreenContainer(uielement)
99513
99544
  this.TitlePaint.push(titlePaint);
99514
99545
  }
99515
99546
 
99516
- this.UIElement.addEventListener("keydown", OnKeyDown, true); //键盘消息
99517
- this.UIElement.addEventListener("keyup", OnKeyUp, true);
99547
+ this.AddDefaultEventListener({ KeyDown:true, Wheel:false });
99518
99548
  }
99519
99549
 
99520
99550
  //创建子窗口
@@ -99702,8 +99732,7 @@ function MinuteChartHScreenContainer(uielement)
99702
99732
  this.ChartCorssCursor.StringFormatY.Frame=this.Frame;
99703
99733
  this.ChartCorssCursor.CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;
99704
99734
 
99705
- this.UIElement.addEventListener("keydown", OnKeyDown, true); //键盘消息
99706
- this.UIElement.addEventListener("keyup", OnKeyUp, true);
99735
+ this.AddDefaultEventListener({ KeyDown:false, Wheel:false });
99707
99736
  }
99708
99737
 
99709
99738
  //创建子窗口
@@ -99861,28 +99890,12 @@ function DepthChartContainer(uielement)
99861
99890
  chartItem.Name="深度图"
99862
99891
  this.ChartPaint.push(chartItem);
99863
99892
 
99864
- var bRegisterKeydown=true;
99865
- var bRegisterWheel=true;
99866
- if (option)
99867
- {
99868
- if (option.Wheel===false)
99869
- {
99870
- bRegisterWheel=false;
99871
- JSConsole.Chart.Log('[DepthChartContainer::Create] not register wheel event.');
99872
- }
99873
- }
99874
-
99875
- if (bRegisterKeydown)
99876
- {
99877
- this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
99878
- this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
99879
- }
99880
- if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
99893
+ if (option) this.AddDefaultEventListener(option.Listener);
99881
99894
  }
99882
99895
 
99883
99896
  this.OnWheel=function(e)
99884
99897
  {
99885
- JSConsole.Chart.Log('[KLineChartContainer::OnWheel]',e);
99898
+ JSConsole.Chart.Log('[DepthChartContainer::OnWheel]',e);
99886
99899
  var x = e.clientX-this.UIElement.getBoundingClientRect().left;
99887
99900
  var y = e.clientY-this.UIElement.getBoundingClientRect().top;
99888
99901
 
@@ -152888,6 +152901,8 @@ function JSPopMenu()
152888
152901
 
152889
152902
  this.RestoreFocusDelay=1000;
152890
152903
 
152904
+ this.MouseDownlistenerPtr=null;
152905
+
152891
152906
  this.AryTDClassName=
152892
152907
  [
152893
152908
  "UMyChart_MenuItem_Td_Status", //图标
@@ -152899,7 +152914,13 @@ function JSPopMenu()
152899
152914
  this.Inital=function(hqchart, option)
152900
152915
  {
152901
152916
  this.HQChart=hqchart;
152902
- 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);
152903
152924
  }
152904
152925
 
152905
152926
  //创建菜单
@@ -160580,7 +160601,7 @@ function HQChartScriptWorker()
160580
160601
 
160581
160602
 
160582
160603
 
160583
- var HQCHART_VERSION="1.1.14819";
160604
+ var HQCHART_VERSION="1.1.14823";
160584
160605
 
160585
160606
  function PrintHQChartVersion()
160586
160607
  {