File tree Expand file tree Collapse file tree 1 file changed +19
-17
lines changed Expand file tree Collapse file tree 1 file changed +19
-17
lines changed Original file line number Diff line number Diff line change @@ -18,10 +18,10 @@ var lineSegment = {
1818} ;
1919
2020// bow rotation point
21- // var pivot = {
22- // x: 100,
23- // y: 250
24- // };
21+ var pivot = {
22+ x : 100 ,
23+ y : 250
24+ } ;
2525
2626// 判断当前设备是否为触摸屏
2727function isTouchDevice ( ) {
@@ -36,19 +36,20 @@ function getScreenCenter() {
3636 } ;
3737}
3838
39- // 设置 pivot 点
40- var pivot ;
39+ // // 设置 pivot 点
40+ // var pivot;
41+
42+ // if (isTouchDevice()) {
43+ // // 如果是触摸屏,使用屏幕中心作为 pivot 点
44+ // pivot = getScreenCenter();
45+ // } else {
46+ // // 如果不是触摸屏,使用固定的 pivot 点
47+ // pivot = {
48+ // x: 100,
49+ // y: 250
50+ // };
51+ // }
4152
42- if ( isTouchDevice ( ) ) {
43- // 如果是触摸屏,使用屏幕中心作为 pivot 点
44- pivot = getScreenCenter ( ) ;
45- } else {
46- // 如果不是触摸屏,使用固定的 pivot 点
47- pivot = {
48- x : 100 ,
49- y : 250
50- } ;
51- }
5253
5354aim ( {
5455clientX : 320 ,
@@ -74,10 +75,11 @@ function draw(e) {
7475 // 禁止下拉刷新
7576 document . addEventListener ( 'touchmove' , function ( event ) {
7677event . preventDefault ( ) ; // 阻止默认行为
78+ draw ( event ) ;
7779} , { passive : false } ) ;
7880
7981function aim ( e ) {
80-
82+
8183// get mouse position in relation to svg position and scale
8284var point = getMouseSVG ( e ) ;
8385point . x = Math . min ( point . x , pivot . x - 7 ) ;
You can’t perform that action at this time.
0 commit comments