Skip to content

Commit

Permalink
gltl
Browse files Browse the repository at this point in the history
  • Loading branch information
pandrr committed Jan 27, 2025
1 parent 51d69ad commit 3cd74c1
Show file tree
Hide file tree
Showing 10 changed files with 249 additions and 131 deletions.
12 changes: 6 additions & 6 deletions src/ui/api/opsserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -992,12 +992,6 @@ export default class ServerOps
ele.hide(ele.byId("opNameDialogSubmit"));
ele.hide(ele.byId("opNameDialogSubmitReplace"));

gui.jobs()
.start({
"id": "checkOpName" + fullName,
"title": "checking op name" + fullName
});

if (fullName)
{
const checkNameRequest = {
Expand All @@ -1009,6 +1003,12 @@ export default class ServerOps
const opTargetDirEle = ele.byId("opTargetDir");
if (opTargetDirEle) checkNameRequest.opTargetDir = opTargetDirEle.value;

gui.jobs()
.start({
"id": "checkOpName" + fullName,
"title": "checking op name" + fullName
});

platform.talkerAPI.send("checkOpName", checkNameRequest, (err, res) =>
{
if (err)
Expand Down
2 changes: 1 addition & 1 deletion src/ui/defaultops.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const defaultOpNames =
"TriggerOnChangeString": "Ops.Trigger.TriggerOnChangeString",
"triggerCounter": "Ops.Trigger.TriggerCounter",

"StringLength": "Ops.String.StringLength",
"StringLength": "Ops.String.StringLength_v2",
"parseFloat": "Ops.String.StringToNumber",
"arrayLength": "Ops.Array.ArrayLength_v2",
"StringToArray": "Ops.Array.StringToArray_v2",
Expand Down
33 changes: 26 additions & 7 deletions src/ui/gldraw/glrect.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ export default class GlRect extends Events

get idx() { return this.#attrIndex; }

get parent() { return this.#parent; }

hasChild(c)
{
return this.childs.indexOf(c) > -1;
Expand Down Expand Up @@ -273,10 +275,15 @@ export default class GlRect extends Events

this.#rectInstancer.setPosition(this.#attrIndex, this.#absX, this.#absY, this.#absZ);

for (let i = 0; i < this.childs.length; i++) this.childs[i].setPosition(this.childs[i].x, this.childs[i].y, this.childs[i].z);
for (let i = 0; i < this.childs.length; i++) this.childs[i].updateParentPosition();
this.emitEvent("positionChanged");
}

updateParentPosition()
{
this.setPosition(this.x, this.y, this.z);
}

/**
* Description
* @param {any} x
Expand Down Expand Up @@ -320,19 +327,31 @@ export default class GlRect extends Events
*/
getParentX()
{
// todo: add up all parents
if (!this.#parent) return 0;
return this.#parent.absX;
let px = 0;
let p = this.#parent;
while (p)
{
px += p.x;
p = p.parent;
}

return px;
}

/**
* @returns {number}
*/
getParentY()
{
// todo: add up all parents
if (!this.#parent) return 0;
return this.#parent.absY;
let py = 0;
let p = this.#parent;
while (p)
{
py += p.y;
p = p.parent;
}

return py;
}

/**
Expand Down
Loading

0 comments on commit 3cd74c1

Please sign in to comment.