Skip to content

Commit 78e249c

Browse files
hansohanso
authored andcommitted
fixes for touch interfaces
1 parent a0bdbe8 commit 78e249c

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed
304 Bytes
Binary file not shown.

sources/net.sf.j2s.java.core/src/swingjs/plaf/JSComponentUI.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2351,7 +2351,8 @@ protected void enableNode(DOMNode node, boolean b) {
23512351
if (node == null || isUIDisabled)
23522352
return;
23532353

2354-
DOMNode.setAttr(node, "disabled", (b ? NULL : TRUE));
2354+
DOMNode.setAttr(node, "disabled", b ? NULL : TRUE);
2355+
DOMNode.setStyle(node, "pointer-events", b ? "auto" : "none");
23552356
if (!b && inactiveForeground == colorUNKNOWN)
23562357
getDisabledColors(buttonNode == null ? getPropertyPrefix() : "Button");
23572358
if (jc.isOpaque()) {

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

Lines changed: 5 additions & 2 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 2023.11.06 adds css touch-action none
34
// BH 2023.11.01 adds pointerup, pointerdown, and pointermove to J2S.setMouse
45
// BH 2023.11.01 allows null applet in J2S.setMouse (?? should it ever be null?)
56
// BH 2023.02.04 adds support for file load cancel
@@ -241,6 +242,8 @@ window.J2S = J2S = (function() {
241242
// here --
242243
// untested
243244
j._canClickFileReader = !j._isSafari && !j._isChrome; // and others?
245+
246+
j.htmlOverflowOriginal = null; // delayed definition
244247

245248
window.requestAnimationFrame
246249
|| (window.requestAnimationFrame = window.setTimeout);
@@ -1801,7 +1804,7 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
18011804
}
18021805

18031806
var mouseDown = function(who, ev) {
1804-
1807+
// prevent touch dragging
18051808
if (who.applet == null)
18061809
return;
18071810
if (J2S._traceMouse)
@@ -2090,7 +2093,7 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
20902093
who.applet._resize();
20912094
});
20922095
}
2093-
2096+
$(who).css({"touch-action":"none"}); // disable browser panning upon touch-drag
20942097
}
20952098

20962099
J2S.unsetMouse = function(who) {

sources/net.sf.j2s.java.core/srcjs/swingjs2.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10686,6 +10686,7 @@ return jQuery;
1068610686
})(jQuery,document,"click mousemove mouseup touchmove touchend", "outjsmol");
1068710687
// j2sApplet.js BH = Bob Hanson hansonr@stolaf.edu
1068810688

10689+
// BH 2023.11.06 adds css touch-action none
1068910690
// BH 2023.11.01 adds pointerup, pointerdown, and pointermove to J2S.setMouse
1069010691
// BH 2023.11.01 allows null applet in J2S.setMouse (?? should it ever be null?)
1069110692
// BH 2023.02.04 adds support for file load cancel
@@ -10927,6 +10928,8 @@ window.J2S = J2S = (function() {
1092710928
// here --
1092810929
// untested
1092910930
j._canClickFileReader = !j._isSafari && !j._isChrome; // and others?
10931+
10932+
j.htmlOverflowOriginal = null; // delayed definition
1093010933

1093110934
window.requestAnimationFrame
1093210935
|| (window.requestAnimationFrame = window.setTimeout);
@@ -12487,7 +12490,7 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
1248712490
}
1248812491

1248912492
var mouseDown = function(who, ev) {
12490-
12493+
// prevent touch dragging
1249112494
if (who.applet == null)
1249212495
return;
1249312496
if (J2S._traceMouse)
@@ -12776,7 +12779,7 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
1277612779
who.applet._resize();
1277712780
});
1277812781
}
12779-
12782+
$(who).css({"touch-action":"none"}); // disable browser panning upon touch-drag
1278012783
}
1278112784

1278212785
J2S.unsetMouse = function(who) {

0 commit comments

Comments
 (0)