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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.14820",
3
+ "version": "1.1.14824",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -3273,6 +3273,73 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3273
3273
  this.FastSlideConfig={ MinDistance:500, MinSpeed:3, MaxTime:250, Enable:false }; //快速滑动配置 MinDistance=最小的距离 MinSpeed=最小速度 MaxTime=最大间隔时间(ms)
3274
3274
  this.KeyboardMove={ Timer:null, Delay:100 , Enable:false, Event:null }; //键盘左右移动
3275
3275
 
3276
+ this.MapEventListenerCache=new Map(); //addEventListener 监听事件 key=type:"keydown|keyup ....", value:{ Callback:, Option: }
3277
+
3278
+ this.AddEventListener=function(eventTarget, type, listener, option)
3279
+ {
3280
+ if (!eventTarget || !type || !listener) return false;
3281
+
3282
+ var callback=listener.bind(this);
3283
+ var item={ Callback:callback, Option:option, Type:type, Element:eventTarget };
3284
+
3285
+ eventTarget.addEventListener(type, callback, option);
3286
+
3287
+ this.MapEventListenerCache.set(item.Type, item);
3288
+
3289
+ return true;
3290
+ }
3291
+
3292
+ this.RemoveEventListener=function(eventTarget, type)
3293
+ {
3294
+ if (!eventTarget || !type) return false;
3295
+ if (!this.MapEventListenerCache.has(type)) return false;
3296
+
3297
+ var item=this.MapEventListenerCache.get(type);
3298
+ if (!item.Element || !item.Callback) return false;
3299
+
3300
+ this.MapEventListenerCache.delete(item.Type);
3301
+ item.Element.removeEventListener(item.Type, item.Callback, item.Option);
3302
+ }
3303
+
3304
+ //option={ KeyDown:, Wheel }
3305
+ this.AddDefaultEventListener=function(option)
3306
+ {
3307
+ var bRegisterKeydown=true;
3308
+ var bRegisterWheel=true;
3309
+
3310
+ if (option)
3311
+ {
3312
+ if (IFrameSplitOperator.IsBool(option.KeyDown)) bRegisterKeydown=option.KeyDown;
3313
+ if (IFrameSplitOperator.IsBool(option.Wheel)) bRegisterWheel=option.Wheel;
3314
+ }
3315
+
3316
+ if (bRegisterKeydown)
3317
+ {
3318
+ this.AddEventListener(this.UIElement,"keydown", this.OnKeyDown, true);
3319
+ this.AddEventListener(this.UIElement,"keyup", this.OnKeyUp, true);
3320
+ }
3321
+
3322
+ if (bRegisterWheel)
3323
+ {
3324
+ this.AddEventListener(this.UIElement,"wheel", this.OnWheel, true);
3325
+ }
3326
+
3327
+ JSConsole.Chart.Log(`[JSChartContainer::AddDefaultEventListener] [keydown,keyup]=${bRegisterKeydown}, [wheel]=${bRegisterWheel}`);
3328
+ }
3329
+
3330
+ this.RemoveAllEventListener=function()
3331
+ {
3332
+ for(var mapItem of this.MapEventListenerCache)
3333
+ {
3334
+ var item=mapItem[1];
3335
+ if (!item.Element || !item.Callback) continue;
3336
+
3337
+ item.Element.removeEventListener(item.Type, item.Callback, item.Option);
3338
+ }
3339
+
3340
+ this.MapEventListenerCache.clear();
3341
+ }
3342
+
3276
3343
  this.RestoreFocus=function(delay)
3277
3344
  {
3278
3345
  var value=1000;
@@ -3576,6 +3643,14 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3576
3643
  this.DialogModifyDraw=null;
3577
3644
  }
3578
3645
 
3646
+ this.DestroyPopMenu=function()
3647
+ {
3648
+ if (!this.JSPopMenu) return;
3649
+
3650
+ this.JSPopMenu.Destroy();
3651
+ this.JSPopMenu=null;
3652
+ }
3653
+
3579
3654
  //隐藏内置的弹框div
3580
3655
  this.HideAllPopDiv=function()
