File size: 1,461 Bytes
233f6d4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | Clazz.declarePackage ("J.thread");
Clazz.load (["J.thread.JmolThread"], "J.thread.VibrationThread", null, function () {
c$ = Clazz.decorateAsClass (function () {
this.transformManager = null;
Clazz.instantialize (this, arguments);
}, J.thread, "VibrationThread", J.thread.JmolThread);
Clazz.overrideMethod (c$, "setManager",
function (manager, vwr, options) {
this.transformManager = manager;
this.setViewer (vwr, "VibrationThread");
return 0;
}, "~O,JV.Viewer,~O");
Clazz.overrideMethod (c$, "run1",
function (mode) {
var elapsed;
while (true) switch (mode) {
case -1:
this.lastRepaintTime = this.startTime = System.currentTimeMillis ();
this.vwr.startHoverWatcher (false);
this.haveReference = true;
mode = 0;
break;
case 0:
elapsed = (System.currentTimeMillis () - this.lastRepaintTime);
this.sleepTime = 33 - elapsed;
if (!this.runSleep (this.sleepTime, 1)) return;
mode = 1;
break;
case 1:
this.lastRepaintTime = System.currentTimeMillis ();
elapsed = (this.lastRepaintTime - this.startTime);
if (this.transformManager.vibrationPeriodMs == 0) {
mode = -2;
} else {
var t = (elapsed % this.transformManager.vibrationPeriodMs) / this.transformManager.vibrationPeriodMs;
this.transformManager.setVibrationT (t);
this.vwr.refresh (3, "VibrationThread");
mode = (this.checkInterrupted (this.transformManager.vibrationThread) ? -2 : 0);
}break;
case -2:
this.vwr.startHoverWatcher (true);
return;
}
}, "~N");
});
|