Skip to content

Commit

Permalink
* Hidden addition to canvas (need to revisit, might be useful to set …
Browse files Browse the repository at this point in the history
…it off on init)

* run_fx fix for canned_ FX
  • Loading branch information
roboyeti committed Apr 19, 2023
1 parent 6ac59b7 commit cee4f63
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions fx/overfx.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class OverFx {
transparent: true,
backgroundColor: 'rgba(0,0,0,0)',
//parent: "gameContainer",
canvasStyle: "position:absolute;top:0px;left:0px;z-index:-10000;",
canvasStyle: "position:absolute;top:0px;left:0px;z-index:-10000;visibility:hidden;",
...ph_config
});

Expand Down Expand Up @@ -57,8 +57,8 @@ class OverFx {
}

// Raise or lower to the z-index min or max layer
to_front(zindex=this.config.z_index) { this.engine.canvas.style.zIndex = zindex; this.engine.canvas.focus(); }
to_back(zindex=(this.config.z_index*-1)) { this.engine.canvas.style.zIndex = zindex; this.engine.canvas.blur(); }
to_front(zindex=this.config.z_index) { this.engine.canvas.style.zIndex = zindex; this.engine.canvas.focus(); this.engine.canvas.style.visibility = 'visible'; }
to_back(zindex=(this.config.z_index*-1)) { this.engine.canvas.style.zIndex = zindex; this.engine.canvas.style.visibility = 'hidden'; this.engine.canvas.blur(); }

// Set volume from 0 to 1
volume(vol=null) {
Expand Down Expand Up @@ -90,7 +90,7 @@ class OverFx {
// Run FX a number of X times with min and max delays in ms
// Deprecated, see run_fx_timed()
fx_repeat(name,cnt=1,delay_min=150,delay_max=150) {
console.info('Deprecated. Use run_fx_repeat() instead.');
console.info('Deprecated. Use run_fx_timed() instead.');
for(var i=0;i<cnt;i++) {
setOverTimeout(() => {
this.run_fx(name);
Expand All @@ -109,9 +109,9 @@ class OverFx {

// Loads, if needed, the FX plugin and run_scene(fx) when done or if loaded.
run_fx(name,config={}) {
if (name.startsWith("canned_")) { this[name](config); return; }
if (name.startsWith("canned_")) { this[name](1); }
// if (!this.loaded[name]) { this.load_fx(name,()=>{ this._run_scene(name,config); this.loaded[name] = true; }) }
if (!this.loaded[name]) { this.load_fx(name,()=>{ this._run_scene(name,config); }) }
else if (!this.loaded[name]) { this.load_fx(name,()=>{ this._run_scene(name,config); }) }
else { this._run_scene(name,config); }
}

Expand Down

0 comments on commit cee4f63

Please sign in to comment.