mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-22 07:19:41 +00:00
Use npm package @ComfyOrg/litegraph (#89)
* Use npm to manage litegraph * Fix merge issues caused by BetaUI change * Switch to @comfyorg/litegraph * Fix various import * Fix css apply order bug * Fix package lock * Update litegraph * Update litegraph * Update browsertest expectations * Update test expectations [skip ci] * Fix default view screenshot --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
import { app } from "../../scripts/app";
|
||||
import {
|
||||
LGraphCanvas,
|
||||
LGraphNode,
|
||||
LGraphGroup,
|
||||
LiteGraph,
|
||||
} from "@comfyorg/litegraph";
|
||||
|
||||
// Shift + drag/resize to snap to grid
|
||||
|
||||
@@ -77,12 +83,14 @@ app.registerExtension({
|
||||
|
||||
let w, h;
|
||||
if (node.flags.collapsed) {
|
||||
// @ts-ignore
|
||||
w = node._collapsed_width;
|
||||
h = LiteGraph.NODE_TITLE_HEIGHT;
|
||||
shiftY -= LiteGraph.NODE_TITLE_HEIGHT;
|
||||
} else {
|
||||
w = node.size[0];
|
||||
h = node.size[1];
|
||||
// @ts-ignore
|
||||
let titleMode = node.constructor.title_mode;
|
||||
if (
|
||||
titleMode !== LiteGraph.TRANSPARENT_TITLE &&
|
||||
@@ -105,7 +113,7 @@ app.registerExtension({
|
||||
* The currently moving, selected group only. Set after the `selected_group` has actually started
|
||||
* moving.
|
||||
*/
|
||||
let selectedAndMovingGroup = null;
|
||||
let selectedAndMovingGroup: LGraphGroup | null = null;
|
||||
|
||||
/**
|
||||
* Handles moving a group; tracking when a group has been moved (to show the ghost in `drawGroups`
|
||||
@@ -154,13 +162,16 @@ app.registerExtension({
|
||||
LGraphCanvas.prototype.drawGroups = function (canvas, ctx) {
|
||||
if (this.selected_group && app.shiftDown) {
|
||||
if (this.selected_group_resizing) {
|
||||
// @ts-ignore
|
||||
roundVectorToGrid(this.selected_group.size);
|
||||
} else if (selectedAndMovingGroup) {
|
||||
// @ts-ignore
|
||||
const [x, y] = roundVectorToGrid([...selectedAndMovingGroup.pos]);
|
||||
const f = ctx.fillStyle;
|
||||
const s = ctx.strokeStyle;
|
||||
ctx.fillStyle = "rgba(100, 100, 100, 0.33)";
|
||||
ctx.strokeStyle = "rgba(100, 100, 100, 0.66)";
|
||||
// @ts-ignore
|
||||
ctx.rect(x, y, ...selectedAndMovingGroup.size);
|
||||
ctx.fill();
|
||||
ctx.stroke();
|
||||
|
||||
Reference in New Issue
Block a user