Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pandrr committed Feb 12, 2025
1 parent ecdb64e commit d00f99c
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 51 deletions.
6 changes: 5 additions & 1 deletion src/ui/components/opsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ export default class OpSearch extends Events
let p = 4;
if (orig.length === 2)p = 10;
if (orig.length === 3)p = 8;

console.log(orig, query);
if (orig === orig.toUpperCase())p *= 3;

scoreDebug += "+" + p + " abbreviation<br/>";
points += p;
}
Expand Down Expand Up @@ -351,7 +355,7 @@ export default class OpSearch extends Events
perf.finish();
}

search(query)
search(query, originalSearch)
{
document.getElementById("realsearch").innerHTML = "";
document.getElementById("opOptions").innerHTML = "";
Expand Down
2 changes: 1 addition & 1 deletion src/ui/dialogs/opselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ export default class OpSelect
if (this._getQuery().length < MIN_CHARS_QUERY && !this.isMathQuery())
this._opSearch.search("");
else
this._opSearch.search(query);
this._opSearch.search(query, sq);

const perf = gui.uiProfiler.start("opselect.searchLoop");

Expand Down
1 change: 0 additions & 1 deletion src/ui/elements/canvasoverlays/htmlinspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export default class HtmlInspector
}, { "passive": true });
}