3581
3656
  {
@@ -3651,6 +3726,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3651
3726
  this.DestroyDialogModifyDraw();
3652
3727
 
3653
3728
  this.DestroyDialogSelectRect();
3729
+
3730
+ this.DestroyPopMenu();
3731
+
3732
+ document.oncontextmenu=null;
3733
+ this.RemoveAllEventListener();
3654
3734
  }
3655
3735
 
3656
3736
  this.ChartDestory=this.ChartDestroy; //老版本写错了,需要兼容下
@@ -79913,32 +79993,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
79913
79993
  this.ChartCorssCursor.StringFormatX.Frame=this.Frame.SubFrame[0].Frame;
79914
79994
  this.ChartCorssCursor.StringFormatY.Frame=this.Frame;
79915
79995
 
79916
- var bRegisterKeydown=true;
79917
- var bRegisterWheel=true;
79918
-
79919
- if (option && option.Listener)
79920
- {
79921
- var item=option.Listener;
79922
- if (item.KeyDown===false)
79923
- {
79924
- bRegisterKeydown=false;
79925
- JSConsole.Chart.Log('[KLineChartContainer::Create] not register keydown event.');
79926
- }
79927
-
79928
- if (item.Wheel===false)
79929
- {
79930
- bRegisterWheel=false;
79931
- JSConsole.Chart.Log('[KLineChartContainer::Create] not register wheel event.');
79932
- }
79933
- }
79934
-
79935
- if (bRegisterKeydown)
79936
- {
79937
- this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
79938
- this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
79939
- }
79940
-
79941
- if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
79996
+ if (option) this.AddDefaultEventListener(option.Listener);
79942
79997
 
79943
79998
  this.InitalPopMinuteChart(option);
79944
79999
  }
@@ -89820,31 +89875,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
89820
89875
  if (this.ChartCorssCursor.CallAcutionXOperator)
89821
89876
  this.ChartCorssCursor.CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;
89822
89877
 
89823
- var bRegisterKeydown=true;
89824
- var bRegisterWheel=true;
89825
-
89826
- if (option && option.Listener)
89827
- {
89828
- var item=option.Listener;
89829
- if (item.KeyDown===false)
89830
- {
89831
- bRegisterKeydown=false;
89832
- JSConsole.Chart.Log('[MinuteChartContainer::Create] not register keydown event.');
89833
- }
89834
-
89835
- if (item.Wheel===false)
89836
- {
89837
- bRegisterWheel=false;
89838
- JSConsole.Chart.Log('[MinuteChartContainer::Create] not register wheel event.');
89839
- }
89840
- }
89841
-
89842
- if (bRegisterKeydown)
89843
- {
89844
- this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e);} , true); //键盘消息
89845
- this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
89846
- }
89847
- if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
89878
+ if (option) this.AddDefaultEventListener(option.Listener);
89848
89879
  }
89849
89880
 
89850
89881
  //创建子窗口
@@ -95373,8 +95404,7 @@ function KLineChartHScreenContainer(uielement)
95373
95404
  this.TitlePaint.push(titlePaint);
95374
95405
  }
95375
95406
 
95376
- this.UIElement.addEventListener("keydown", OnKeyDown, true); //键盘消息
95377
- this.UIElement.addEventListener("keyup", OnKeyUp, true);
95407
+ this.AddDefaultEventListener({ KeyDown:true, Wheel:false });
95378
95408
  }
95379
95409
 
95380
95410
  //创建子窗口
@@ -95562,8 +95592,7 @@ function MinuteChartHScreenContainer(uielement)
95562
95592
  this.ChartCorssCursor.StringFormatY.Frame=this.Frame;
95563
95593
  this.ChartCorssCursor.CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;
95564
95594
 
95565
- this.UIElement.addEventListener("keydown", OnKeyDown, true); //键盘消息
95566
- this.UIElement.addEventListener("keyup", OnKeyUp, true);
95595
+ this.AddDefaultEventListener({ KeyDown:false, Wheel:false });
95567
95596
  }
95568
95597
 
