0.2.12: Fixed ghost active link, and fixed delay element
This commit is contained in:
parent
6067c9f22a
commit
86fb2873fb
@ -12,6 +12,10 @@ To be decided, but at this moment this code is open source and free to use for n
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
### 0.2.12
|
||||||
|
* Fixed floating active link when deleting an element while linking
|
||||||
|
* Fixed the delay element so that it properly buffers all input pulses
|
||||||
|
|
||||||
### 0.2.11
|
### 0.2.11
|
||||||
* Added Delay element
|
* Added Delay element
|
||||||
|
|
||||||
|
@ -302,6 +302,8 @@ class Element extends CanvasTools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Delete() {
|
Delete() {
|
||||||
|
// if we are active linking stop doing so
|
||||||
|
if (this.LogicEngine.ActiveLink == this) this.LogicEngine.ActiveLink = false;
|
||||||
// Just to clean up connections
|
// Just to clean up connections
|
||||||
for (let a = 0; a < this.OutputConnections.length;a++) {
|
for (let a = 0; a < this.OutputConnections.length;a++) {
|
||||||
this.LogicEngine.RecursionCount = 0;
|
this.LogicEngine.RecursionCount = 0;
|
||||||
@ -649,15 +651,25 @@ class DelayElement extends Element {
|
|||||||
this.Task.Enabled = false;
|
this.Task.Enabled = false;
|
||||||
this.Task.LastCall = Date.now();
|
this.Task.LastCall = Date.now();
|
||||||
this.Task.Time = this.Period;
|
this.Task.Time = this.Period;
|
||||||
|
if (this.InputPulses.length > 0) {
|
||||||
|
this.Task.Enabled = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.Output = true;
|
this.Output = true;
|
||||||
this.Task.Enabled = false;
|
this.Task.Enabled = false;
|
||||||
if (this.InputEnd > 0) {
|
if (this.InputPulses.length > 0) {
|
||||||
this.Task.Time = this.InputEnd - this.InputStart;
|
this.Task.Time = this.InputPulses[0];
|
||||||
this.Task.Enabled = true;
|
this.Task.Enabled = true;
|
||||||
|
this.InputPulses.splice(0,1);
|
||||||
|
} else {
|
||||||
|
if (this.InputEnd > 0) {
|
||||||
|
this.Task.Time = this.InputEnd - this.InputStart;
|
||||||
|
this.Task.Enabled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.Task.LastCall = Date.now();
|
this.Task.LastCall = Date.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let a = 0; a < this.OutputConnections.length; a++) {
|
for (let a = 0; a < this.OutputConnections.length; a++) {
|
||||||
this.LogicEngine.RecursionCount = 0;
|
this.LogicEngine.RecursionCount = 0;
|
||||||
this.OutputConnections[a].Element.setInput(this.OutputConnections[a].Input, this.getOutput());
|
this.OutputConnections[a].Element.setInput(this.OutputConnections[a].Input, this.getOutput());
|
||||||
@ -689,11 +701,24 @@ class DelayElement extends Element {
|
|||||||
this.Task.LastCall = Date.now();
|
this.Task.LastCall = Date.now();
|
||||||
this.Task.Enabled = true;
|
this.Task.Enabled = true;
|
||||||
} else {
|
} else {
|
||||||
this.InputEnd = Date.now();
|
if (!this.Inputs[Input]) {
|
||||||
if (!this.Task.Enabled) {
|
this.InputEnd = Date.now();
|
||||||
this.Task.LastCall = Date.now();
|
if (this.InputPulses.length > 0) {
|
||||||
this.Task.Time = (this.InputEnd - this.InputStart) - (Date.now() - this.InputEnd);
|
this.InputPulses.push(this.InputEnd - this.InputStart);
|
||||||
this.Task.Enabled = true;
|
this.InputStart = 0;
|
||||||
|
this.InputEnd = 0;
|
||||||
|
} else {
|
||||||
|
if (!this.Task.Enabled) {
|
||||||
|
this.Task.LastCall = Date.now();
|
||||||
|
this.Task.Time = (this.InputEnd - this.InputStart) - (Date.now() - this.InputEnd);
|
||||||
|
this.Task.Enabled = true;
|
||||||
|
} else {
|
||||||
|
this.InputPulses.push(this.InputEnd - this.InputStart);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// We are in a condition where input went true, but the task is already enabled
|
||||||
|
this.InputStart = Date.now();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -712,6 +737,7 @@ class DelayElement extends Element {
|
|||||||
this.Properties.push(periodProperty);
|
this.Properties.push(periodProperty);
|
||||||
this.InputStart = 0;
|
this.InputStart = 0;
|
||||||
this.InputEnd = 0;
|
this.InputEnd = 0;
|
||||||
|
this.InputPulses = new Array();
|
||||||
this.Inputs[0] = false;
|
this.Inputs[0] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
MatCat BrowserLogic Simulator
|
MatCat BrowserLogic Simulator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let Version = "0.2.11";
|
let Version = "0.2.12";
|
||||||
let spanVersion = document.getElementById("version");
|
let spanVersion = document.getElementById("version");
|
||||||
spanVersion.innerText = Version;
|
spanVersion.innerText = Version;
|
||||||
// get the canvas and get the engine object going
|
// get the canvas and get the engine object going
|
||||||
|
Loading…
Reference in New Issue
Block a user