Skip to content

Commit f3a872f

Browse files
hansonrhansonr
authored andcommitted
distribution files
1 parent d72d5a2 commit f3a872f

File tree

6 files changed

+67
-13
lines changed

6 files changed

+67
-13
lines changed
1.17 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20190519072139
1+
20190606154615
1.17 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20190519072139
1+
20190606154615
1.17 KB
Binary file not shown.

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

Lines changed: 65 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12512,9 +12512,18 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
1251212512
ev.preventDefault();
1251312513
}
1251412514

12515+
var newid = (J2S._mouseOwner && J2S._mouseOwner.isDragging ? 506 : 503);
12516+
// MouseEvent.MOUSE_DRAGGED : MouseEvent.MOUSE_MOVED
12517+
1251512518
var isTouch = (ev.type == "touchmove");
12516-
if (isTouch && J2S._gestureUpdate(who, ev))
12517-
return false;
12519+
if (isTouch) {
12520+
if (J2S._gestureUpdate(who, ev))
12521+
return false;
12522+
if (newid == 506) {
12523+
ev.button = ev.originalEvent.button = 0;
12524+
ev.buttons = ev.originalEvent.buttons = 1;
12525+
}
12526+
}
1251812527
var xym = getXY(who, ev, id);
1251912528
if (!xym)
1252012529
return false;
@@ -12528,9 +12537,7 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
1252812537
var ui = ev.target["data-ui"];
1252912538
var target = ev.target["data-component"];
1253012539

12531-
who.applet._processEvent(J2S._mouseOwner && J2S._mouseOwner.isDragging ? 506 : 503, xym, ev,
12532-
who._frameViewer); // MouseEvent.MOUSE_DRAGGED :
12533-
// MouseEvent.MOUSE_MOVED
12540+
who.applet._processEvent(newid, xym, ev, who._frameViewer);
1253412541
return !!(ui || target);
1253512542
}
1253612543

@@ -13661,6 +13668,52 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
1366113668
return path;
1366213669
}
1366313670

13671+
J2S._newGrayScaleImage = function(context, image, width, height, grayBuffer) {
13672+
var c;
13673+
image || (image = Jmol.$(context.canvas.applet, "image")[0]);
13674+
if (image == null) {
13675+
var appId = context.canvas.applet._id;
13676+
var id = appId + "_imagediv";
13677+
c = document.createElement("canvas");
13678+
c.id = id;
13679+
c.style.width = width + "px";
13680+
c.style.height = height + "px";
13681+
c.width = width;
13682+
c.height = height;
13683+
13684+
var layer = document.getElementById(appId + "_contentLayer");
13685+
image = new Image();
13686+
image.canvas = c;
13687+
image.appId = appId;
13688+
image.id = appId + "_image";
13689+
image.layer = layer;
13690+
image.w = width;
13691+
image.h = height;
13692+
image.onload = function(e) {
13693+
try {
13694+
URL.revokeObjectURL(image.src);
13695+
} catch (e) {}
13696+
};
13697+
var div = document.createElement("div");
13698+
image.div = div;
13699+
div.style.position="absolute";
13700+
layer.appendChild(div);
13701+
div.appendChild(image);
13702+
}
13703+
c = image.canvas.getContext("2d");
13704+
var imageData = c.getImageData(0, 0, width, height);
13705+
var buf = imageData.data;
13706+
var ng = grayBuffer.length;
13707+
var pt = 0;
13708+
for (var i = 0; i < ng; i++) {
13709+
buf[pt++] = buf[pt++] = buf[pt++] = grayBuffer[i];
13710+
buf[pt++] = 0xFF;
13711+
}
13712+
c.putImageData(imageData, 0, 0);
13713+
image.canvas.toBlob(function(blob){image.src = URL.createObjectURL(blob)});
13714+
return image;
13715+
}
13716+
1366413717
})(J2S);
1366513718
// j2sClazz.js
1366613719
// NOTE: updates to this file should be copies to j2sjmol.js
@@ -13673,6 +13726,7 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
1367313726

1367413727
// TODO: still a lot of references to window[...]
1367513728

13729+
// BH 2019.05.21 changes Clazz.isClassDefined to Clazz._isClassDefined for compression
1367613730
// BH 2019.05.13 fixes for Math.getExponent, Math.IEEERemainder, Array.equals(Object)
1367713731
// BH 2019.02.16 fixes typo in Integer.parseInt(s,radix)
1367813732
// BH 2019.02.07 fixes radix|10 should be radix||10
@@ -14602,8 +14656,8 @@ var checkDeclared = function(name, type) {
1460214656
_declared[name] = type;
1460314657
}
1460414658

14605-
/* not clear that this needs to be public */
14606-
Clazz.isClassDefined = function(clazzName) {
14659+
/* public */
14660+
Clazz._isClassDefined = function(clazzName) {
1460714661
if (!clazzName)
1460814662
return false; /* consider null or empty name as non-defined class */
1460914663
if (Clazz.allClasses[clazzName])
@@ -15874,8 +15928,8 @@ _Loader.requireLoaderByBase = function (base) {
1587415928
var isClassdefined;
1587515929
var definedClasses;
1587615930

15877-
if (self.Clazz && Clazz.isClassDefined) {
15878-
isClassDefined = Clazz.isClassDefined;
15931+
if (self.Clazz && Clazz._isClassDefined) {
15932+
isClassDefined = Clazz._isClassDefined;
1587915933
} else {
1588015934
definedClasses = {};
1588115935
isClassDefined = function (clazzName) {
@@ -16168,7 +16222,7 @@ Clazz._4Name = function(clazzName, applet, state, asClazz, initialize, isQuiet)
1616816222
return getArrayClass(clazzName);
1616916223
if (clazzName.indexOf(".") < 0)
1617016224
clazzName = "java.lang." + clazzName;
16171-
var isok = Clazz.isClassDefined(clazzName);
16225+
var isok = Clazz._isClassDefined(clazzName);
1617216226
if (isok && asClazz) {
1617316227
var cl1 = Clazz.allClasses[clazzName];
1617416228
cl1.$clinit$ && cl1.$clinit$();
@@ -16180,7 +16234,7 @@ Clazz._4Name = function(clazzName, applet, state, asClazz, initialize, isQuiet)
1618016234
// BH we allow Java's java.swing.JTable.$BooleanRenderer as a stand-in for java.swing.JTable.BooleanRenderer
1618116235
// when the static nested class is created using declareType
1618216236
name2 = clazzName.replace(/\$/g,".");
16183-
if (Clazz.isClassDefined(name2)) {
16237+
if (Clazz._isClassDefined(name2)) {
1618416238
clazzName = name2;
1618516239
} else {
1618616240
name2 = null;

0 commit comments

Comments
 (0)