95569
95598
  //创建子窗口
@@ -95721,28 +95750,12 @@ function DepthChartContainer(uielement)
95721
95750
  chartItem.Name="深度图"
95722
95751
  this.ChartPaint.push(chartItem);
95723
95752
 
95724
- var bRegisterKeydown=true;
95725
- var bRegisterWheel=true;
95726
- if (option)
95727
- {
95728
- if (option.Wheel===false)
95729
- {
95730
- bRegisterWheel=false;
95731
- JSConsole.Chart.Log('[DepthChartContainer::Create] not register wheel event.');
95732
- }
95733
- }
95734
-
95735
- if (bRegisterKeydown)
95736
- {
95737
- this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
95738
- this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
95739
- }
95740
- if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
95753
+ if (option) this.AddDefaultEventListener(option.Listener);
95741
95754
  }
95742
95755
 
95743
95756
  this.OnWheel=function(e)
95744
95757
  {
95745
- JSConsole.Chart.Log('[KLineChartContainer::OnWheel]',e);
95758
+ JSConsole.Chart.Log('[DepthChartContainer::OnWheel]',e);
95746
95759
  var x = e.clientX-this.UIElement.getBoundingClientRect().left;
95747
95760
  var y = e.clientY-this.UIElement.getBoundingClientRect().top;
95748
95761
 
@@ -26,6 +26,8 @@ function JSPopMenu()
26
26
 
27
27
  this.RestoreFocusDelay=1000;
28
28
 
29
+ this.MouseDownlistenerPtr=null;
30
+
29
31
  this.AryTDClassName=
30
32
  [
31
33
  "UMyChart_MenuItem_Td_Status", //图标
@@ -37,7 +39,13 @@ function JSPopMenu()
37
39
  this.Inital=function(hqchart, option)
38
40
  {
39
41
  this.HQChart=hqchart;
40
- window.addEventListener('mousedown', (e)=>{ this.OnWindowMouseDown(e)});
42
+ this.MouseDownlistenerPtr=this.OnWindowMouseDown.bind(this);
43
+ window.addEventListener('mousedown', this.MouseDownlistenerPtr);
44
+ }
45
+
46
+ this.Destroy=function()
47
+ {
48
+ if (this.MouseDownlistenerPtr) window.removeEventListener('mousedown', this.MouseDownlistenerPtr);
41
49
  }
42
50
 
43
51
  //创建菜单
@@ -7369,6 +7369,73 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7369
7369
  this.FastSlideConfig={ MinDistance:500, MinSpeed:3, MaxTime:250, Enable:false }; //快速滑动配置 MinDistance=最小的距离 MinSpeed=最小速度 MaxTime=最大间隔时间(ms)
7370
7370
  this.KeyboardMove={ Timer:null, Delay:100 , Enable:false, Event:null }; //键盘左右移动
7371
7371
 
7372
+ this.MapEventListenerCache=new Map(); //addEventListener 监听事件 key=type:"keydown|keyup ....", value:{ Callback:, Option: }
7373
+
7374
+ this.AddEventListener=function(eventTarget, type, listener, option)
7375
+ {
7376
+ if (!eventTarget || !type || !listener) return false;
7377
+
7378
+ var callback=listener.bind(this);
7379
+ var item={ Callback:callback, Option:option, Type:type, Element:eventTarget };
7380
+
7381
+ eventTarget.addEventListener(type, callback, option);
7382
+
7383
+ this.MapEventListenerCache.set(item.Type, item);
7384
+
7385
+ return true;
7386
+ }
7387
+
7388
+ this.RemoveEventListener=function(eventTarget, type)
7389
+ {
7390
+ if (!eventTarget || !type) return false;
7391
+ if (!this.MapEventListenerCache.has(type)) return false;
7392
+
7393
+ var item=this.MapEventListenerCache.get(type);
7394
+ if (!item.Element || !item.Callback) return false;
7395
+
7396
+ this.MapEventListenerCache.delete(item.Type);
7397
+ item.Element.removeEventListener(item.Type, item.Callback, item.Option);
7398
+ }
7399
+
7400
+ //option={ KeyDown:, Wheel }
7401
+ this.AddDefaultEventListener=function(option)
7402
+ {
7403
+ var bRegisterKeydown=true;
7404
+ var bRegisterWheel=true;
7405
+
7406
+ if (option)
7407
+ {
7408
+ if (IFrameSplitOperator.IsBool(option.KeyDown)) bRegisterKeydown=option.KeyDown;
7409
+ if (IFrameSplitOperator.IsBool(option.Wheel)) bRegisterWheel=option.Wheel;
7410
+ }
7411
+
7412
+ if (bRegisterKeydown)
7413
+ {
7414
+ this.AddEventListener(this.UIElement,"keydown", this.OnKeyDown, true);
7415
+ this.AddEventListener(this.UIElement,"keyup", this.OnKeyUp, true);
7416
+ }
7417
+
7418
+ if (bRegisterWheel)
7419
+ {
7420
+ this.AddEventListener(this.UIElement,"wheel", this.OnWheel, true);
7421
+ }
7422
+
7423
+ JSConsole.Chart.Log(`[JSChartContainer::AddDefaultEventListener] [keydown,keyup]=${bRegisterKeydown}, [wheel]=${bRegisterWheel}`);
7424
+ }
7425
+
7426
+ this.RemoveAllEventListener=function()
7427
+ {
7428
+ for(var mapItem of this.MapEventListenerCache)
7429
+ {
7430
+ var item=mapItem[1];
7431
+ if (!item.Element || !item.Callback) continue;
7432
+
7433
+ item.Element.removeEventListener(item.Type, item.Callback, item.Option);
7434
+ }
7435
+
7436
+ this.MapEventListenerCache.clear();
7437
+ }
7438
+
7372
7439
  this.RestoreFocus=function(delay)
7373
7440
  {
7374
7441
  var value=1000;
@@ -7672,6 +7739,14 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7672
7739
  this.DialogModifyDraw=null;
7673
7740
  }
7674
7741
 
7742
+ this.DestroyPopMenu=function()
7743
+ {
7744
+ if (!this.JSPopMenu) return;
7745
+
7746
+ this.JSPopMenu.Destroy();
7747
+ this.JSPopMenu=null;
7748
+ }
7749
+
7675
7750
  //隐藏内置的弹框div
7676
7751
  this.HideAllPopDiv=function()
7677
7752
  {
@@ -7747,6 +7822,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7747
7822
  this.DestroyDialogModifyDraw();
7748
7823
 
7749
7824
  this.DestroyDialogSelectRect();
7825
+
7826
+ this.DestroyPopMenu();
7827
+
7828
+ document.oncontextmenu=null;
7829
+ this.RemoveAllEventListener();
7750
7830
  }
7751
7831
 
7752
7832
  this.ChartDestory=this.ChartDestroy; //老版本写错了,需要兼容下
@@ -84009,32 +84089,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
84009
84089
  this.ChartCorssCursor.StringFormatX.Frame=this.Frame.SubFrame[0].Frame;
84010
84090
  this.ChartCorssCursor.StringFormatY.Frame=this.Frame;
84011
84091
 
84012
- var bRegisterKeydown=true;
84013
- var bRegisterWheel=true;
84014
-
84015
- if (option && option.Listener)
84016
- {
84017
- var item=option.Listener;
84018
- if (item.KeyDown===false)
84019
- {
84020
- bRegisterKeydown=false;
84021
- JSConsole.Chart.Log('[KLineChartContainer::Create] not register keydown event.');
84022
- }
84023
-
84024
- if (item.Wheel===false)
84025
- {
84026
- bRegisterWheel=false;
84027
- JSConsole.Chart.Log('[KLineChartContainer::Create] not register wheel event.');
84028
- }
84029
- }
84030
-
84031
- if (bRegisterKeydown)
84032
- {
84033
- this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
84034
- this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
84035
- }
84036
-
84037
- if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
84092
+ if (option) this.AddDefaultEventListener(option.Listener);
84038
84093
 
84039
84094
  this.InitalPopMinuteChart(option);
84040
84095
  }
@@ -93916,31 +93971,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
93916
93971
  if (this.ChartCorssCursor.CallAcutionXOperator)
93917
93972
  this.ChartCorssCursor.CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;
93918
93973
 
93919
- var bRegisterKeydown=true;
93920
- var bRegisterWheel=true;
93921
-
93922
- if (option && option.Listener)
93923
- {
93924
- var item=option.Listener;
93925
- if (item.KeyDown===false)
93926
- {
93927
- bRegisterKeydown=false;
93928
- JSConsole.Chart.Log('[MinuteChartContainer::Create] not register keydown event.');
93929
- }
93930
-
93931
- if (item.Wheel===false)
93932
- {
93933
- bRegisterWheel=false;
93934
- JSConsole.Chart.Log('[MinuteChartContainer::Create] not register wheel event.');
93935
- }
93936
- }
93937
-
93938
- if (bRegisterKeydown)
93939
- {
93940
- this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e);} , true); //键盘消息
93941
- this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
93942
- }
93943
- if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
93974
+ if (option) this.AddDefaultEventListener(option.Listener);
93944
93975
  }
