WIP:0.4-ms Multiselect seems to be working well now

This commit is contained in:
MatCat 2021-03-08 20:04:38 -08:00
parent 0eb96aead8
commit bc315e2d37

View File

@ -63,9 +63,10 @@ class LogicEngine {
}
PropertyChange(property) {
if (!this.ActiveContainer.Selected.getProperty(property)) return false;
if (this.ActiveContainer.Selected.length > 1) return false;
if (!this.ActiveContainer.Selected[0].getProperty(property)) return false;
let propElement = document.getElementById("prop_" + property);
this.ActiveContainer.Selected.getProperty(property).Call(propElement.value);
this.ActiveContainer.Selected[0].getProperty(property).Call(propElement.value);
}
Mouse_Down(evt) {
@ -75,7 +76,12 @@ class LogicEngine {
let element = this.ActiveContainer.checkMouseBounds(mousePos);
if (element) {
this.MouseDown = true;
if (this.ActiveContainer.Selected.length <= 1) this.ActiveContainer.Select(element);
if (this.ActiveContainer.isSelected(element)) {
} else {
this.ActiveContainer.Select(element);
}
this.MovingElement = new Array(this.ActiveContainer.Selected.length);
for (let a = 0; a < this.ActiveContainer.Selected.length; a++) {
@ -106,7 +112,7 @@ class LogicEngine {
PropertiesBox.style.display = "none";
}
}
if (this.ActiveContainer.Selected) {
if (this.ActiveContainer.Selected?.length > 0) {
disableSelectedRCMs(false);
} else {
disableSelectedRCMs(true);
@ -145,7 +151,7 @@ class LogicEngine {
this.ActiveContainer.SelectWithin(cmStartPos.x,cmStartPos.y,cmEndPos.x,cmEndPos.y);
}
if (this.ActiveContainer.Selected) {
if (this.ActiveContainer.Selected?.length > 0) {
disableSelectedRCMs(false);
} else {
disableSelectedRCMs(true);
@ -217,7 +223,7 @@ class LogicEngine {
}
}
if (evt.key == "Delete") {
if (this.ActiveContainer.Selected) {
if (this.ActiveContainer.Selected?.length > 0) {
this.ActiveContainer.DeleteElement(this.ActiveContainer.Selected);
this.ActiveContainer.Selected = false;
let PropertiesBox = document.getElementById("PropertiesBox");
@ -262,7 +268,7 @@ class LogicEngine {
Link(input = 0) {
if (this.ActiveLink) {
if (this.ActiveContainer.Selected && (this.ActiveContainer.Selected != this.ActiveLink)) {
if ((this.ActiveContainer.Selected?.length == 1) && (this.ActiveContainer.Selected?.[0] != this.ActiveLink)) {
this.ActiveLink.addConnection(this.ActiveContainer,this.ActiveContainer.Selected[0],input,this.ActiveLink.OutputLink.Output);
this.ActiveLink = false;
} else {
@ -356,6 +362,6 @@ class LogicEngine {
StartEngine() {
this.Resize("");
this.DrawLoop();
this.DrawLoop(); // Get the animation loop going
}
}