_move(e)
{
clearTimeout(this._timeoutHide);
Expand Down
14 changes: 5 additions & 9 deletions src/ui/glpatch/glcable.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ export default class GlCable
this._buttonRect.setShape(1);
this._buttonRect.visible = false;

this._buttonRect.on("hover", () =>
this._buttonRect.on(GlRect.EVENT_POINTER_HOVER, () =>
{
this.setCloseToMouse(true);
this._link.cableHoverChanged(this, true);
this.updateColor();
});

this._buttonRect.on("unhover", () =>
this._buttonRect.on(GlRect.EVENT_POINTER_UNHOVER, () =>
{
this._unHover();
});
Expand Down Expand Up @@ -150,7 +150,7 @@ export default class GlCable
_unHover()
{
this.setCloseToMouse(false);
this._link.cableHoverChanged(this, false);
this._link.cableHoverChanged();
this.updateColor();
}

Expand Down Expand Up @@ -430,16 +430,12 @@ export default class GlCable

get hovering()
{
return this._buttonRect.isHovering || (this._glOpIn && this._glOpIn.hovering) || (this._glOpOut && this._glOpOut.hovering);
return this._buttonRect.isHovering() || (this._link._glOpIn && this._link._glOpIn.hovering) || (this._link._glOpOut && this._link._glOpOut.hovering);
}

updateColor()
{
if (this._disposed)
{
// console.log((new Error()).stack);
return;
}
if (this._disposed) return;

let hover = this.hovering;
let selected = false;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/glpatch/gldragline.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export default class GlDragLine
if (!this.isActive) this._glPatch.showOpCursor(false);
if (!this.isActive) return;

if (!this._glPatch.isMouseOverOp() && (!this._glPatch._cablesHoverButtonRect || !this._glPatch._cablesHoverButtonRect._hovering)) this._glPatch.showOpCursor(true);
if (!this._glPatch.isMouseOverOp() && (!this._glPatch._cablesHoverButtonRect || !this._glPatch._cablesHoverButtonRect.isHovering)) this._glPatch.showOpCursor(true);
else this._glPatch.showOpCursor(false);

this._clearSpline();
Expand Down
2 changes: 1 addition & 1 deletion src/ui/glpatch/gllink.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Types } from "cables-shared-types";
import { TypesCore } from "cables-shared-types";
import { Logger } from "cables-shared-client";
import GlCable from "./glcable.js";
import MouseState from "./mousestate.js";
Expand Down
2 changes: 1 addition & 1 deletion src/ui/gltimeline/gltimeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ export default class GlTimeline extends Events
else
if (e.buttons == this.buttonForScrolling)
{
this.view.scroll(-25 * this.view.pixelToTime(e.movementX));
this.view.scroll(-this.view.pixelToTime(e.movementX) * 2, 0);
this.updateAllElements();
}
else
Expand Down
3 changes: 1 addition & 2 deletions src/ui/gltimeline/gltldragarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ export default class glTlDragArea extends Events
this.#glTl = glTl;
this.height = 24;

this.#rectBar = this.#glTl.rects.createRect({ "draggable": true, "interactive": true });
this.#rectBar = this.#glTl.rects.createRect({ "draggable": false, "interactive": false });
this.#rectBar.setSize(222, this.height);
this.#rectBar.setColor(0.5, 0.5, 0.5, 1);
this.#rectBar.setParent(parent);
this.#rectBar.setColorHover(0.65, 0.65, 0.65, 1);
// this.#rectBar.draggableMove = true;

this.#rectSizeLeft = this.#glTl.rects.createRect({ "draggable": true, "interactive": true });
this.#rectSizeLeft.setSize(this.#handleWidth, this.height);
Expand Down
55 changes: 28 additions & 27 deletions src/ui/gltimeline/gltlkeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default class glTlKeys extends Events
#keyRects = [];

/** @type {Array<GlRect>} */
#dopeRects = [];
// #dopeRects = [];

/** @type {GlRect} */
#parentRect = null;
Expand Down Expand Up @@ -211,29 +211,30 @@ export default class glTlKeys extends Events
else
for (let i = 0; i < this.#anim.keys.length; i++)
{
const kr = this.#dopeRects[i];
if (kr)
{
let x = this.#glTl.view.timeToPixel(this.#anim.keys[i].time - this.#glTl.view.offset);
let y = 0;
kr.setPosition(x, y, -0.1);

if (this.#anim.keys[i + 1])
{
if (i == 0)
{
kr.setPosition(this.#glTl.view.timeToPixel(0 - this.#glTl.view.offset), 0);
kr.setSize(this.#glTl.view.timeToPixel(this.#anim.keys[i + 1].time), this.#parentRect.h);
}
else
kr.setSize(this.#glTl.view.timeToPixel(this.#anim.keys[i + 1].time - this.#anim.keys[i].time), this.#parentRect.h);
}
else
{
// after last
kr.setSize(this.#glTl.view.timeToPixel(this.#glTl.duration - this.#anim.keys[i].time), this.#parentRect.h);
}
}
// const kr = this.#dopeRects[i];

// if (kr)
// {
// let x = this.#glTl.view.timeToPixel(this.#anim.keys[i].time - this.#glTl.view.offset);
// let y = 0;
// kr.setPosition(x, y, -0.1);

// if (this.#anim.keys[i + 1])
// {
// if (i == 0)
// {
// kr.setPosition(this.#glTl.view.timeToPixel(0 - this.#glTl.view.offset), 0);
// kr.setSize(this.#glTl.view.timeToPixel(this.#anim.keys[i + 1].time), this.#parentRect.h);
// }
// else
// kr.setSize(this.#glTl.view.timeToPixel(this.#anim.keys[i + 1].time - this.#anim.keys[i].time), this.#parentRect.h);
// }
// else
// {
// // after last
// kr.setSize(this.#glTl.view.timeToPixel(this.#glTl.duration - this.#anim.keys[i].time), this.#parentRect.h);
// }
// }
}
}

Expand All @@ -246,7 +247,7 @@ export default class glTlKeys extends Events
kr.setShape(13);
kr.setSize(this.sizeKey, this.sizeKey);
kr.setColor(1, 1, 1, 1);
kr.setColorHover(1, 0, 0, 1);
// kr.setColorHover(1, 0, 0, 1);
kr.setParent(this.#parentRect);
kr.key = this.#anim.keys[i];
const key = this.#anim.keys[i];
Expand Down Expand Up @@ -359,8 +360,8 @@ export default class glTlKeys extends Events
{
for (let i = 0; i < this.#keyRects.length; i++) this.#keyRects[i].dispose();
this.#keyRects = [];
for (let i = 0; i < this.#dopeRects.length; i++) this.#dopeRects[i].dispose();
this.#dopeRects = [];
// for (let i = 0; i < this.#dopeRects.length; i++) this.#dopeRects[i].dispose();
// this.#dopeRects = [];
}

dispose()
Expand Down
15 changes: 8 additions & 7 deletions src/ui/gltimeline/gltlview.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Types } from "cables-shared-types";
import GlTimeline from "./gltimeline.js";

export default class GlTlView
Expand All @@ -6,10 +7,10 @@ export default class GlTlView
/** @type {GlTimeline} */
#tl;

/** @type {Anim} */
/** @type {Types.Anim} */
#animZoom;

/** @type {Anim} */
/** @type {Types.Anim} */
#animScroll;

#zoom = 20;
Expand All @@ -18,11 +19,14 @@ export default class GlTlView

#timer = new CABLES.Timer();

/**
* @param {GlTimeline} tl
*/
constructor(tl)
{
this.#tl = tl;

const defaultEasing = CABLES.EASING_CUBIC_OUT;
const defaultEasing = CABLES.Anim.EASING_CUBIC_OUT;

this.#animZoom = new CABLES.Anim({ "defaultEasing": defaultEasing });
this.#animZoom.setValue(0, this.#zoom);
Expand All @@ -31,12 +35,11 @@ export default class GlTlView
this.#animScroll.setValue(0, this.#offset);

this.#timer.play();

}

get animsFinished()
{
return this.#animZoom.isFinished();
return this.#animZoom.isFinished(this.#timer.getTime()) && this.#animScroll.isFinished(this.#timer.getTime());
}

get zoom()
Expand Down Expand Up @@ -100,7 +103,6 @@ export default class GlTlView
let finalTime = this.#offset + delta;

this.#animScroll.clear(this.#timer.getTime());
this.#animScroll.setValue(this.#timer.getTime(), this.#offset);
this.#animScroll.setValue(this.#timer.getTime() + duration, finalTime);
}

Expand All @@ -111,7 +113,6 @@ export default class GlTlView
scrollTo(finalTime, duration = 0.2)
{
this.#animScroll.clear(this.#timer.getTime());
this.#animScroll.setValue(this.#timer.getTime(), this.#offset);
this.#animScroll.setValue(this.#timer.getTime() + duration, finalTime);
}

Expand Down

0 comments on commit d00f99c

Please sign in to comment.