93945
93976
 
93946
93977
  //创建子窗口
@@ -99469,8 +99500,7 @@ function KLineChartHScreenContainer(uielement)
99469
99500
  this.TitlePaint.push(titlePaint);
99470
99501
  }
99471
99502
 
99472
- this.UIElement.addEventListener("keydown", OnKeyDown, true); //键盘消息
99473
- this.UIElement.addEventListener("keyup", OnKeyUp, true);
99503
+ this.AddDefaultEventListener({ KeyDown:true, Wheel:false });
99474
99504
  }
99475
99505
 
99476
99506
  //创建子窗口
@@ -99658,8 +99688,7 @@ function MinuteChartHScreenContainer(uielement)
99658
99688
  this.ChartCorssCursor.StringFormatY.Frame=this.Frame;
99659
99689
  this.ChartCorssCursor.CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;
99660
99690
 
99661
- this.UIElement.addEventListener("keydown", OnKeyDown, true); //键盘消息
99662
- this.UIElement.addEventListener("keyup", OnKeyUp, true);
99691
+ this.AddDefaultEventListener({ KeyDown:false, Wheel:false });
99663
99692
  }
99664
99693
 
99665
99694
  //创建子窗口
@@ -99817,28 +99846,12 @@ function DepthChartContainer(uielement)
99817
99846
  chartItem.Name="深度图"
