@@ -10686,6 +10686,8 @@ return jQuery;
10686
10686
})(jQuery,document,"click mousemove mouseup touchmove touchend", "outjsmol");
10687
10687
// j2sApplet.js BH = Bob Hanson hansonr@stolaf.edu
10688
10688
10689
+ // BH 2023.12.14 fixes resizing into application (making it smaller)
10690
+ // BH 2023.12.13 fixes RIGHT-DRAG and SHIFT-LEFT-DRAG modifier
10689
10691
// BH 2023.12.07 fixes mouseUp on body causing (ignorable) error
10690
10692
// BH 2023.11.06 adds css touch-action none
10691
10693
// BH 2023.11.01 adds pointerup, pointerdown, and pointermove to J2S.setMouse
@@ -12372,26 +12374,6 @@ if (database == "_" && J2S._serverUrl.indexOf("//your.server.here/") >= 0) {
12372
12374
return ignore;
12373
12375
};
12374
12376
12375
- var getKeyModifiers = function(ev) {
12376
- var modifiers = 0;
12377
- if (ev.shiftKey)
12378
- modifiers |= (1 << 0) | (1 << 6); // InputEvent.SHIFT_MASK +
12379
- // InputEvent.SHIFT_DOWN_MASK;
12380
- if (ev.ctrlKey)
12381
- modifiers |= (1 << 1) | (1 << 7); // InputEvent.CTRL_MASK +
12382
- // InputEvent.CTRL_DOWN_MASK;
12383
- if (ev.metaKey)
12384
- modifiers |= (1 << 2) | (1 << 8); // InputEvent.META_MASK +
12385
- // InputEvent.META_DOWN_MASK;
12386
- if (ev.altKey)
12387
- modifiers |= (1 << 3) | (1 << 9); // InputEvent.ALT_MASK +
12388
- // InputEvent.ALT_DOWN_MASK;
12389
- if (ev.altGraphKey)
12390
- modifiers |= (1 << 5) | (1 << 13); // InputEvent.ALT_GRAPH_MASK +
12391
- // InputEvent.ALT_GRAPH_DOWN_MASK;
12392
- return modifiers;
12393
- }
12394
-
12395
12377
J2S.setKeyListener = function(who) {
12396
12378
J2S.$bind(who, 'keydown keypress keyup', function(ev) {
12397
12379
if (doIgnore(ev))
@@ -12556,6 +12538,7 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
12556
12538
}
12557
12539
12558
12540
if (J2S._dmouseOwner && J2S._dmouseOwner.isDragging) {
12541
+ // resizing mouse dragged over applet
12559
12542
if (J2S._dmouseDrag)
12560
12543
J2S._dmouseDrag(ev);
12561
12544
else
@@ -12585,9 +12568,14 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
12585
12568
}
12586
12569
12587
12570
var mouseUp = function(who, ev) {
12588
- if (J2S._dmouseOwner) {
12589
- J2S._dmouseOwner.isDragging = false;
12590
- J2S._dmouseOwner = null;
12571
+ if (J2S._dmouseOwner && J2S._dmouseOwner.isDragging) {
12572
+ // resizing mouse released over applet
12573
+ if (J2S._dmouseDrag) {
12574
+ J2S._dmouseUp(ev);
12575
+ } else {
12576
+ System.out.println("move setting dmouseowner null");
12577
+ J2S._dmouseOwner = null;
12578
+ }
12591
12579
}
12592
12580
if (!who || who.applet == null)
12593
12581
return;
@@ -12864,7 +12852,7 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
12864
12852
// and also recognize a drag (503 + buttons pressed
12865
12853
var modifiers = 0;
12866
12854
if (id == 503) {
12867
- modifiers = ev.buttons << 10 ;
12855
+ modifiers = ( ev.buttons == 0 ? 0 : ev.buttons == 2 ? (1 << 12) : (1 << 10)) ;
12868
12856
} else {
12869
12857
switch (ev.button) {
12870
12858
default:
@@ -12888,6 +12876,26 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
12888
12876
return modifiers | getKeyModifiers(ev);
12889
12877
}
12890
12878
12879
+ var getKeyModifiers = function(ev) {
12880
+ var modifiers = 0;
12881
+ if (ev.shiftKey)
12882
+ modifiers |= (1 << 0) | (1 << 6); // InputEvent.SHIFT_MASK +
12883
+ // InputEvent.SHIFT_DOWN_MASK;
12884
+ if (ev.ctrlKey)
12885
+ modifiers |= (1 << 1) | (1 << 7); // InputEvent.CTRL_MASK +
12886
+ // InputEvent.CTRL_DOWN_MASK;
12887
+ if (ev.metaKey)
12888
+ modifiers |= (1 << 2) | (1 << 8); // InputEvent.META_MASK +
12889
+ // InputEvent.META_DOWN_MASK;
12890
+ if (ev.altKey)
12891
+ modifiers |= (1 << 3) | (1 << 9); // InputEvent.ALT_MASK +
12892
+ // InputEvent.ALT_DOWN_MASK;
12893
+ if (ev.altGraphKey)
12894
+ modifiers |= (1 << 5) | (1 << 13); // InputEvent.ALT_GRAPH_MASK +
12895
+ // InputEvent.ALT_GRAPH_DOWN_MASK;
12896
+ return modifiers;
12897
+ }
12898
+
12891
12899
var getXY = function(who, ev, id) {
12892
12900
// id 0, 502, or 503 only
12893
12901
if (!who.applet._ready || J2S._touching && ev.type.indexOf("touch") < 0)
@@ -13870,6 +13878,7 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
13870
13878
var down = function(ev) {
13871
13879
J2S._dmouseOwner = tag;
13872
13880
J2S._dmouseDrag = drag;
13881
+ J2S._dmouseUp = up;
13873
13882
13874
13883
tag.isDragging = true; // used by J2S mouse event business
13875
13884
pageX = Math.round(ev.pageX);
@@ -13921,6 +13930,7 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
13921
13930
}
13922
13931
}, up = function(ev) {
13923
13932
J2S._dmouseDrag = null;
13933
+ J2S._dmouseUp = null;
13924
13934
if (J2S._dmouseOwner == tag) {
13925
13935
tag.isDragging = false;
13926
13936
J2S._dmouseOwner = null
0 commit comments