Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit739ea06

Browse files
committed
SwingJS-site.zip; JSmouse.java
1 parent8ca18fb commit739ea06

File tree

11 files changed

+60
-32
lines changed

11 files changed

+60
-32
lines changed
-1.21 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20240814095418
1+
20241104091759
-1.21 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20240814095418
1+
20241104091759
-1.21 KB
Binary file not shown.

‎sources/net.sf.j2s.java.core/src/javajs/util/CifDataParser.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,8 @@ public String skipLoop(boolean doReport) throws Exception {
424424
while ((str = (String)getNextDataToken()) !=null) {
425425
if (ret ==null)
426426
continue;
427-
ret.append(str).append(" ");
427+
if (str.charAt(0) !=0)
428+
ret.append(str).append(" ");
428429
if ((++m %n) ==0)
429430
ret.append("\n");
430431
}

‎sources/net.sf.j2s.java.core/src/javajs/util/MeasureD.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ public static double computeAngleABC(T3d pointA, T3d pointB, T3d pointC, boolean
4747
}
4848

4949
publicstaticdoublecomputeTorsion(T3dp1,T3dp2,T3dp3,T3dp4,booleanasDegrees) {
50-
50+
if (p1.distanceSquared(p2) <1e-10)
51+
return0;
5152
doubleijx =p1.x -p2.x;
5253
doubleijy =p1.y -p2.y;
5354
doubleijz =p1.z -p2.z;

‎sources/net.sf.j2s.java.core/src/swingjs/JSMouse.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ private void entry(long time, int x, int y, int id) {
206206
* @param modifiers
207207
* @param clickCount
208208
*/
209-
privatevoidclicked(longtime,intx,inty,intmodifiers,intclickCount) {
209+
publicvoidclicked(longtime,intx,inty,intmodifiers,intclickCount) {
210210
// clearKeyBuffer();
211211
// clickedCount is not reliable on some platforms
212212
// so we will just deal with it ourselves
@@ -404,10 +404,10 @@ private static void processMouseEvent(Object jqevent, Component source, int id,
404404
booleanpopupTrigger =isPopupTrigger(id,modifiers,JSToolkit.isWin);
405405
MouseEvente;
406406
if (id ==MouseEvent.MOUSE_WHEEL) {
407-
e =newMouseWheelEvent(source,id,time,modifiers,x,y,x,y,count,popupTrigger,
407+
e =newMouseWheelEvent(source,id,time,modifiers,x,y,count,popupTrigger,
408408
MouseWheelEvent.WHEEL_UNIT_SCROLL,1,dy);
409409
}else {
410-
e =newMouseEvent(source,id,time,modifiers,x,y,x,y,count,popupTrigger,button);
410+
e =newMouseEvent(source,id,time,modifiers,x,y,count,popupTrigger,button);
411411
}
412412
byte[]bdata =newbyte[0];
413413
e.setBData(bdata);

‎sources/net.sf.j2s.java.core/src/swingjs/JSMouse2.java‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,29 @@ public JSMouse2 set(JSMouse mouse) {
5757
*
5858
*/
5959
publicvoidprocessTwoPointGesture(float[][][]touches) {
60-
61-
if (touches[0].length <2)
62-
return;
6360
float[][]t1 =touches[0];
6461
float[][]t2 =touches[1];
62+
intnt =t1.length;
63+
if (nt <2)
64+
return;
65+
booleanisClick = (nt >t2.length);
6566
float[]t1first =t1[0];
66-
float[]t1last =t1[t2.length -1];
6767
floatx1first =t1first[0];
68-
floatx1last =t1last[0];
69-
floatdx1 =x1last -x1first;
7068
floaty1first =t1first[1];
69+
70+
if (isClick) {
71+
mouse.clicked(System.currentTimeMillis(), (int)x1first, (int)y1first,0,2);
72+
return;
73+
}
74+
float[]t1last =t1[nt -1];
75+
floatx1last =t1last[0];
7176
floaty1last =t1last[1];
77+
floatdx1 =x1last -x1first;
7278
floatdy1 =y1last -y1first;
7379
V3v1 =V3.new3(dx1,dy1,0);
7480
floatd1 =v1.length();
7581
float[]t2first =t2[0];
76-
float[]t2last =t2[t2.length -1];
82+
float[]t2last =t2[nt -1];
7783
floatx2first =t2first[0];
7884
floatx2last =t2last[0];
7985
floatdx2 =x2last -x2first;

‎sources/net.sf.j2s.java.core/srcjs/js/j2sApplet.js‎

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// j2sApplet.js BH = Bob Hanson hansonr@stolaf.edu
22

3+
// BH 2024.10.03 adds two-finger tap as "click"; reinstates touch gestures lost when we went to pointerup 2023.11.01
34
// BH 2023.12.14 fixes resizing into application (making it smaller)
45
// BH 2023.12.13 fixes RIGHT-DRAG and SHIFT-LEFT-DRAG modifier
56
// BH 2023.12.07 fixes mouseUp on body causing (ignorable) error
@@ -1729,11 +1730,13 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
17291730
J2S._haveMouse;
17301731
J2S._firstTouch;// three-position switch: undefined, true, false
17311732

1732-
J2S.$bind('body','pointerdown pointermove mousedown mousemove mouseup',function(ev){
1733+
J2S.$bind('body',//'pointerdown pointermove
1734+
'mousedown mousemove mouseup',function(ev){
17331735
J2S._haveMouse=true;
17341736
});
17351737

1736-
J2S.$bind('body','pointerup mouseup touchend',function(ev){
1738+
J2S.$bind('body',//'pointerup
1739+
'mouseup touchend',function(ev){
17371740
mouseUp(null,ev);
17381741
returntrue;
17391742
});
@@ -1797,13 +1800,16 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
17971800
// otherwise, if J2S._firstTouch is undefined (!!x != x), set J2S._firstTouch
17981801
// and ignore future touch events (through the first touchend):
17991802

1800-
if(ev.type=="pointerdown"||ev.type=="mousedown"){// BHTEst
1803+
if(//ev.type == "pointerdown" ||
1804+
ev.type=="mousedown"){// BHTEst
18011805
J2S._haveMouse=true;
18021806
}else{
18031807
if(J2S._haveMouse)return;
18041808
if(!!J2S._firstTouch!=J2S._firstTouch){
1805-
J2S._firstTouch=true;
1806-
return;
1809+
// q - why did we do this?
1810+
//J2S._firstTouch = true;
1811+
// return;
1812+
J2S._firstTouch=false;
18071813
}
18081814
}
18091815

@@ -2061,7 +2067,8 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
20612067
J2S.$bind(who,(J2S._haveMouse ?'mousedown pointerdown' :'pointerdown mousedown touchstart'),
20622068
function(ev){returnmouseDown(who,ev)});
20632069

2064-
J2S.$bind(who,(J2S._haveMouse ?'mouseup pointerup' :'pointerup mouseup touchend'),
2070+
J2S.$bind(who,(J2S._haveMouse ?'mouseup pointerup' :// 'pointerup
2071+
'mouseup touchend'),
20652072
function(ev){returnmouseUp(who,ev)});
20662073

20672074
J2S.$bind(who,'pointerenter mouseenter',function(ev){returnmouseEnter(who,ev)});
@@ -2255,21 +2262,24 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
22552262
J2S._touching=false;
22562263
break;
22572264
}
2258-
if(!oe.touches||oe.touches.length!=2)
2265+
if(!oe.touches||oe.touches.length!=(ev.type=="touchend" ?1 :2))
22592266
returnfalse;
2267+
varn=0;
22602268
switch(ev.type){
22612269
case"touchstart":
22622270
who._touches=[[],[]];
22632271
break;
2272+
case"touchend":
22642273
case"touchmove":
22652274
varoffsets=J2S.$offset(who.id);
22662275
vart0=who._touches[0];
22672276
vart1=who._touches[1];
22682277
t0.push([oe.touches[0].pageX-offsets.left,
22692278
oe.touches[0].pageY-offsets.top]);
2270-
t1.push([oe.touches[1].pageX-offsets.left,
2279+
if(ev.type!="touchend")
2280+
t1.push([oe.touches[1].pageX-offsets.left,
22712281
oe.touches[1].pageY-offsets.top]);
2272-
varn=t0.length;
2282+
n=t0.length;
22732283
if(n>3){
22742284
t0.shift();
22752285
t1.shift();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp