aotrautils 0.0.1839 → 0.0.1840
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aotrautils/aotrautils.build.js +264 -260
- aotrautils/package.json +1 -1
aotrautils/aotrautils.build.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (05/04/2026-12:
|
|
3
|
+
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (05/04/2026-12:42:00)»*/
|
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
|
|
@@ -5117,6 +5117,264 @@ window.getPathFileName=(path, fileSeparator="/", removeExtension=false)=>{
|
|
|
5117
5117
|
}
|
|
5118
5118
|
|
|
5119
5119
|
|
|
5120
|
+
// -------------------------------------------------------------------------
|
|
5121
|
+
// ====================================================== ROUTINES ======================================================
|
|
5122
|
+
|
|
5123
|
+
|
|
5124
|
+
// ======================== Timeout ========================
|
|
5125
|
+
|
|
5126
|
+
// CAUTION : This is not a routine, but a single-use timeout !
|
|
5127
|
+
window.MonoThreadedTimeout=class {
|
|
5128
|
+
constructor(actuator, delayMillis){
|
|
5129
|
+
this.actuator=actuator;
|
|
5130
|
+
}
|
|
5131
|
+
start(delayMillis=null){
|
|
5132
|
+
this.started=true;
|
|
5133
|
+
this.time=getNow();
|
|
5134
|
+
this.delayMillis=delayMillis;
|
|
5135
|
+
}
|
|
5136
|
+
doStep(args=null){
|
|
5137
|
+
if(!this.started) return;
|
|
5138
|
+
if(!hasDelayPassed(this.time, this.delayMillis)) return;
|
|
5139
|
+
return this.stop(args);
|
|
5140
|
+
}
|
|
5141
|
+
stop(args=null){
|
|
5142
|
+
if(!this.started) return;
|
|
5143
|
+
this.started=false;
|
|
5144
|
+
if(this.actuator.doOnStop) this.actuator.doOnStop(args);
|
|
5145
|
+
return this;
|
|
5146
|
+
}
|
|
5147
|
+
}
|
|
5148
|
+
|
|
5149
|
+
window.getMonoThreadedTimeout=function(actuator=null){
|
|
5150
|
+
return new MonoThreadedTimeout(actuator);
|
|
5151
|
+
}
|
|
5152
|
+
|
|
5153
|
+
|
|
5154
|
+
// ======================== Routine ========================
|
|
5155
|
+
|
|
5156
|
+
window.MonoThreadedRoutine=class {
|
|
5157
|
+
constructor(actuator,refreshMillis=null,startDependsOnParentOnly=false){
|
|
5158
|
+
|
|
5159
|
+
this.actuator=actuator;
|
|
5160
|
+
this.startDependsOnParentOnly=startDependsOnParentOnly;
|
|
5161
|
+
this.started=false;
|
|
5162
|
+
this.paused=false;
|
|
5163
|
+
this.time=getNow();
|
|
5164
|
+
this.refreshMillis=refreshMillis;
|
|
5165
|
+
|
|
5166
|
+
this.durationTimeFactorHolder={durationTimeFactor:1};
|
|
5167
|
+
// Three-states : started, paused, stopped.
|
|
5168
|
+
|
|
5169
|
+
}
|
|
5170
|
+
|
|
5171
|
+
setDurationTimeFactorHolder(durationTimeFactorHolder){
|
|
5172
|
+
this.durationTimeFactorHolder=durationTimeFactorHolder;
|
|
5173
|
+
return this;
|
|
5174
|
+
}
|
|
5175
|
+
isStarted(){
|
|
5176
|
+
return this.started || this.startDependsOnParentOnly;
|
|
5177
|
+
}
|
|
5178
|
+
start(args=null){
|
|
5179
|
+
// if(this.isStarted()) return;
|
|
5180
|
+
if(this.actuator.terminateFunction && this.actuator.terminateFunction(args)){
|
|
5181
|
+
// CAUTION : Even if the routine is «pre-terminated» before even starting
|
|
5182
|
+
// (ie. its stop conditions are fullfilled even before it has started)
|
|
5183
|
+
// we all the same have to trigger its stop treatments :
|
|
5184
|
+
if(this.actuator.doOnStop) this.actuator.doOnStop(args);
|
|
5185
|
+
return;
|
|
5186
|
+
}
|
|
5187
|
+
this.started=true;
|
|
5188
|
+
this.paused=false;
|
|
5189
|
+
return this;
|
|
5190
|
+
}
|
|
5191
|
+
stop(args=null){
|
|
5192
|
+
if(!this.isStarted()) return;
|
|
5193
|
+
this.started=false;
|
|
5194
|
+
if(this.actuator.doOnStop) this.actuator.doOnStop(args);
|
|
5195
|
+
}
|
|
5196
|
+
pause(args=null){
|
|
5197
|
+
this.paused=true;
|
|
5198
|
+
if(this.actuator.doOnSuspend) this.actuator.doOnSuspend(args);
|
|
5199
|
+
}
|
|
5200
|
+
resume(args=null){
|
|
5201
|
+
this.paused=false;
|
|
5202
|
+
if(this.actuator.doOnResume) this.actuator.doOnResume(args);
|
|
5203
|
+
}
|
|
5204
|
+
isPaused(){
|
|
5205
|
+
return this.paused;
|
|
5206
|
+
}
|
|
5207
|
+
doStep(args=null){
|
|
5208
|
+
if(!this.isStarted() || this.paused) return;
|
|
5209
|
+
// Looping index with a delay :
|
|
5210
|
+
|
|
5211
|
+
const delayHasPassed=hasDelayPassed(this.time, this.refreshMillis*this.durationTimeFactorHolder.getDurationTimeFactor());
|
|
5212
|
+
if(!this.refreshMillis || delayHasPassed){
|
|
5213
|
+
if(this.refreshMillis && delayHasPassed){
|
|
5214
|
+
this.time=getNow();
|
|
5215
|
+
}
|
|
5216
|
+
// We perform the step :
|
|
5217
|
+
if(this.actuator.terminateFunction && this.actuator.terminateFunction(args)){
|
|
5218
|
+
this.stop(args);
|
|
5219
|
+
return;
|
|
5220
|
+
}
|
|
5221
|
+
if(this.actuator.doOnEachStep) this.actuator.doOnEachStep(args);
|
|
5222
|
+
}
|
|
5223
|
+
|
|
5224
|
+
}
|
|
5225
|
+
|
|
5226
|
+
}
|
|
5227
|
+
|
|
5228
|
+
|
|
5229
|
+
window.getMonoThreadedRoutine=function(actuator, refreshMillis=null, startDependsOnParentOnly=false){
|
|
5230
|
+
return new MonoThreadedRoutine(actuator, refreshMillis, startDependsOnParentOnly);
|
|
5231
|
+
}
|
|
5232
|
+
|
|
5233
|
+
|
|
5234
|
+
window.MonoThreadedGoToGoal=class {
|
|
5235
|
+
constructor(actuator,actualValue,goalValue,refreshMillis=null,totalTimeMillis=1000,mode="linear"){
|
|
5236
|
+
|
|
5237
|
+
this.actuator=actuator;
|
|
5238
|
+
|
|
5239
|
+
this.actualValue=actualValue;
|
|
5240
|
+
this.mode=mode;
|
|
5241
|
+
this.totalTimeMillis=totalTimeMillis;
|
|
5242
|
+
this.stepValue=((refreshMillis*(goalValue-actualValue))/totalTimeMillis);
|
|
5243
|
+
this.value=actualValue;
|
|
5244
|
+
this.goalValue=goalValue;
|
|
5245
|
+
this.started=false;
|
|
5246
|
+
this.paused=false;
|
|
5247
|
+
this.time=getNow();
|
|
5248
|
+
this.refreshMillis=refreshMillis;
|
|
5249
|
+
|
|
5250
|
+
this.durationTimeFactorHolder={durationTimeFactor:1};
|
|
5251
|
+
|
|
5252
|
+
// Three-states : started, paused, stopped.
|
|
5253
|
+
}
|
|
5254
|
+
setDurationTimeFactorHolder(durationTimeFactorHolder){
|
|
5255
|
+
this.durationTimeFactorHolder=durationTimeFactorHolder;
|
|
5256
|
+
|
|
5257
|
+
// We recalculate total time-dependent values :
|
|
5258
|
+
this.totalTimeMillis=this.totalTimeMillis*this.durationTimeFactorHolder.getDurationTimeFactor();
|
|
5259
|
+
this.stepValue=((this.refreshMillis*(this.goalValue-this.actualValue))/this.totalTimeMillis);
|
|
5260
|
+
|
|
5261
|
+
return this;
|
|
5262
|
+
}
|
|
5263
|
+
isStarted(){
|
|
5264
|
+
return this.started || this.startDependsOnParentOnly;
|
|
5265
|
+
}
|
|
5266
|
+
resetValueAndGoalTo(resetValue){
|
|
5267
|
+
this.value=resetValue;
|
|
5268
|
+
this.goalValue=resetValue;
|
|
5269
|
+
return this;
|
|
5270
|
+
}
|
|
5271
|
+
setNewGoal(goalValue, refreshMillisParam=null, totalTimeMillis=null){
|
|
5272
|
+
if(Math.round(this.value)===Math.round(goalValue)) return;
|
|
5273
|
+
if(refreshMillisParam) this.refreshMillis=refreshMillisParam;
|
|
5274
|
+
if(totalTimeMillis) this.totalTimeMillis=totalTimeMillis*this.durationTimeFactorHolder.getDurationTimeFactor();
|
|
5275
|
+
|
|
5276
|
+
this.goalValue=goalValue;
|
|
5277
|
+
this.stepValue=((this.refreshMillis*(this.goalValue-this.value))/this.totalTimeMillis);
|
|
5278
|
+
|
|
5279
|
+
if(!this.isStarted()) this.start();
|
|
5280
|
+
|
|
5281
|
+
return this;
|
|
5282
|
+
}
|
|
5283
|
+
start(args=null){
|
|
5284
|
+
|
|
5285
|
+
if( this.value===this.goalValue
|
|
5286
|
+
// || this.isStarted();
|
|
5287
|
+
|| (this.actuator.terminateFunction && this.actuator.terminateFunction())
|
|
5288
|
+
|| this.hasReachedGoal()){
|
|
5289
|
+
|
|
5290
|
+
// CAUTION : Even if the routine is «pre-terminated» before even starting
|
|
5291
|
+
// (ie. its stop conditions are fullfilled even before it has started)
|
|
5292
|
+
// we all the same have to trigger its stop treatments :
|
|
5293
|
+
if(this.actuator.doOnStop) this.actuator.doOnStop(args);
|
|
5294
|
+
|
|
5295
|
+
return;
|
|
5296
|
+
}
|
|
5297
|
+
this.started=true;
|
|
5298
|
+
this.paused=false;
|
|
5299
|
+
|
|
5300
|
+
return this;
|
|
5301
|
+
}
|
|
5302
|
+
stop(args=null){
|
|
5303
|
+
if(!this.isStarted()) return;
|
|
5304
|
+
this.started=false;
|
|
5305
|
+
if(this.actuator.doOnStop) this.actuator.doOnStop(args);
|
|
5306
|
+
}
|
|
5307
|
+
pause(){
|
|
5308
|
+
this.paused=true;
|
|
5309
|
+
}
|
|
5310
|
+
resume(){
|
|
5311
|
+
this.paused=false;
|
|
5312
|
+
}
|
|
5313
|
+
hasReachedGoal(){
|
|
5314
|
+
if(this.stepValue<0){
|
|
5315
|
+
if(this.value<=this.goalValue) return true;
|
|
5316
|
+
}else{
|
|
5317
|
+
if(this.goalValue<=this.value) return true;
|
|
5318
|
+
}
|
|
5319
|
+
return false;
|
|
5320
|
+
}
|
|
5321
|
+
|
|
5322
|
+
doStep(args=null){
|
|
5323
|
+
if(!this.isStarted() || this.paused) return this.value;
|
|
5324
|
+
|
|
5325
|
+
// Looping index with a delay :
|
|
5326
|
+
|
|
5327
|
+
if(!this.refreshMillis || this.hasDelayPassed()){
|
|
5328
|
+
if(this.refreshMillis && this.hasDelayPassed()){
|
|
5329
|
+
this.time=getNow();
|
|
5330
|
+
}
|
|
5331
|
+
|
|
5332
|
+
// We check if we must stop :
|
|
5333
|
+
if(this.actuator.terminateFunction){
|
|
5334
|
+
if(this.actuator.terminateFunction()){
|
|
5335
|
+
this.stop();
|
|
5336
|
+
this.value=this.goalValue;
|
|
5337
|
+
return this.value;
|
|
5338
|
+
}
|
|
5339
|
+
}else{
|
|
5340
|
+
if(this.hasReachedGoal()){
|
|
5341
|
+
this.stop();
|
|
5342
|
+
this.value=this.goalValue;
|
|
5343
|
+
return this.value;
|
|
5344
|
+
}
|
|
5345
|
+
}
|
|
5346
|
+
|
|
5347
|
+
// We perform the step :
|
|
5348
|
+
if(this.mode==="exponential"){
|
|
5349
|
+
this.value+=Math.pow(this.stepValue,2);
|
|
5350
|
+
}else{ // default is "linear"
|
|
5351
|
+
this.value+=this.stepValue;
|
|
5352
|
+
}
|
|
5353
|
+
|
|
5354
|
+
if(this.actuator.doOnEachStep) this.actuator.doOnEachStep(args);
|
|
5355
|
+
}
|
|
5356
|
+
|
|
5357
|
+
return this.value;
|
|
5358
|
+
}
|
|
5359
|
+
|
|
5360
|
+
hasDelayPassed(){
|
|
5361
|
+
return (!this.time || hasDelayPassed(this.time, this.refreshMillis*this.durationTimeFactorHolder.getDurationTimeFactor()));
|
|
5362
|
+
}
|
|
5363
|
+
|
|
5364
|
+
|
|
5365
|
+
}
|
|
5366
|
+
|
|
5367
|
+
|
|
5368
|
+
window.getMonoThreadedGoToGoal=function(actuator,actualValue,goalValue,refreshMillis=null,totalTimeMillis=1000,mode="linear"){
|
|
5369
|
+
return new MonoThreadedGoToGoal(actuator,actualValue,goalValue,refreshMillis,totalTimeMillis,mode);
|
|
5370
|
+
}
|
|
5371
|
+
|
|
5372
|
+
|
|
5373
|
+
// =====================================================================================================================
|
|
5374
|
+
|
|
5375
|
+
// -------------------------------------------------------------------------
|
|
5376
|
+
|
|
5377
|
+
|
|
5120
5378
|
|
|
5121
5379
|
// MUST REMAIN AT THE END OF THIS LIBRARY FILE !
|
|
5122
5380
|
|
|
@@ -5126,7 +5384,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
|
|
|
5126
5384
|
|
|
5127
5385
|
|
|
5128
5386
|
|
|
5129
|
-
/*utils CLIENT library associated with aotra version : «1_29072022-2359 (05/04/2026-12:
|
|
5387
|
+
/*utils CLIENT library associated with aotra version : «1_29072022-2359 (05/04/2026-12:42:00)»*/
|
|
5130
5388
|
/*-----------------------------------------------------------------------------*/
|
|
5131
5389
|
/* ## Utility global methods in a browser (htmljs) client environment.
|
|
5132
5390
|
*
|
|
@@ -9320,260 +9578,6 @@ function getSpriteMonoThreaded(imagesPool,/*OPTIONAL*/refreshMillis=null,
|
|
|
9320
9578
|
zoomsParam);
|
|
9321
9579
|
}
|
|
9322
9580
|
|
|
9323
|
-
// ====================================================== ROUTINES ======================================================
|
|
9324
|
-
|
|
9325
|
-
|
|
9326
|
-
// ======================== Timeout ========================
|
|
9327
|
-
|
|
9328
|
-
// CAUTION : This is not a routine, but a single-use timeout !
|
|
9329
|
-
class MonoThreadedTimeout{
|
|
9330
|
-
constructor(actuator, delayMillis){
|
|
9331
|
-
this.actuator=actuator;
|
|
9332
|
-
}
|
|
9333
|
-
start(delayMillis=null){
|
|
9334
|
-
this.started=true;
|
|
9335
|
-
this.time=getNow();
|
|
9336
|
-
this.delayMillis=delayMillis;
|
|
9337
|
-
}
|
|
9338
|
-
doStep(args=null){
|
|
9339
|
-
if(!this.started) return;
|
|
9340
|
-
if(!hasDelayPassed(this.time, this.delayMillis)) return;
|
|
9341
|
-
return this.stop(args);
|
|
9342
|
-
}
|
|
9343
|
-
stop(args=null){
|
|
9344
|
-
if(!this.started) return;
|
|
9345
|
-
this.started=false;
|
|
9346
|
-
if(this.actuator.doOnStop) this.actuator.doOnStop(args);
|
|
9347
|
-
return this;
|
|
9348
|
-
}
|
|
9349
|
-
}
|
|
9350
|
-
|
|
9351
|
-
function getMonoThreadedTimeout(actuator=null){
|
|
9352
|
-
return new MonoThreadedTimeout(actuator);
|
|
9353
|
-
}
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
// ======================== Routine ========================
|
|
9357
|
-
|
|
9358
|
-
class MonoThreadedRoutine{
|
|
9359
|
-
constructor(actuator,refreshMillis=null,startDependsOnParentOnly=false){
|
|
9360
|
-
|
|
9361
|
-
this.actuator=actuator;
|
|
9362
|
-
this.startDependsOnParentOnly=startDependsOnParentOnly;
|
|
9363
|
-
this.started=false;
|
|
9364
|
-
this.paused=false;
|
|
9365
|
-
this.time=getNow();
|
|
9366
|
-
this.refreshMillis=refreshMillis;
|
|
9367
|
-
|
|
9368
|
-
this.durationTimeFactorHolder={durationTimeFactor:1};
|
|
9369
|
-
// Three-states : started, paused, stopped.
|
|
9370
|
-
|
|
9371
|
-
}
|
|
9372
|
-
|
|
9373
|
-
setDurationTimeFactorHolder(durationTimeFactorHolder){
|
|
9374
|
-
this.durationTimeFactorHolder=durationTimeFactorHolder;
|
|
9375
|
-
return this;
|
|
9376
|
-
}
|
|
9377
|
-
isStarted(){
|
|
9378
|
-
return this.started || this.startDependsOnParentOnly;
|
|
9379
|
-
}
|
|
9380
|
-
start(args=null){
|
|
9381
|
-
// if(this.isStarted()) return;
|
|
9382
|
-
if(this.actuator.terminateFunction && this.actuator.terminateFunction(args)){
|
|
9383
|
-
// CAUTION : Even if the routine is «pre-terminated» before even starting
|
|
9384
|
-
// (ie. its stop conditions are fullfilled even before it has started)
|
|
9385
|
-
// we all the same have to trigger its stop treatments :
|
|
9386
|
-
if(this.actuator.doOnStop) this.actuator.doOnStop(args);
|
|
9387
|
-
return;
|
|
9388
|
-
}
|
|
9389
|
-
this.started=true;
|
|
9390
|
-
this.paused=false;
|
|
9391
|
-
return this;
|
|
9392
|
-
}
|
|
9393
|
-
stop(args=null){
|
|
9394
|
-
if(!this.isStarted()) return;
|
|
9395
|
-
this.started=false;
|
|
9396
|
-
if(this.actuator.doOnStop) this.actuator.doOnStop(args);
|
|
9397
|
-
}
|
|
9398
|
-
pause(args=null){
|
|
9399
|
-
this.paused=true;
|
|
9400
|
-
if(this.actuator.doOnSuspend) this.actuator.doOnSuspend(args);
|
|
9401
|
-
}
|
|
9402
|
-
resume(args=null){
|
|
9403
|
-
this.paused=false;
|
|
9404
|
-
if(this.actuator.doOnResume) this.actuator.doOnResume(args);
|
|
9405
|
-
}
|
|
9406
|
-
isPaused(){
|
|
9407
|
-
return this.paused;
|
|
9408
|
-
}
|
|
9409
|
-
doStep(args=null){
|
|
9410
|
-
if(!this.isStarted() || this.paused) return;
|
|
9411
|
-
// Looping index with a delay :
|
|
9412
|
-
|
|
9413
|
-
const delayHasPassed=hasDelayPassed(this.time, this.refreshMillis*this.durationTimeFactorHolder.getDurationTimeFactor());
|
|
9414
|
-
if(!this.refreshMillis || delayHasPassed){
|
|
9415
|
-
if(this.refreshMillis && delayHasPassed){
|
|
9416
|
-
this.time=getNow();
|
|
9417
|
-
}
|
|
9418
|
-
// We perform the step :
|
|
9419
|
-
if(this.actuator.terminateFunction && this.actuator.terminateFunction(args)){
|
|
9420
|
-
this.stop(args);
|
|
9421
|
-
return;
|
|
9422
|
-
}
|
|
9423
|
-
if(this.actuator.doOnEachStep) this.actuator.doOnEachStep(args);
|
|
9424
|
-
}
|
|
9425
|
-
|
|
9426
|
-
}
|
|
9427
|
-
|
|
9428
|
-
}
|
|
9429
|
-
|
|
9430
|
-
|
|
9431
|
-
function getMonoThreadedRoutine(actuator, refreshMillis=null, startDependsOnParentOnly=false){
|
|
9432
|
-
return new MonoThreadedRoutine(actuator, refreshMillis, startDependsOnParentOnly);
|
|
9433
|
-
}
|
|
9434
|
-
|
|
9435
|
-
|
|
9436
|
-
class MonoThreadedGoToGoal{
|
|
9437
|
-
constructor(actuator,actualValue,goalValue,refreshMillis=null,totalTimeMillis=1000,mode="linear"){
|
|
9438
|
-
|
|
9439
|
-
this.actuator=actuator;
|
|
9440
|
-
|
|
9441
|
-
this.actualValue=actualValue;
|
|
9442
|
-
this.mode=mode;
|
|
9443
|
-
this.totalTimeMillis=totalTimeMillis;
|
|
9444
|
-
this.stepValue=((refreshMillis*(goalValue-actualValue))/totalTimeMillis);
|
|
9445
|
-
this.value=actualValue;
|
|
9446
|
-
this.goalValue=goalValue;
|
|
9447
|
-
this.started=false;
|
|
9448
|
-
this.paused=false;
|
|
9449
|
-
this.time=getNow();
|
|
9450
|
-
this.refreshMillis=refreshMillis;
|
|
9451
|
-
|
|
9452
|
-
this.durationTimeFactorHolder={durationTimeFactor:1};
|
|
9453
|
-
|
|
9454
|
-
// Three-states : started, paused, stopped.
|
|
9455
|
-
}
|
|
9456
|
-
setDurationTimeFactorHolder(durationTimeFactorHolder){
|
|
9457
|
-
this.durationTimeFactorHolder=durationTimeFactorHolder;
|
|
9458
|
-
|
|
9459
|
-
// We recalculate total time-dependent values :
|
|
9460
|
-
this.totalTimeMillis=this.totalTimeMillis*this.durationTimeFactorHolder.getDurationTimeFactor();
|
|
9461
|
-
this.stepValue=((this.refreshMillis*(this.goalValue-this.actualValue))/this.totalTimeMillis);
|
|
9462
|
-
|
|
9463
|
-
return this;
|
|
9464
|
-
}
|
|
9465
|
-
isStarted(){
|
|
9466
|
-
return this.started || this.startDependsOnParentOnly;
|
|
9467
|
-
}
|
|
9468
|
-
resetValueAndGoalTo(resetValue){
|
|
9469
|
-
this.value=resetValue;
|
|
9470
|
-
this.goalValue=resetValue;
|
|
9471
|
-
return this;
|
|
9472
|
-
}
|
|
9473
|
-
setNewGoal(goalValue, refreshMillisParam=null, totalTimeMillis=null){
|
|
9474
|
-
if(Math.round(this.value)===Math.round(goalValue)) return;
|
|
9475
|
-
if(refreshMillisParam) this.refreshMillis=refreshMillisParam;
|
|
9476
|
-
if(totalTimeMillis) this.totalTimeMillis=totalTimeMillis*this.durationTimeFactorHolder.getDurationTimeFactor();
|
|
9477
|
-
|
|
9478
|
-
this.goalValue=goalValue;
|
|
9479
|
-
this.stepValue=((this.refreshMillis*(this.goalValue-this.value))/this.totalTimeMillis);
|
|
9480
|
-
|
|
9481
|
-
if(!this.isStarted()) this.start();
|
|
9482
|
-
|
|
9483
|
-
return this;
|
|
9484
|
-
}
|
|
9485
|
-
start(args=null){
|
|
9486
|
-
|
|
9487
|
-
if( this.value===this.goalValue
|
|
9488
|
-
// || this.isStarted();
|
|
9489
|
-
|| (this.actuator.terminateFunction && this.actuator.terminateFunction())
|
|
9490
|
-
|| this.hasReachedGoal()){
|
|
9491
|
-
|
|
9492
|
-
// CAUTION : Even if the routine is «pre-terminated» before even starting
|
|
9493
|
-
// (ie. its stop conditions are fullfilled even before it has started)
|
|
9494
|
-
// we all the same have to trigger its stop treatments :
|
|
9495
|
-
if(this.actuator.doOnStop) this.actuator.doOnStop(args);
|
|
9496
|
-
|
|
9497
|
-
return;
|
|
9498
|
-
}
|
|
9499
|
-
this.started=true;
|
|
9500
|
-
this.paused=false;
|
|
9501
|
-
|
|
9502
|
-
return this;
|
|
9503
|
-
}
|
|
9504
|
-
stop(args=null){
|
|
9505
|
-
if(!this.isStarted()) return;
|
|
9506
|
-
this.started=false;
|
|
9507
|
-
if(this.actuator.doOnStop) this.actuator.doOnStop(args);
|
|
9508
|
-
}
|
|
9509
|
-
pause(){
|
|
9510
|
-
this.paused=true;
|
|
9511
|
-
}
|
|
9512
|
-
resume(){
|
|
9513
|
-
this.paused=false;
|
|
9514
|
-
}
|
|
9515
|
-
hasReachedGoal(){
|
|
9516
|
-
if(this.stepValue<0){
|
|
9517
|
-
if(this.value<=this.goalValue) return true;
|
|
9518
|
-
}else{
|
|
9519
|
-
if(this.goalValue<=this.value) return true;
|
|
9520
|
-
}
|
|
9521
|
-
return false;
|
|
9522
|
-
}
|
|
9523
|
-
|
|
9524
|
-
doStep(args=null){
|
|
9525
|
-
if(!this.isStarted() || this.paused) return this.value;
|
|
9526
|
-
|
|
9527
|
-
// Looping index with a delay :
|
|
9528
|
-
|
|
9529
|
-
if(!this.refreshMillis || this.hasDelayPassed()){
|
|
9530
|
-
if(this.refreshMillis && this.hasDelayPassed()){
|
|
9531
|
-
this.time=getNow();
|
|
9532
|
-
}
|
|
9533
|
-
|
|
9534
|
-
// We check if we must stop :
|
|
9535
|
-
if(this.actuator.terminateFunction){
|
|
9536
|
-
if(this.actuator.terminateFunction()){
|
|
9537
|
-
this.stop();
|
|
9538
|
-
this.value=this.goalValue;
|
|
9539
|
-
return this.value;
|
|
9540
|
-
}
|
|
9541
|
-
}else{
|
|
9542
|
-
if(this.hasReachedGoal()){
|
|
9543
|
-
this.stop();
|
|
9544
|
-
this.value=this.goalValue;
|
|
9545
|
-
return this.value;
|
|
9546
|
-
}
|
|
9547
|
-
}
|
|
9548
|
-
|
|
9549
|
-
// We perform the step :
|
|
9550
|
-
if(this.mode==="exponential"){
|
|
9551
|
-
this.value+=Math.pow(this.stepValue,2);
|
|
9552
|
-
}else{ // default is "linear"
|
|
9553
|
-
this.value+=this.stepValue;
|
|
9554
|
-
}
|
|
9555
|
-
|
|
9556
|
-
if(this.actuator.doOnEachStep) this.actuator.doOnEachStep(args);
|
|
9557
|
-
}
|
|
9558
|
-
|
|
9559
|
-
return this.value;
|
|
9560
|
-
}
|
|
9561
|
-
|
|
9562
|
-
hasDelayPassed(){
|
|
9563
|
-
return (!this.time || hasDelayPassed(this.time, this.refreshMillis*this.durationTimeFactorHolder.getDurationTimeFactor()));
|
|
9564
|
-
}
|
|
9565
|
-
|
|
9566
|
-
|
|
9567
|
-
}
|
|
9568
|
-
|
|
9569
|
-
|
|
9570
|
-
function getMonoThreadedGoToGoal(actuator,actualValue,goalValue,refreshMillis=null,totalTimeMillis=1000,mode="linear"){
|
|
9571
|
-
return new MonoThreadedGoToGoal(actuator,actualValue,goalValue,refreshMillis,totalTimeMillis,mode);
|
|
9572
|
-
}
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
// =====================================================================================================================
|
|
9576
|
-
|
|
9577
9581
|
|
|
9578
9582
|
//if signed :
|
|
9579
9583
|
//when precision==1/10000, range is -3.2766 to 3.2766
|
|
@@ -13206,7 +13210,7 @@ createOritaMicroClient=function(url, port, isNode=false, staticMicroClientIdPara
|
|
|
13206
13210
|
|
|
13207
13211
|
|
|
13208
13212
|
|
|
13209
|
-
/*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (05/04/2026-12:
|
|
13213
|
+
/*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (05/04/2026-12:42:00)»*/
|
|
13210
13214
|
/*-----------------------------------------------------------------------------*/
|
|
13211
13215
|
|
|
13212
13216
|
|
|
@@ -14535,10 +14539,10 @@ function rayVsUnitSphereClosestPoint(p, r) {
|
|
|
14535
14539
|
// MUST REMAIN AT THE END OF THIS LIBRARY FILE !
|
|
14536
14540
|
|
|
14537
14541
|
AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
|
|
14538
|
-
/*utils 3D library associated with aotra version : «1_29072022-2359 (05/04/2026-12:
|
|
14542
|
+
/*utils 3D library associated with aotra version : «1_29072022-2359 (05/04/2026-12:42:00)»*/
|
|
14539
14543
|
/*-----------------------------------------------------------------------------*/
|
|
14540
14544
|
|
|
14541
|
-
/*utils AI library associated with aotra version : «1_29072022-2359 (05/04/2026-12:
|
|
14545
|
+
/*utils AI library associated with aotra version : «1_29072022-2359 (05/04/2026-12:42:00)»*/
|
|
14542
14546
|
/*-----------------------------------------------------------------------------*/
|
|
14543
14547
|
|
|
14544
14548
|
|
|
@@ -14684,7 +14688,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
|
|
|
14684
14688
|
|
|
14685
14689
|
|
|
14686
14690
|
|
|
14687
|
-
/*utils CONSOLE library associated with aotra version : «1_29072022-2359 (05/04/2026-12:
|
|
14691
|
+
/*utils CONSOLE library associated with aotra version : «1_29072022-2359 (05/04/2026-12:42:00)»*/
|
|
14688
14692
|
/*-----------------------------------------------------------------------------*/
|
|
14689
14693
|
|
|
14690
14694
|
|
aotrautils/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1840",
|
|
4
4
|
"main": "aotrautils.build.js",
|
|
5
5
|
"description": "A library for vanilla javascript utils (client-side) used in aotra javascript CMS",
|
|
6
6
|
"author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",
|