@gedit/editor-2d 0.1.91 → 0.1.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/editor2d-context-key-service.js +3 -3
- package/lib/browser/editor2d-context-key-service.js.map +1 -1
- package/lib/browser/editor2d-contribution.js +12 -12
- package/lib/browser/editor2d-contribution.js.map +1 -1
- package/lib/browser/editor2d-frontend-module.js +4 -4
- package/lib/browser/editor2d-frontend-module.js.map +1 -1
- package/lib/browser/editor2d-label-provider.js +6 -6
- package/lib/browser/editor2d-label-provider.js.map +1 -1
- package/lib/browser/editor2d-model-provider.js +6 -6
- package/lib/browser/editor2d-model-provider.js.map +1 -1
- package/lib/browser/editor2d-ref-provider-contribution.js +4 -4
- package/lib/browser/editor2d-ref-provider-contribution.js.map +1 -1
- package/lib/browser/editor2d-service.js +5 -5
- package/lib/browser/editor2d-service.js.map +1 -1
- package/lib/browser/index.d.ts +1 -0
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +7 -2
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/model/editor2d-document.d.ts.map +1 -1
- package/lib/browser/model/editor2d-document.js +31 -15
- package/lib/browser/model/editor2d-document.js.map +1 -1
- package/lib/browser/model/editor2d-model-container.js +2 -2
- package/lib/browser/model/editor2d-model-container.js.map +1 -1
- package/lib/browser/model/editor2d-model.js +6 -6
- package/lib/browser/model/editor2d-model.js.map +1 -1
- package/lib/browser/model/editor2d-selection.js +4 -2
- package/lib/browser/model/editor2d-selection.js.map +1 -1
- package/lib/browser/model/editor2d-widget.js +8 -6
- package/lib/browser/model/editor2d-widget.js.map +1 -1
- package/lib/browser/model/editor2d.d.ts +1 -0
- package/lib/browser/model/editor2d.d.ts.map +1 -1
- package/lib/browser/model/editor2d.js +13 -7
- package/lib/browser/model/editor2d.js.map +1 -1
- package/lib/browser/model/index.d.ts +1 -0
- package/lib/browser/model/index.d.ts.map +1 -1
- package/lib/browser/model/index.js +7 -2
- package/lib/browser/model/index.js.map +1 -1
- package/lib/browser/model/utils/anim.utils.d.ts +14 -0
- package/lib/browser/model/utils/anim.utils.d.ts.map +1 -0
- package/lib/browser/model/utils/anim.utils.js +51 -0
- package/lib/browser/model/utils/anim.utils.js.map +1 -0
- package/lib/browser/model/utils/index.d.ts +2 -0
- package/lib/browser/model/utils/index.d.ts.map +1 -0
- package/lib/browser/model/utils/index.js +18 -0
- package/lib/browser/model/utils/index.js.map +1 -0
- package/lib/browser/playground/canvas-draw-layer.js +6 -4
- package/lib/browser/playground/canvas-draw-layer.js.map +1 -1
- package/lib/browser/playground/canvas-draw.d.ts +2 -7
- package/lib/browser/playground/canvas-draw.d.ts.map +1 -1
- package/lib/browser/playground/canvas-draw.js +9 -14
- package/lib/browser/playground/canvas-draw.js.map +1 -1
- package/lib/browser/playground/canvas-layer.js +5 -3
- package/lib/browser/playground/canvas-layer.js.map +1 -1
- package/lib/browser/playground/entities/document-entity.js +3 -1
- package/lib/browser/playground/entities/document-entity.js.map +1 -1
- package/lib/browser/playground/entities/editor2d-entity.js +3 -1
- package/lib/browser/playground/entities/editor2d-entity.js.map +1 -1
- package/lib/browser/playground/entities/index.js +6 -2
- package/lib/browser/playground/entities/index.js.map +1 -1
- package/lib/browser/playground/index.js +6 -2
- package/lib/browser/playground/index.js.map +1 -1
- package/lib/browser/playground/playground-context.js +9 -9
- package/lib/browser/playground/playground-context.js.map +1 -1
- package/lib/browser/playground/playground-contribution.d.ts +5 -1
- package/lib/browser/playground/playground-contribution.d.ts.map +1 -1
- package/lib/browser/playground/playground-contribution.js +50 -5
- package/lib/browser/playground/playground-contribution.js.map +1 -1
- package/lib/browser/playground/selection-entity-manager.d.ts.map +1 -1
- package/lib/browser/playground/selection-entity-manager.js +18 -2
- package/lib/browser/playground/selection-entity-manager.js.map +1 -1
- package/lib/browser/utils/snapshot.d.ts +47 -0
- package/lib/browser/utils/snapshot.d.ts.map +1 -0
- package/lib/browser/utils/snapshot.js +219 -0
- package/lib/browser/utils/snapshot.js.map +1 -0
- package/package.json +7 -7
- package/src/browser/editor2d-contribution.ts +2 -2
- package/src/browser/index.ts +1 -0
- package/src/browser/model/editor2d-document.ts +21 -5
- package/src/browser/model/editor2d.ts +1 -0
- package/src/browser/model/index.ts +1 -1
- package/src/browser/model/utils/anim.utils.ts +81 -0
- package/src/browser/model/utils/index.ts +1 -0
- package/src/browser/playground/canvas-draw.ts +3 -16
- package/src/browser/playground/playground-contribution.ts +39 -1
- package/src/browser/playground/selection-entity-manager.tsx +16 -1
- package/src/browser/style/canvas-layer.css +1 -1
- package/src/browser/style/index.less +1 -0
- package/src/browser/utils/snapshot.ts +157 -0
- package/src/.DS_Store +0 -0
- package/src/browser/.DS_Store +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection-entity-manager.js","sourceRoot":"","sources":["../../../src/browser/playground/selection-entity-manager.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAA+B;AAC/B,kCAA0D;AAC1D,8DAA4D;AAE5D,gDAK2B;AAE3B,oCAAwC;AAGxC;;GAEG;AACH;IAEE,gCACY,aAA4B,EAC5B,OAA4B,EAC5B,OAAsB,EACtB,WAA+C,EAC/C,SAAwB;QALpC,iBAwBC;QAvBW,kBAAa,GAAb,aAAa,CAAe;QAC5B,YAAO,GAAP,OAAO,CAAqB;QAC5B,YAAO,GAAP,OAAO,CAAe;QACtB,gBAAW,GAAX,WAAW,CAAoC;QAC/C,cAAS,GAAT,SAAS,CAAe;QAN1B,sBAAiB,GAAgC,IAAI,GAAG,EAAE,CAAC;QAQnE,IAAM,qBAAqB,GAAG,aAAa,CAAC,SAAS,CAAuB,iCAAoB,CAAC,CAAC;QAClG,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,4BAA4B,CAAC,UAAA,KAAK;YACvD,IAAM,QAAQ,gBAAO,KAAK,CAAC,CAAC;YAC5B,IAAM,MAAM,GAAG,QAAQ,CAAC,MAAwB,CAAC;YACjD,IAAI,KAAI,CAAC,OAAO,CAAC,OAAO,CAAC,oBAAoB,EAAE;gBAC7C,QAAQ,CAAC,cAAc,GAAG,cAAM,OAAA,KAAI,CAAC,OAAO,CAAC,OAAO,CAAC,oBAAqB,uBAAM,KAAK,KAAE,OAAO,EAAE,KAAI,CAAC,OAAO,IAAG,EAA/E,CAA+E,CAAC;aACjH;YACD,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI;gBACtB,CAAC,CAAC,KAAI,CAAC,OAAO,CAAC,YAAY,CAAC,uBAAuB,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC;gBACnH,CAAC,CAAC,SAAS,CAAC;YACd,SAAS;YACT,IAAI,IAAI,IAAI,IAAI,CAAC,iBAAiB,EAAE;gBAClC,IAAM,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC;gBACpC,OAAO,oBAAC,IAAI,eAAK,QAAQ,EAAI,CAAC;aAC/B;YACD,OAAO,0CAA6B,
|
|
1
|
+
{"version":3,"file":"selection-entity-manager.js","sourceRoot":"","sources":["../../../src/browser/playground/selection-entity-manager.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAA+B;AAC/B,kCAA0D;AAC1D,8DAA4D;AAE5D,gDAK2B;AAE3B,oCAAwC;AAGxC;;GAEG;AACH;IAEE,gCACY,aAA4B,EAC5B,OAA4B,EAC5B,OAAsB,EACtB,WAA+C,EAC/C,SAAwB;QALpC,iBAwBC;QAvBW,kBAAa,GAAb,aAAa,CAAe;QAC5B,YAAO,GAAP,OAAO,CAAqB;QAC5B,YAAO,GAAP,OAAO,CAAe;QACtB,gBAAW,GAAX,WAAW,CAAoC;QAC/C,cAAS,GAAT,SAAS,CAAe;QAN1B,sBAAiB,GAAgC,IAAI,GAAG,EAAE,CAAC;QAQnE,IAAM,qBAAqB,GAAG,aAAa,CAAC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EAAE,SAAS,CAAC,CAAC,CAAC;;YACtE,KAAqB,IAAA,KAAA,SAAA,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,CAAA,gBAAA,4BAAE;gBAAjD,IAAM,MAAM,WAAA;gBACf,IAAI,MAAM,CAAC,SAAS,EAAE;oBACpB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;iBACrC;aACF;;;;;;;;;QACD,OAAO,gBAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IACD,yCAAQ,GAAR,UAAS,IAA8B;QACrC,IAAI,CAAC,IAAI;YAAE,OAAO,KAAK,CAAC;QACxB,IAAI,IAAI,CAAC,UAAU;YAAE,OAAO,IAAI,CAAC;QACjC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAkC,CAAC,CAAC;IAChE,CAAC;IACD,yCAAQ,GAAR,UAAS,IAA8B;QACrC,IAAI,CAAC,IAAI;YAAE,OAAO,KAAK,CAAC;QACxB,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAC7B,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAkC,CAAC,CAAC;IAChE,CAAC;IACH,6BAAC;AAAD,CAAC,AAtMD,IAsMC;AAtMY,wDAAsB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CanvasDraw, CanvasDrawOpts } from '../playground/canvas-draw';
|
|
2
|
+
import { DisposableImpl, Emitter, PromiseDeferred, SizeSchema } from '@gedit/utils';
|
|
3
|
+
import { Editor2dNode } from '../model';
|
|
4
|
+
import { GameConfig } from '@gedit/render-engine/lib/common';
|
|
5
|
+
export interface SnapshotOpts extends Omit<CanvasDrawOpts, 'host'> {
|
|
6
|
+
imageType?: string;
|
|
7
|
+
quility?: number;
|
|
8
|
+
limitSize?: SizeSchema;
|
|
9
|
+
appConfig: GameConfig | (() => GameConfig);
|
|
10
|
+
engineName: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const SnapshotOptsDefault: {
|
|
13
|
+
quility: number;
|
|
14
|
+
imageType: string;
|
|
15
|
+
};
|
|
16
|
+
export interface Snapshot {
|
|
17
|
+
uri: string;
|
|
18
|
+
name?: string;
|
|
19
|
+
version?: string | number;
|
|
20
|
+
imageData: string;
|
|
21
|
+
}
|
|
22
|
+
export interface SnapshotInput {
|
|
23
|
+
uri: string;
|
|
24
|
+
name?: string;
|
|
25
|
+
version?: string | number;
|
|
26
|
+
content: Editor2dNode;
|
|
27
|
+
}
|
|
28
|
+
export declare function createSnapshots(opts: SnapshotOpts, sceneDatas: SnapshotInput[]): Promise<Snapshot[]>;
|
|
29
|
+
export declare class SnapshotCreator extends DisposableImpl {
|
|
30
|
+
protected readonly opts: SnapshotOpts;
|
|
31
|
+
protected drawer: CanvasDraw;
|
|
32
|
+
protected processing?: PromiseDeferred<void>;
|
|
33
|
+
protected result: {
|
|
34
|
+
[key: string]: Snapshot;
|
|
35
|
+
};
|
|
36
|
+
protected processingData: SnapshotInput[];
|
|
37
|
+
protected onUpdateEmitter: Emitter<void>;
|
|
38
|
+
readonly onUpdate: import("@gedit/utils").Event<void>;
|
|
39
|
+
protected current?: SnapshotInput;
|
|
40
|
+
constructor(opts: SnapshotOpts);
|
|
41
|
+
getSnapshot(uri: string): Snapshot | undefined;
|
|
42
|
+
draw(scenes: SnapshotInput[]): Promise<Snapshot[]>;
|
|
43
|
+
getResult(): Snapshot[];
|
|
44
|
+
protected process(): Promise<void>;
|
|
45
|
+
protected next(end: () => void): void;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../../src/browser/utils/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAoC,cAAc,EAAE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AS,CAAC,cAAc,EAAE,aAAa,EAAE,CAAM;IAC/C,SAAS,CAAC,eAAe,gBAAuB;IAChD,QAAQ,CAAC,QAAQ,qCAA8B;IAC/C,SAAS,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;gBAEb,IAAI,EAAE,YAAY;IAmBvC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAGxC,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAUxD,SAAS,IAAI,QAAQ,EAAE;cAGP,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA2CxC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,IAAI,GAAG,IAAI;CAiBtC"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
28
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
32
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
33
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
34
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
38
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
39
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
40
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
41
|
+
function step(op) {
|
|
42
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
43
|
+
while (_) try {
|
|
44
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
45
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
46
|
+
switch (op[0]) {
|
|
47
|
+
case 0: case 1: t = op; break;
|
|
48
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
49
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
50
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
51
|
+
default:
|
|
52
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
53
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
54
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
55
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
56
|
+
if (t[2]) _.ops.pop();
|
|
57
|
+
_.trys.pop(); continue;
|
|
58
|
+
}
|
|
59
|
+
op = body.call(thisArg, _);
|
|
60
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
61
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
+
exports.SnapshotCreator = exports.createSnapshots = exports.SnapshotOptsDefault = void 0;
|
|
66
|
+
var canvas_draw_1 = require("../playground/canvas-draw");
|
|
67
|
+
var utils_1 = require("@gedit/utils");
|
|
68
|
+
exports.SnapshotOptsDefault = {
|
|
69
|
+
quility: 0.8,
|
|
70
|
+
imageType: 'image/webp',
|
|
71
|
+
};
|
|
72
|
+
function fixDrawerScale(drawer, limitSize) {
|
|
73
|
+
// const appConfig = drawer.getData()?.appConfig;
|
|
74
|
+
// if (!appConfig) return;
|
|
75
|
+
var currentSize = drawer.getSceneSize();
|
|
76
|
+
var scale = utils_1.SizeSchema.fixSize(currentSize, {
|
|
77
|
+
width: limitSize.width,
|
|
78
|
+
height: limitSize.height,
|
|
79
|
+
});
|
|
80
|
+
drawer.refreshScale(false, scale);
|
|
81
|
+
}
|
|
82
|
+
function createSnapshots(opts, sceneDatas) {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
84
|
+
var creator, result;
|
|
85
|
+
return __generator(this, function (_a) {
|
|
86
|
+
switch (_a.label) {
|
|
87
|
+
case 0:
|
|
88
|
+
creator = new SnapshotCreator(opts);
|
|
89
|
+
return [4 /*yield*/, creator.draw(sceneDatas)];
|
|
90
|
+
case 1:
|
|
91
|
+
result = _a.sent();
|
|
92
|
+
creator.dispose();
|
|
93
|
+
return [2 /*return*/, result];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
exports.createSnapshots = createSnapshots;
|
|
99
|
+
var host;
|
|
100
|
+
var SnapshotCreator = /** @class */ (function (_super) {
|
|
101
|
+
__extends(SnapshotCreator, _super);
|
|
102
|
+
function SnapshotCreator(opts) {
|
|
103
|
+
var _this = _super.call(this) || this;
|
|
104
|
+
_this.opts = opts;
|
|
105
|
+
_this.result = {};
|
|
106
|
+
_this.processingData = [];
|
|
107
|
+
_this.onUpdateEmitter = new utils_1.Emitter();
|
|
108
|
+
_this.onUpdate = _this.onUpdateEmitter.event;
|
|
109
|
+
if (!host) {
|
|
110
|
+
host = document.createElement('div');
|
|
111
|
+
host.className = 'gedit-editor-snapshots';
|
|
112
|
+
host.style.display = 'none';
|
|
113
|
+
document.body.appendChild(host);
|
|
114
|
+
}
|
|
115
|
+
_this.drawer = new canvas_draw_1.CanvasDraw(__assign({ host: host }, opts));
|
|
116
|
+
_this.toDispose.pushAll([
|
|
117
|
+
_this.drawer,
|
|
118
|
+
_this.onUpdateEmitter,
|
|
119
|
+
]);
|
|
120
|
+
return _this;
|
|
121
|
+
}
|
|
122
|
+
SnapshotCreator.prototype.getSnapshot = function (uri) {
|
|
123
|
+
return this.result[uri];
|
|
124
|
+
};
|
|
125
|
+
SnapshotCreator.prototype.draw = function (scenes) {
|
|
126
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
127
|
+
var _this = this;
|
|
128
|
+
return __generator(this, function (_a) {
|
|
129
|
+
switch (_a.label) {
|
|
130
|
+
case 0:
|
|
131
|
+
this.processingData = scenes.filter(function (s) {
|
|
132
|
+
var result = _this.result[s.uri];
|
|
133
|
+
if (result && s.version === result.version)
|
|
134
|
+
return false;
|
|
135
|
+
if (_this.current && _this.current.version === s.version)
|
|
136
|
+
return false;
|
|
137
|
+
return true;
|
|
138
|
+
});
|
|
139
|
+
return [4 /*yield*/, this.process()];
|
|
140
|
+
case 1:
|
|
141
|
+
_a.sent();
|
|
142
|
+
return [2 /*return*/, scenes.map(function (s) { return _this.result[s.uri]; })];
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
SnapshotCreator.prototype.getResult = function () {
|
|
148
|
+
var _this = this;
|
|
149
|
+
return Object.keys(this.result).map(function (k) { return _this.result[k]; });
|
|
150
|
+
};
|
|
151
|
+
SnapshotCreator.prototype.process = function () {
|
|
152
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
153
|
+
var deferred, drawer, dispose;
|
|
154
|
+
var _this = this;
|
|
155
|
+
return __generator(this, function (_a) {
|
|
156
|
+
if (this.processing) {
|
|
157
|
+
return [2 /*return*/, this.processing.promise];
|
|
158
|
+
}
|
|
159
|
+
deferred = this.processing = new utils_1.PromiseDeferred();
|
|
160
|
+
drawer = this.drawer;
|
|
161
|
+
dispose = new utils_1.DisposableCollection();
|
|
162
|
+
dispose.push(utils_1.Disposable.create(function () {
|
|
163
|
+
deferred.resolve();
|
|
164
|
+
_this.current = undefined;
|
|
165
|
+
_this.processing = undefined;
|
|
166
|
+
}));
|
|
167
|
+
dispose.push(drawer.onLoading(function (e) {
|
|
168
|
+
var loaded = e.loaded, allCount = e.allCount, currentCount = e.currentCount;
|
|
169
|
+
if (loaded || allCount <= currentCount) {
|
|
170
|
+
var widget = drawer.renderWidget;
|
|
171
|
+
if (_this.opts.limitSize) {
|
|
172
|
+
fixDrawerScale(drawer, _this.opts.limitSize);
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
drawer.refreshScale(false, 1);
|
|
176
|
+
}
|
|
177
|
+
widget.createSnapShot(_this.opts.imageType || exports.SnapshotOptsDefault.imageType, _this.opts.quility || exports.SnapshotOptsDefault.quility).then(function (imageData) {
|
|
178
|
+
var current = _this.current;
|
|
179
|
+
if (current) {
|
|
180
|
+
_this.result[current.uri] = {
|
|
181
|
+
uri: current.uri,
|
|
182
|
+
version: current.version,
|
|
183
|
+
name: current.name,
|
|
184
|
+
imageData: imageData
|
|
185
|
+
};
|
|
186
|
+
_this.onUpdateEmitter.fire();
|
|
187
|
+
}
|
|
188
|
+
_this.next(function () { return dispose.dispose(); });
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}));
|
|
192
|
+
this.next(function () { return dispose.dispose(); });
|
|
193
|
+
return [2 /*return*/, deferred.promise];
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
SnapshotCreator.prototype.next = function (end) {
|
|
198
|
+
var _a, _b;
|
|
199
|
+
var next = this.processingData.shift();
|
|
200
|
+
if (next) {
|
|
201
|
+
this.current = next;
|
|
202
|
+
(_b = (_a = this.drawer.renderWidget) === null || _a === void 0 ? void 0 : _a.currentScene) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
203
|
+
var appConfig = typeof this.opts.appConfig === 'function' ? this.opts.appConfig() : this.opts.appConfig;
|
|
204
|
+
this.drawer.update({
|
|
205
|
+
visible: true,
|
|
206
|
+
uri: next.uri,
|
|
207
|
+
engineName: this.opts.engineName,
|
|
208
|
+
appConfig: appConfig,
|
|
209
|
+
content: next.content,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
end();
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
return SnapshotCreator;
|
|
217
|
+
}(utils_1.DisposableImpl));
|
|
218
|
+
exports.SnapshotCreator = SnapshotCreator;
|
|
219
|
+
//# sourceMappingURL=snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../src/browser/utils/snapshot.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;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,CAAC,OAAO;aACtB,CAAC,CAAC;SACJ;aAAM;YACL,GAAG,EAAE,CAAC;SACP;IACH,CAAC;IACH,sBAAC;AAAD,CAAC,AAxGD,CAAqC,sBAAc,GAwGlD;AAxGY,0CAAe"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gedit/editor-2d",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.97",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/browser/index",
|
|
6
6
|
"typings": "lib/browser/index.d.ts",
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
"src"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@gedit/app-config": "^0.1.
|
|
13
|
-
"@gedit/editor": "^0.1.
|
|
14
|
-
"@gedit/playground": "^0.1.
|
|
15
|
-
"@gedit/render-engine-ide": "^0.1.
|
|
16
|
-
"@gedit/workspace-2d": "^0.1.
|
|
12
|
+
"@gedit/app-config": "^0.1.91",
|
|
13
|
+
"@gedit/editor": "^0.1.73",
|
|
14
|
+
"@gedit/playground": "^0.1.81",
|
|
15
|
+
"@gedit/render-engine-ide": "^0.1.97",
|
|
16
|
+
"@gedit/workspace-2d": "^0.1.77",
|
|
17
17
|
"json-stringify-pretty-compact": "^2.0.0"
|
|
18
18
|
},
|
|
19
19
|
"geditExtensions": [
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"nyc": {
|
|
35
35
|
"extends": "../../configs/nyc.json"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "8d56b93ef685861ffc4702c88352c231f91ee54f"
|
|
38
38
|
}
|
|
@@ -118,12 +118,12 @@ export class Editor2dContribution implements FrontendApplicationContribution, Co
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
registerToolbarItems(toolbars: TabBarToolbarRegistry): void {
|
|
121
|
-
toolbars.registerItem({
|
|
121
|
+
/* toolbars.registerItem({
|
|
122
122
|
id: Editor2dCommands.FULLSCREEN.id,
|
|
123
123
|
command: Editor2dCommands.FULLSCREEN.id,
|
|
124
124
|
tooltip: Editor2dCommands.FULLSCREEN.label,
|
|
125
125
|
priority: 0,
|
|
126
|
-
});
|
|
126
|
+
}); */
|
|
127
127
|
/*
|
|
128
128
|
toolbars.registerItem({
|
|
129
129
|
id: Editor2dCommands.ZOOM_IN.id,
|
package/src/browser/index.ts
CHANGED
|
@@ -23,6 +23,7 @@ import { WorkspaceResourceService } from '@gedit/workspace-2d';
|
|
|
23
23
|
import { ResourceProvider, ResourceRefError } from '@gedit/resource';
|
|
24
24
|
import { AppConfigService } from '@gedit/app-config';
|
|
25
25
|
import { Editor2dIterator } from './editor2d-iterator';
|
|
26
|
+
import { getAnimationKeys, getChangeAnimationData } from './utils';
|
|
26
27
|
|
|
27
28
|
let versionId = 0;
|
|
28
29
|
|
|
@@ -60,7 +61,7 @@ export class Editor2dDocument extends TreeImpl<Editor2dNode, Editor2dContainerNo
|
|
|
60
61
|
super();
|
|
61
62
|
this.toDispose.push(this.onContentChangedEmitter);
|
|
62
63
|
this.toDispose.push(this.onSavedEmitter);
|
|
63
|
-
this.toDispose.push(this.resourceAutoSaveService);
|
|
64
|
+
// this.toDispose.push(this.resourceAutoSaveService);
|
|
64
65
|
this.toDispose.push(this.resourceAutoSaveService.onSyncContent(content => this.reloadContent(content || '')));
|
|
65
66
|
this.toDispose.push(this.onSaved(event => this.resourceAutoSaveService.fireDidChangeContent(event)));
|
|
66
67
|
this.toDispose.push(this.resourceService.onRefsChange(async () => {
|
|
@@ -152,6 +153,7 @@ export class Editor2dDocument extends TreeImpl<Editor2dNode, Editor2dContainerNo
|
|
|
152
153
|
const name = this.getUniqueName((parent.children || []) as Editor2dNode[], nodeData.name!, nodeData.displayType);
|
|
153
154
|
Object.assign(newNode, { name });
|
|
154
155
|
const children = parent.children as TreeNode[];
|
|
156
|
+
if (!children) parent.children = [];
|
|
155
157
|
// 加到当前节点的后边
|
|
156
158
|
children.splice(index, 0, newNode);
|
|
157
159
|
CompositeTreeNode.setParent(newNode, index, parent);
|
|
@@ -573,6 +575,8 @@ export class Editor2dDocument extends TreeImpl<Editor2dNode, Editor2dContainerNo
|
|
|
573
575
|
return this.animationIds.some(id => (id === n.id) || getNodesToChildrenById(n, id));
|
|
574
576
|
});
|
|
575
577
|
if (nodes.length) {
|
|
578
|
+
// TODO: 音乐素材变更
|
|
579
|
+
console.log('document update to timeline', nodes, e.type);
|
|
576
580
|
onNodeChange(nodes, e.type);
|
|
577
581
|
}
|
|
578
582
|
}
|
|
@@ -582,10 +586,22 @@ export class Editor2dDocument extends TreeImpl<Editor2dNode, Editor2dContainerNo
|
|
|
582
586
|
toDispose.dispose();
|
|
583
587
|
// reset node data
|
|
584
588
|
cache.forEach(nodeData => {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
+
const { displayType } = nodeData;
|
|
590
|
+
const currentNode = this.getNodeById(nodeData.id);
|
|
591
|
+
if (!currentNode) {
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
const register = this.engineService.getGameObjectIDERegister(this.engineService.engineName, displayType);
|
|
595
|
+
const {
|
|
596
|
+
timelineDisabledKeys = [],
|
|
597
|
+
} = this.engineService.getGameObjectDecoration(
|
|
598
|
+
this.engineService.engineName,
|
|
599
|
+
displayType,
|
|
600
|
+
);
|
|
601
|
+
const keysList = getAnimationKeys(this.engineService, register, timelineDisabledKeys);
|
|
602
|
+
const changeData: {[key: string]: any} = getChangeAnimationData(keysList, currentNode, nodeData);
|
|
603
|
+
changeData.name = currentNode?.name;
|
|
604
|
+
this.updateNode(nodeData.id, changeData, true);
|
|
589
605
|
});
|
|
590
606
|
// this.animationStarted = false;
|
|
591
607
|
this.animationIds = [];
|
|
@@ -86,6 +86,7 @@ export interface Editor2dContainerNode extends Editor2dNode, ExpandableTreeNode
|
|
|
86
86
|
|
|
87
87
|
export namespace Editor2dNode {
|
|
88
88
|
export const ROOT_NODE_ID = 'root';
|
|
89
|
+
export const GLOBAL_ADD_EVENT = 'global_add_event'; // 全局添加标记事件
|
|
89
90
|
export function createNodeId(): string {
|
|
90
91
|
return generateUuid();
|
|
91
92
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { GameObjectData } from '@gedit/render-engine';
|
|
2
|
+
import { GameObjectIDERegister } from '@gedit/render-engine-ide';
|
|
3
|
+
import { RenderEngineIDEService as RenderEngineService } from '@gedit/render-engine-ide';
|
|
4
|
+
import { SchemaDecoration, SchemaType } from '@gedit/playground';
|
|
5
|
+
import { Editor2dNode } from '../editor2d';
|
|
6
|
+
import { getByKey, setByKey } from '@gedit/utils';
|
|
7
|
+
|
|
8
|
+
interface KeysValue {
|
|
9
|
+
key: string;
|
|
10
|
+
name: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const supportKeys: SchemaType[] = ['integer', 'float', 'color'];
|
|
14
|
+
function readAnimationKeys(
|
|
15
|
+
deco: SchemaDecoration,
|
|
16
|
+
keyList: { key: string; name: string }[],
|
|
17
|
+
currentKey?: string,
|
|
18
|
+
parentName?: string,
|
|
19
|
+
parentKey?: string
|
|
20
|
+
): void {
|
|
21
|
+
const currentLabel =
|
|
22
|
+
parentName && deco.label ? `${parentName}.${deco.label}` : deco.label;
|
|
23
|
+
currentKey =
|
|
24
|
+
parentKey && currentKey ? `${parentKey}.${currentKey}` : currentKey;
|
|
25
|
+
if (deco.properties) {
|
|
26
|
+
Object.keys(deco.properties).forEach((property: string) => {
|
|
27
|
+
readAnimationKeys(
|
|
28
|
+
deco.properties![property] as SchemaDecoration,
|
|
29
|
+
keyList,
|
|
30
|
+
property,
|
|
31
|
+
currentLabel,
|
|
32
|
+
currentKey
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
} else if (
|
|
36
|
+
currentLabel &&
|
|
37
|
+
currentKey &&
|
|
38
|
+
supportKeys.includes(deco.type) &&
|
|
39
|
+
!currentKey.match(/^(origin)/) // 干掉原点
|
|
40
|
+
) {
|
|
41
|
+
keyList.push({
|
|
42
|
+
key: currentKey,
|
|
43
|
+
name: currentLabel.toUpperCase(),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const getAnimationKeys = (
|
|
49
|
+
renderEngineService: RenderEngineService,
|
|
50
|
+
register: GameObjectIDERegister<GameObjectData>,
|
|
51
|
+
timelineDisabledKeys: string[]
|
|
52
|
+
): KeysValue[] => {
|
|
53
|
+
let keyList: { key: string; name: string }[] = [];
|
|
54
|
+
if (register.defaultDataDecoration) {
|
|
55
|
+
const deco =
|
|
56
|
+
typeof register.defaultDataDecoration === 'function'
|
|
57
|
+
? register.defaultDataDecoration(renderEngineService)
|
|
58
|
+
: register.defaultDataDecoration;
|
|
59
|
+
readAnimationKeys(deco, keyList);
|
|
60
|
+
}
|
|
61
|
+
keyList = keyList.filter(
|
|
62
|
+
f => !timelineDisabledKeys.find(c => f.key.indexOf(c) >= 0)
|
|
63
|
+
);
|
|
64
|
+
return keyList;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const getChangeAnimationData = (
|
|
68
|
+
values: KeysValue[],
|
|
69
|
+
nodeData: Editor2dNode,
|
|
70
|
+
newData: Editor2dNode
|
|
71
|
+
): { [key: string]: any } => {
|
|
72
|
+
const data = Editor2dNode.clone(nodeData);
|
|
73
|
+
Object.assign(data, { id: nodeData.id });
|
|
74
|
+
values.forEach(item => {
|
|
75
|
+
const v = getByKey(newData, item.key);
|
|
76
|
+
if (typeof v !== 'undefined') {
|
|
77
|
+
setByKey(data, item.key, v);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return data;
|
|
81
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './anim.utils';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GameConfig, GameObject,
|
|
1
|
+
import { GameConfig, GameObject, GameObjectData, GameObjectError } from '@gedit/render-engine';
|
|
2
2
|
import { Editor2dNode } from '../model/editor2d';
|
|
3
3
|
import { GameSceneIDE, GameWidgetIDE, RenderEngineIDEService } from '@gedit/render-engine-ide';
|
|
4
4
|
import { AppConfigData } from '@gedit/app-config/lib/common';
|
|
@@ -11,11 +11,6 @@ interface GameObjectState {
|
|
|
11
11
|
adsorbable: boolean,
|
|
12
12
|
isInside: boolean
|
|
13
13
|
}
|
|
14
|
-
interface GameSceneSizeConfig {
|
|
15
|
-
width?: number // 场景宽
|
|
16
|
-
height?: number // 场景高
|
|
17
|
-
autoSize?: boolean
|
|
18
|
-
}
|
|
19
14
|
|
|
20
15
|
export interface CanvasDrawOpts {
|
|
21
16
|
host: HTMLElement,
|
|
@@ -87,7 +82,7 @@ function toNodeData(node: Editor2dNode, config: AppConfigData): GameObjectData {
|
|
|
87
82
|
* 画布绘制逻辑
|
|
88
83
|
*/
|
|
89
84
|
export class CanvasDraw extends DisposableImpl {
|
|
90
|
-
protected onDrawEmitter = new Emitter<
|
|
85
|
+
protected onDrawEmitter = new Emitter<GameConfig.SceneSizeConfig>();
|
|
91
86
|
protected onLoadingEmitter = new Emitter<CanvasDrawLoadingState>();
|
|
92
87
|
protected onGameObjectChangeEmitter = new Emitter<GameObjectChangeEvent>();
|
|
93
88
|
protected data?: CanvasDrawData;
|
|
@@ -353,14 +348,7 @@ export class CanvasDraw extends DisposableImpl {
|
|
|
353
348
|
if (!this.data) return undefined;
|
|
354
349
|
const { content, appConfig } = this.data;
|
|
355
350
|
if (!appConfig || !content) return undefined;
|
|
356
|
-
|
|
357
|
-
const sizeConfig = (content as any)[GameObjectBaseType.SCENE] as GameSceneSizeConfig | undefined;
|
|
358
|
-
const config = GameConfig.toAutoSize(appConfig);
|
|
359
|
-
const isAuto = sizeConfig?.autoSize;
|
|
360
|
-
return {
|
|
361
|
-
width: isAuto ? config.width : sizeConfig?.width || config.width,
|
|
362
|
-
height: isAuto ? config.height : sizeConfig?.height || config.height
|
|
363
|
-
};
|
|
351
|
+
return GameConfig.getSceneSize(appConfig, content);
|
|
364
352
|
}
|
|
365
353
|
protected draw(): void {
|
|
366
354
|
if (!this.data) return;
|
|
@@ -395,4 +383,3 @@ export class CanvasDraw extends DisposableImpl {
|
|
|
395
383
|
this.onDrawEmitter.fire(size);
|
|
396
384
|
}
|
|
397
385
|
}
|
|
398
|
-
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { inject, injectable } from 'inversify';
|
|
2
2
|
import {
|
|
3
|
+
EditorStateConfigEntity,
|
|
3
4
|
Playground,
|
|
5
|
+
PlaygroundConfig,
|
|
4
6
|
PlaygroundContribution,
|
|
5
7
|
PlaygroundRegistry,
|
|
6
8
|
RulerConfigEntity,
|
|
@@ -12,13 +14,17 @@ import { CanvasDrawLayer } from './canvas-draw-layer';
|
|
|
12
14
|
// import { SelectionLayer } from './selection-layer';
|
|
13
15
|
import { AppConfigData, AppConfigService } from '@gedit/app-config';
|
|
14
16
|
import { HistoryService } from '@gedit/history';
|
|
15
|
-
import { Editor2dModelOptions } from '../model/editor2d';
|
|
17
|
+
import { Editor2dModelOptions, Editor2dNode } from '../model/editor2d';
|
|
18
|
+
import { ApplicationShell, ContextMenuRenderer } from '@gedit/layout';
|
|
16
19
|
|
|
17
20
|
@injectable()
|
|
18
21
|
export class PlaygroundContribution2d implements PlaygroundContribution {
|
|
19
22
|
@inject(AppConfigService) readonly appConfig: AppConfigService;
|
|
20
23
|
@inject(Editor2dModelOptions) readonly modelOpts: Editor2dModelOptions;
|
|
21
24
|
@inject(HistoryService) readonly historyService: HistoryService;
|
|
25
|
+
@inject(ApplicationShell) readonly appShell: ApplicationShell;
|
|
26
|
+
@inject(PlaygroundConfig) readonly config: PlaygroundConfig;
|
|
27
|
+
@inject(ContextMenuRenderer) readonly menuRender: ContextMenuRenderer;
|
|
22
28
|
registerPlayground(registry: PlaygroundRegistry): void {
|
|
23
29
|
registry.registerLayer(CanvasLayer);
|
|
24
30
|
registry.registerLayer(CanvasDrawLayer);
|
|
@@ -34,6 +40,7 @@ export class PlaygroundContribution2d implements PlaygroundContribution {
|
|
|
34
40
|
// 开启缩放
|
|
35
41
|
playground.zoomEnable = true;
|
|
36
42
|
const rulerEntity = playground.entityManager.getEntity<RulerConfigEntity>(RulerConfigEntity);
|
|
43
|
+
const stateEntity = playground.entityManager.getEntity<EditorStateConfigEntity>(EditorStateConfigEntity);
|
|
37
44
|
// 新版隐藏标尺
|
|
38
45
|
if (rulerEntity) {
|
|
39
46
|
rulerEntity.updateConfig({
|
|
@@ -41,6 +48,37 @@ export class PlaygroundContribution2d implements PlaygroundContribution {
|
|
|
41
48
|
gridVisible: false,
|
|
42
49
|
});
|
|
43
50
|
}
|
|
51
|
+
if (stateEntity) {
|
|
52
|
+
stateEntity.registerState({
|
|
53
|
+
id: 'FULL_SCREEN',
|
|
54
|
+
icon: 'gedit-toolbar-full',
|
|
55
|
+
title: '全屏',
|
|
56
|
+
priority: 6,
|
|
57
|
+
cancelMode: 'once',
|
|
58
|
+
handle: () => {
|
|
59
|
+
this.appShell.toggleMaximized();
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
stateEntity.registerState({
|
|
63
|
+
id: 'ADD_ELEMENT',
|
|
64
|
+
icon: 'gedit-toolbar-add',
|
|
65
|
+
title: '添加',
|
|
66
|
+
shortcut: '',
|
|
67
|
+
showTitle: true,
|
|
68
|
+
priority: 0,
|
|
69
|
+
cancelMode: 'once',
|
|
70
|
+
handle: (_: any, e: any) => {
|
|
71
|
+
const dom = e.event.target as HTMLElement;
|
|
72
|
+
const parentNode = (dom.className.match('gedit-toolbar-item') ? dom : dom.parentNode) as HTMLDivElement;
|
|
73
|
+
const rect = parentNode.getBoundingClientRect();
|
|
74
|
+
this.menuRender.render({
|
|
75
|
+
menuPath: this.config.contextMenuPath!,
|
|
76
|
+
anchor: {x: rect.x + rect.width + 8, y: rect.y},
|
|
77
|
+
args: [Editor2dNode.GLOBAL_ADD_EVENT],
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
44
82
|
// 模板编辑器模式
|
|
45
83
|
if (this.modelOpts.isTemplate) {
|
|
46
84
|
// playground.getConfigEntity<RulerConfigEntity>(RulerConfigEntity).updateConfig({
|