99818
99847
  this.ChartPaint.push(chartItem);
99819
99848
 
99820
- var bRegisterKeydown=true;
99821
- var bRegisterWheel=true;
99822
- if (option)
99823
- {
99824
- if (option.Wheel===false)
99825
- {
99826
- bRegisterWheel=false;
99827
- JSConsole.Chart.Log('[DepthChartContainer::Create] not register wheel event.');
99828
- }
99829
- }
99830
-
99831
- if (bRegisterKeydown)
99832
- {
99833
- this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
99834
- this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
99835
- }
99836
- if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
99849
+ if (option) this.AddDefaultEventListener(option.Listener);
99837
99850
  }
99838
99851
 
99839
99852
  this.OnWheel=function(e)
99840
99853
  {
99841
- JSConsole.Chart.Log('[KLineChartContainer::OnWheel]',e);
99854
+ JSConsole.Chart.Log('[DepthChartContainer::OnWheel]',e);
99842
99855
  var x = e.clientX-this.UIElement.getBoundingClientRect().left;
99843
99856
  var y = e.clientY-this.UIElement.getBoundingClientRect().top;
99844
99857
 
@@ -149569,7 +149582,7 @@ function ScrollBarBGChart()
149569
149582
 
149570
149583
 
149571
149584
 
149572
- var HQCHART_VERSION="1.1.14819";
149585
+ var HQCHART_VERSION="1.1.14823";
149573
149586
 
149574
149587
  function PrintHQChartVersion()
149575
149588
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.14819";
8
+ var HQCHART_VERSION="1.1.14823";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {