@gedit/editor-2d 0.1.111 → 0.1.115
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 +24 -35
- package/lib/browser/editor2d-context-key-service.js.map +1 -1
- package/lib/browser/editor2d-contribution.js +89 -139
- package/lib/browser/editor2d-contribution.js.map +1 -1
- package/lib/browser/editor2d-frontend-module.js +20 -20
- package/lib/browser/editor2d-frontend-module.js.map +1 -1
- package/lib/browser/editor2d-label-provider.d.ts +0 -1
- package/lib/browser/editor2d-label-provider.d.ts.map +1 -1
- package/lib/browser/editor2d-label-provider.js +37 -58
- package/lib/browser/editor2d-label-provider.js.map +1 -1
- package/lib/browser/editor2d-model-provider.js +61 -127
- package/lib/browser/editor2d-model-provider.js.map +1 -1
- package/lib/browser/editor2d-ref-provider-contribution.js +44 -110
- package/lib/browser/editor2d-ref-provider-contribution.js.map +1 -1
- package/lib/browser/editor2d-service.d.ts +1 -1
- package/lib/browser/editor2d-service.d.ts.map +1 -1
- package/lib/browser/editor2d-service.js +70 -83
- package/lib/browser/editor2d-service.js.map +1 -1
- package/lib/browser/model/editor2d-document.d.ts +2 -2
- package/lib/browser/model/editor2d-document.d.ts.map +1 -1
- package/lib/browser/model/editor2d-document.js +376 -547
- package/lib/browser/model/editor2d-document.js.map +1 -1
- package/lib/browser/model/editor2d-iterator.js +27 -67
- package/lib/browser/model/editor2d-iterator.js.map +1 -1
- package/lib/browser/model/editor2d-model-container.js +10 -21
- package/lib/browser/model/editor2d-model-container.js.map +1 -1
- package/lib/browser/model/editor2d-model.js +77 -92
- package/lib/browser/model/editor2d-model.js.map +1 -1
- package/lib/browser/model/editor2d-selection.js +16 -43
- package/lib/browser/model/editor2d-selection.js.map +1 -1
- package/lib/browser/model/editor2d-widget.js +71 -90
- package/lib/browser/model/editor2d-widget.js.map +1 -1
- package/lib/browser/model/editor2d.js +41 -127
- package/lib/browser/model/editor2d.js.map +1 -1
- package/lib/browser/model/utils/anim.utils.js +14 -14
- package/lib/browser/model/utils/anim.utils.js.map +1 -1
- package/lib/browser/playground/canvas-draw-layer.js +45 -69
- package/lib/browser/playground/canvas-draw-layer.js.map +1 -1
- package/lib/browser/playground/canvas-draw.d.ts +1 -0
- package/lib/browser/playground/canvas-draw.d.ts.map +1 -1
- package/lib/browser/playground/canvas-draw.js +152 -241
- package/lib/browser/playground/canvas-draw.js.map +1 -1
- package/lib/browser/playground/canvas-layer.d.ts.map +1 -1
- package/lib/browser/playground/canvas-layer.js +57 -102
- package/lib/browser/playground/canvas-layer.js.map +1 -1
- package/lib/browser/playground/entities/document-entity.js +8 -28
- package/lib/browser/playground/entities/document-entity.js.map +1 -1
- package/lib/browser/playground/entities/editor2d-entity.js +14 -37
- package/lib/browser/playground/entities/editor2d-entity.js.map +1 -1
- package/lib/browser/playground/playground-context.d.ts +3 -2
- package/lib/browser/playground/playground-context.d.ts.map +1 -1
- package/lib/browser/playground/playground-context.js +56 -55
- package/lib/browser/playground/playground-context.js.map +1 -1
- package/lib/browser/playground/playground-contribution.js +61 -65
- package/lib/browser/playground/playground-contribution.js.map +1 -1
- package/lib/browser/playground/selection-entity-manager.d.ts +1 -0
- package/lib/browser/playground/selection-entity-manager.d.ts.map +1 -1
- package/lib/browser/playground/selection-entity-manager.js +82 -132
- package/lib/browser/playground/selection-entity-manager.js.map +1 -1
- package/lib/browser/playground/selector-extend-icons.js +15 -16
- package/lib/browser/playground/selector-extend-icons.js.map +1 -1
- package/lib/browser/playground/selector-extend-renderer.d.ts +3 -2
- package/lib/browser/playground/selector-extend-renderer.d.ts.map +1 -1
- package/lib/browser/playground/selector-extend-renderer.js +67 -52
- package/lib/browser/playground/selector-extend-renderer.js.map +1 -1
- package/lib/browser/utils/snapshot.js +81 -172
- package/lib/browser/utils/snapshot.js.map +1 -1
- package/package.json +7 -7
- package/src/browser/editor2d-label-provider.ts +1 -15
- package/src/browser/editor2d-service.ts +9 -6
- package/src/browser/model/editor2d-document.ts +19 -12
- package/src/browser/playground/canvas-draw.ts +14 -1
- package/src/browser/playground/canvas-layer.ts +4 -2
- package/src/browser/playground/playground-context.ts +11 -10
- package/src/browser/playground/selection-entity-manager.tsx +9 -3
- package/src/browser/playground/selector-extend-renderer.tsx +43 -10
|
@@ -1,71 +1,9 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
3
|
exports.SnapshotCreator = exports.createSnapshots = exports.SnapshotOptsDefault = void 0;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
4
|
+
const canvas_draw_1 = require("../playground/canvas-draw");
|
|
5
|
+
const utils_1 = require("@gedit/utils");
|
|
6
|
+
const model_1 = require("../model");
|
|
69
7
|
exports.SnapshotOptsDefault = {
|
|
70
8
|
quility: 0.8,
|
|
71
9
|
imageType: 'image/webp',
|
|
@@ -73,163 +11,138 @@ exports.SnapshotOptsDefault = {
|
|
|
73
11
|
function fixDrawerScale(drawer, limitSize) {
|
|
74
12
|
// const appConfig = drawer.getData()?.appConfig;
|
|
75
13
|
// if (!appConfig) return;
|
|
76
|
-
|
|
77
|
-
|
|
14
|
+
const currentSize = drawer.getSceneSize();
|
|
15
|
+
const scale = utils_1.SizeSchema.fixSize(currentSize, {
|
|
78
16
|
width: limitSize.width,
|
|
79
17
|
height: limitSize.height,
|
|
80
18
|
});
|
|
81
19
|
drawer.refreshScale(false, scale);
|
|
82
20
|
}
|
|
83
|
-
function createSnapshots(opts, sceneDatas) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
case 0:
|
|
89
|
-
creator = new SnapshotCreator(opts);
|
|
90
|
-
return [4 /*yield*/, creator.draw(sceneDatas)];
|
|
91
|
-
case 1:
|
|
92
|
-
result = _a.sent();
|
|
93
|
-
creator.dispose();
|
|
94
|
-
return [2 /*return*/, result];
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
});
|
|
21
|
+
async function createSnapshots(opts, sceneDatas) {
|
|
22
|
+
const creator = new SnapshotCreator(opts);
|
|
23
|
+
const result = await creator.draw(sceneDatas);
|
|
24
|
+
creator.dispose();
|
|
25
|
+
return result;
|
|
98
26
|
}
|
|
99
27
|
exports.createSnapshots = createSnapshots;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
_this.onUpdate = _this.onUpdateEmitter.event;
|
|
28
|
+
let host;
|
|
29
|
+
class SnapshotCreator extends utils_1.DisposableImpl {
|
|
30
|
+
constructor(opts) {
|
|
31
|
+
super();
|
|
32
|
+
this.opts = opts;
|
|
33
|
+
this.result = {};
|
|
34
|
+
this.processingData = [];
|
|
35
|
+
this.onUpdateEmitter = new utils_1.Emitter();
|
|
36
|
+
this.onUpdate = this.onUpdateEmitter.event;
|
|
110
37
|
if (!host) {
|
|
111
38
|
host = document.createElement('div');
|
|
112
39
|
host.className = 'gedit-editor-snapshots';
|
|
113
40
|
host.style.display = 'none';
|
|
114
41
|
document.body.appendChild(host);
|
|
115
42
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
43
|
+
this.drawer = new canvas_draw_1.CanvasDraw(Object.assign({ host }, opts));
|
|
44
|
+
this.toDispose.pushAll([
|
|
45
|
+
this.drawer,
|
|
46
|
+
this.onUpdateEmitter,
|
|
120
47
|
]);
|
|
121
|
-
return _this;
|
|
122
48
|
}
|
|
123
49
|
/**
|
|
124
50
|
* 清楚缓存数据
|
|
125
51
|
*/
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
Object.keys(this.result).forEach(function (key) {
|
|
52
|
+
clearResultCache(includeUris) {
|
|
53
|
+
Object.keys(this.result).forEach(key => {
|
|
129
54
|
if (!includeUris.includes(key)) {
|
|
130
|
-
delete
|
|
55
|
+
delete this.result[key];
|
|
131
56
|
}
|
|
132
57
|
});
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
SnapshotCreator.prototype.updateResultCache = function (data) {
|
|
58
|
+
}
|
|
59
|
+
getResultFromCache() {
|
|
60
|
+
return Object.keys(this.result).map(k => this.result[k]);
|
|
61
|
+
}
|
|
62
|
+
updateResultCache(data) {
|
|
139
63
|
this.result[data.uri] = data;
|
|
140
|
-
}
|
|
141
|
-
|
|
64
|
+
}
|
|
65
|
+
getSnapshot(uri) {
|
|
142
66
|
return this.result[uri];
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if (result && s.version === result.version)
|
|
153
|
-
return false;
|
|
154
|
-
if (_this.current && _this.current.version === s.version)
|
|
155
|
-
return false;
|
|
156
|
-
return true;
|
|
157
|
-
});
|
|
158
|
-
return [4 /*yield*/, this.process()];
|
|
159
|
-
case 1:
|
|
160
|
-
_a.sent();
|
|
161
|
-
return [2 /*return*/, scenes.map(function (s) { return _this.result[s.uri]; })];
|
|
162
|
-
}
|
|
163
|
-
});
|
|
67
|
+
}
|
|
68
|
+
async draw(scenes) {
|
|
69
|
+
this.processingData = scenes.filter(s => {
|
|
70
|
+
const result = this.result[s.uri];
|
|
71
|
+
if (result && s.version === result.version)
|
|
72
|
+
return false;
|
|
73
|
+
if (this.current && this.current.version === s.version)
|
|
74
|
+
return false;
|
|
75
|
+
return true;
|
|
164
76
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
77
|
+
await this.process();
|
|
78
|
+
return scenes.map(s => this.result[s.uri]);
|
|
79
|
+
}
|
|
80
|
+
process() {
|
|
168
81
|
if (this.processing) {
|
|
169
82
|
return this.processing.promise;
|
|
170
83
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
dispose.push(utils_1.Disposable.create(
|
|
84
|
+
const deferred = this.processing = new utils_1.PromiseDeferred();
|
|
85
|
+
const { drawer } = this;
|
|
86
|
+
const dispose = new utils_1.DisposableCollection();
|
|
87
|
+
dispose.push(utils_1.Disposable.create(() => {
|
|
175
88
|
deferred.resolve();
|
|
176
|
-
|
|
177
|
-
|
|
89
|
+
this.current = undefined;
|
|
90
|
+
this.processing = undefined;
|
|
178
91
|
}));
|
|
179
|
-
dispose.push(drawer.onLoading(
|
|
180
|
-
|
|
92
|
+
dispose.push(drawer.onLoading(e => {
|
|
93
|
+
const { loaded, allCount, currentCount } = e;
|
|
181
94
|
if (loaded || allCount <= currentCount) {
|
|
182
|
-
|
|
183
|
-
if (
|
|
184
|
-
fixDrawerScale(drawer,
|
|
95
|
+
const widget = drawer.renderWidget;
|
|
96
|
+
if (this.opts.limitSize) {
|
|
97
|
+
fixDrawerScale(drawer, this.opts.limitSize);
|
|
185
98
|
}
|
|
186
99
|
else {
|
|
187
100
|
drawer.refreshScale(false, 1);
|
|
188
101
|
}
|
|
189
|
-
widget.createSnapShot(
|
|
190
|
-
|
|
102
|
+
widget.createSnapShot(this.opts.imageType || exports.SnapshotOptsDefault.imageType, this.opts.quility || exports.SnapshotOptsDefault.quility).then(imageData => {
|
|
103
|
+
const current = this.current;
|
|
191
104
|
if (current) {
|
|
192
|
-
|
|
105
|
+
this.result[current.uri] = {
|
|
193
106
|
uri: current.uri,
|
|
194
107
|
version: current.version,
|
|
195
108
|
name: current.name,
|
|
196
|
-
imageData
|
|
109
|
+
imageData
|
|
197
110
|
};
|
|
198
|
-
|
|
111
|
+
this.onUpdateEmitter.fire();
|
|
199
112
|
}
|
|
200
|
-
|
|
113
|
+
this.next(() => dispose.dispose());
|
|
201
114
|
});
|
|
202
115
|
}
|
|
203
116
|
}));
|
|
204
|
-
this.next(
|
|
117
|
+
this.next(() => dispose.dispose());
|
|
205
118
|
return deferred.promise;
|
|
206
|
-
}
|
|
207
|
-
|
|
119
|
+
}
|
|
120
|
+
next(end) {
|
|
208
121
|
var _a, _b;
|
|
209
|
-
|
|
122
|
+
const next = this.processingData.shift();
|
|
210
123
|
if (next) {
|
|
211
124
|
this.current = next;
|
|
212
125
|
(_b = (_a = this.drawer.renderWidget) === null || _a === void 0 ? void 0 : _a.currentScene) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
213
|
-
|
|
214
|
-
|
|
126
|
+
const appConfig = typeof this.opts.appConfig === 'function' ? this.opts.appConfig() : this.opts.appConfig;
|
|
127
|
+
let content = next.content;
|
|
215
128
|
// Empty
|
|
216
129
|
if (!content || !content.children || Object.keys(content).length === 0) {
|
|
217
130
|
content = model_1.Editor2dNode.createRootNode(new utils_1.URI(next.uri));
|
|
218
|
-
|
|
219
|
-
Object.assign(content,
|
|
131
|
+
const attrs = this.opts.renderEngine.getDisplayDefaultData(this.opts.engineName, content.displayType);
|
|
132
|
+
Object.assign(content, Object.assign({}, attrs));
|
|
220
133
|
}
|
|
221
134
|
this.drawer.update({
|
|
222
135
|
visible: true,
|
|
223
136
|
uri: next.uri,
|
|
224
137
|
engineName: this.opts.engineName,
|
|
225
|
-
appConfig
|
|
226
|
-
content
|
|
138
|
+
appConfig,
|
|
139
|
+
content,
|
|
227
140
|
});
|
|
228
141
|
}
|
|
229
142
|
else {
|
|
230
143
|
end();
|
|
231
144
|
}
|
|
232
|
-
}
|
|
145
|
+
}
|
|
233
146
|
/**
|
|
234
147
|
* 监听变化,并自动刷新缩略图缓存
|
|
235
148
|
* @param model
|
|
@@ -237,18 +150,15 @@ var SnapshotCreator = /** @class */ (function (_super) {
|
|
|
237
150
|
* @param quility 缩略图质量
|
|
238
151
|
* @param delay 延迟生成
|
|
239
152
|
*/
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
if (delay === void 0) { delay = 1000; }
|
|
244
|
-
return model.playground.context.onCanvasDataChanged((0, utils_1.debounce)(function (drawer) {
|
|
245
|
-
var _a = drawer.getData() || {}, content = _a.content, visible = _a.visible;
|
|
153
|
+
listenModelChanged(model, fn, quility = 0.1, delay = 1000) {
|
|
154
|
+
return model.playground.context.onCanvasDataChanged((0, utils_1.debounce)(drawer => {
|
|
155
|
+
const { content, visible } = drawer.getData() || {};
|
|
246
156
|
if (!content || drawer.loading)
|
|
247
157
|
return;
|
|
248
158
|
if (visible) {
|
|
249
|
-
|
|
159
|
+
const widget = drawer.renderWidget;
|
|
250
160
|
if (widget) {
|
|
251
|
-
widget.createSnapShot(
|
|
161
|
+
widget.createSnapShot(this.opts.imageType, quility).then((base64) => {
|
|
252
162
|
if (base64) {
|
|
253
163
|
fn(base64);
|
|
254
164
|
}
|
|
@@ -256,8 +166,7 @@ var SnapshotCreator = /** @class */ (function (_super) {
|
|
|
256
166
|
}
|
|
257
167
|
}
|
|
258
168
|
}, delay));
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
}(utils_1.DisposableImpl));
|
|
169
|
+
}
|
|
170
|
+
}
|
|
262
171
|
exports.SnapshotCreator = SnapshotCreator;
|
|
263
172
|
//# sourceMappingURL=snapshot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../src/browser/utils/snapshot.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../src/browser/utils/snapshot.ts"],"names":[],"mappings":";;;AAAA,2DAAuE;AACvE,wCASsB;AAEtB,oCAAwC;AAW3B,QAAA,mBAAmB,GAAG;IACjC,OAAO,EAAE,GAAG;IACZ,SAAS,EAAE,YAAY;CACxB,CAAC;AAgBF,SAAS,cAAc,CAAC,MAAkB,EAAE,SAAqB;IAC/D,iDAAiD;IACjD,0BAA0B;IAC1B,MAAM,WAAW,GAAG,MAAM,CAAC,YAAY,EAAE,CAAC;IAC1C,MAAM,KAAK,GAAG,kBAAU,CAAC,OAAO,CAAC,WAAY,EAAE;QAC7C,KAAK,EAAE,SAAS,CAAC,KAAK;QACtB,MAAM,EAAE,SAAS,CAAC,MAAM;KACzB,CAAC,CAAC;IACH,MAAM,CAAC,YAAY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
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.110",
|
|
13
|
+
"@gedit/editor": "^0.1.83",
|
|
14
|
+
"@gedit/playground": "^0.1.92",
|
|
15
|
+
"@gedit/render-engine-ide": "^0.1.114",
|
|
16
|
+
"@gedit/workspace-2d": "^0.1.89",
|
|
17
17
|
"json-stringify-pretty-compact": "^2.0.0",
|
|
18
18
|
"nanoid": "^3.3.2"
|
|
19
19
|
},
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"nyc": {
|
|
36
36
|
"extends": "../../configs/nyc.json"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "8bdf36b3a3898da871ec15be92760865fc6a182a"
|
|
39
39
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { inject, injectable
|
|
1
|
+
import { inject, injectable } from 'inversify';
|
|
2
2
|
import {
|
|
3
3
|
DidChangeLabelEvent,
|
|
4
4
|
LabelProvider,
|
|
@@ -22,15 +22,6 @@ export class Editor2dLabelProvider implements LabelProviderContribution {
|
|
|
22
22
|
protected readonly treeLabelProvider: TreeLabelProvider;
|
|
23
23
|
@inject(AppConfigService) protected appConfig: AppConfigService;
|
|
24
24
|
|
|
25
|
-
@postConstruct()
|
|
26
|
-
protected init(): void {
|
|
27
|
-
this.appConfig.onConfigChange(() => {
|
|
28
|
-
this.onDidChangeEmitter.fire({
|
|
29
|
-
affects: (element: object) => !!this.canHandle(element)
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
25
|
canHandle(element: object): number {
|
|
35
26
|
return Editor2dNode.is(element) ?
|
|
36
27
|
this.treeLabelProvider.canHandle(element) + 1 :
|
|
@@ -38,11 +29,6 @@ export class Editor2dLabelProvider implements LabelProviderContribution {
|
|
|
38
29
|
}
|
|
39
30
|
|
|
40
31
|
getIcon(node: Editor2dNode | Editor2dContainerNode): string {
|
|
41
|
-
if (node.tags && node.tags.length > 0) {
|
|
42
|
-
const tagId = node.tags[0].id;
|
|
43
|
-
const tagIcon = this.appConfig.getTagIconClass(tagId);
|
|
44
|
-
if (tagIcon) return tagIcon;
|
|
45
|
-
}
|
|
46
32
|
// TODO 后边需要支持多引擎适配
|
|
47
33
|
const register = this.renderEngineService.getGameObjectIDERegister(this.appConfig.engineName, node.displayType);
|
|
48
34
|
if (register && register.decoration && register.decoration.iconClass) {
|
|
@@ -37,7 +37,7 @@ export class Editor2dService {
|
|
|
37
37
|
getCurrentWidget(): EditorWidget | undefined {
|
|
38
38
|
return this.editorManager.currentEditor;
|
|
39
39
|
}
|
|
40
|
-
selectNode(
|
|
40
|
+
selectNode(...nodeIds: string[]): void {
|
|
41
41
|
const model = this.getCurrentModel();
|
|
42
42
|
if (!model) return;
|
|
43
43
|
const { selection } = model;
|
|
@@ -47,11 +47,14 @@ export class Editor2dService {
|
|
|
47
47
|
type: SelectionType.TOGGLE,
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
const nodes = nodeIds.map(c => model.document.getNodeById(c)).filter(c => c);
|
|
51
|
+
|
|
52
|
+
if (nodes.length) {
|
|
53
|
+
nodes.forEach((node: any) => {
|
|
54
|
+
selection.addSelection({
|
|
55
|
+
node,
|
|
56
|
+
type: SelectionType.TOGGLE,
|
|
57
|
+
});
|
|
55
58
|
});
|
|
56
59
|
}
|
|
57
60
|
}
|
|
@@ -72,9 +72,10 @@ export class Editor2dDocument extends TreeImpl<Editor2dNode, Editor2dContainerNo
|
|
|
72
72
|
// this.toDispose.push(this.resourceAutoSaveService);
|
|
73
73
|
this.toDispose.push(this.resourceAutoSaveService.onSyncContent(content => this.reloadContent(content || '')));
|
|
74
74
|
this.toDispose.push(this.onSaved(event => this.resourceAutoSaveService.fireDidChangeContent(event)));
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
// TODO
|
|
76
|
+
// this.toDispose.push(this.resourceService.onRefsChange(async () => {
|
|
77
|
+
// await this.loadRefInfos();
|
|
78
|
+
// }));
|
|
78
79
|
// 同步数据
|
|
79
80
|
this.resourceAutoSaveService.sync();
|
|
80
81
|
}
|
|
@@ -126,8 +127,7 @@ export class Editor2dDocument extends TreeImpl<Editor2dNode, Editor2dContainerNo
|
|
|
126
127
|
}
|
|
127
128
|
const name = this.getUniqueName(
|
|
128
129
|
parentNode.children || [],
|
|
129
|
-
data?.name || this.engineService.getGameObjectIDERegister(this.engineName, displayType).decoration.name
|
|
130
|
-
displayType);
|
|
130
|
+
data?.name || this.engineService.getGameObjectIDERegister(this.engineName, displayType).decoration.name);
|
|
131
131
|
const node = Editor2dNode.createNode({...attrs, ...data, name}, displayType, undefined, Object.keys(this.nodes));
|
|
132
132
|
this.addChildren(node, parentNode, index === undefined ? 0 : index);
|
|
133
133
|
return node as E;
|
|
@@ -163,7 +163,7 @@ export class Editor2dDocument extends TreeImpl<Editor2dNode, Editor2dContainerNo
|
|
|
163
163
|
index = 0;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
const name = this.getUniqueName((parent.children || []) as Editor2dNode[], nodeData.name
|
|
166
|
+
const name = this.getUniqueName((parent.children || []) as Editor2dNode[], nodeData.name!);
|
|
167
167
|
Object.assign(newNode, { name });
|
|
168
168
|
let children = parent.children as TreeNode[];
|
|
169
169
|
if (!children) {
|
|
@@ -250,13 +250,20 @@ export class Editor2dDocument extends TreeImpl<Editor2dNode, Editor2dContainerNo
|
|
|
250
250
|
/**
|
|
251
251
|
* 检测节点名字,保证唯一
|
|
252
252
|
* @param siblings
|
|
253
|
-
* @param
|
|
253
|
+
* @param name
|
|
254
254
|
* @protected
|
|
255
255
|
*/
|
|
256
|
-
protected getUniqueName(siblings: Editor2dNode[],
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
if (
|
|
256
|
+
protected getUniqueName(siblings: Editor2dNode[], name: string, i: number = 0): string {
|
|
257
|
+
const numMatched = name.match(/[0-9]+$/);
|
|
258
|
+
let newName = i ? `${name}${i}` : name;
|
|
259
|
+
if (numMatched) {
|
|
260
|
+
newName = name.slice(0, numMatched.index) + (parseInt(numMatched[0]) + i);
|
|
261
|
+
}
|
|
262
|
+
if (siblings.some(n => n.name === newName)) {
|
|
263
|
+
return this.getUniqueName(siblings, name, i + 1);
|
|
264
|
+
}
|
|
265
|
+
return newName;
|
|
266
|
+
/* if (sameNameCount >= 1) {
|
|
260
267
|
const numMatched = name.match(/[0-9]+$/);
|
|
261
268
|
if (numMatched) {
|
|
262
269
|
name = name.slice(0, numMatched.index) + (parseInt(numMatched[0]) + sameNameCount);
|
|
@@ -266,7 +273,7 @@ export class Editor2dDocument extends TreeImpl<Editor2dNode, Editor2dContainerNo
|
|
|
266
273
|
}
|
|
267
274
|
return this.getUniqueName(siblings, name, displayType);
|
|
268
275
|
}
|
|
269
|
-
return name;
|
|
276
|
+
return name; */
|
|
270
277
|
}
|
|
271
278
|
getSiblings(treeNode: Editor2dNode): Editor2dNode[] {
|
|
272
279
|
if (treeNode.parent) {
|
|
@@ -46,6 +46,7 @@ export interface CanvasDrawLoadingState {
|
|
|
46
46
|
allCount: number,
|
|
47
47
|
currentCount: number,
|
|
48
48
|
loaded: boolean,
|
|
49
|
+
reload?: boolean, // 重新加载
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
function replaceSymbolKey(originData: GameObjectData, config: AppConfigData, obj?: any, path?: string): GameObjectData {
|
|
@@ -110,6 +111,7 @@ export class CanvasDraw extends DisposableImpl {
|
|
|
110
111
|
this.toDispose.pushAll([
|
|
111
112
|
this.onDrawEmitter,
|
|
112
113
|
this.onLoadingEmitter,
|
|
114
|
+
this.onGameObjectChangeEmitter,
|
|
113
115
|
]);
|
|
114
116
|
}
|
|
115
117
|
protected async startLoadLibs(): Promise<void> {
|
|
@@ -162,6 +164,13 @@ export class CanvasDraw extends DisposableImpl {
|
|
|
162
164
|
this.opts.host.removeChild(element);
|
|
163
165
|
this.renderWidget = undefined;
|
|
164
166
|
this.booted = false;
|
|
167
|
+
this.loading = true;
|
|
168
|
+
this.onLoadingEmitter.fire({
|
|
169
|
+
loaded: false,
|
|
170
|
+
allCount: this.allCount,
|
|
171
|
+
currentCount: 0,
|
|
172
|
+
reload: true,
|
|
173
|
+
});
|
|
165
174
|
}));
|
|
166
175
|
this.renderWidgetDispose = this.toDispose.push(this.renderWidget);
|
|
167
176
|
this.renderWidget.start().then(() => {
|
|
@@ -307,7 +316,11 @@ export class CanvasDraw extends DisposableImpl {
|
|
|
307
316
|
}
|
|
308
317
|
};
|
|
309
318
|
if (!firstCreate && gameObject.created) {
|
|
310
|
-
|
|
319
|
+
try {
|
|
320
|
+
update();
|
|
321
|
+
} catch (e) {
|
|
322
|
+
console.error(e);
|
|
323
|
+
}
|
|
311
324
|
}
|
|
312
325
|
renderKeys.push(nodePath);
|
|
313
326
|
depth++;
|
|
@@ -77,14 +77,16 @@ export class CanvasLayer extends Layer<PlaygroundContext2d> {
|
|
|
77
77
|
* 加载完成
|
|
78
78
|
*/
|
|
79
79
|
updateLoading(loadingState: CanvasDrawLoadingState): void {
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
const {loaded, allCount, currentCount, reload } = loadingState;
|
|
81
|
+
if (!this.config.loading && !reload) return;
|
|
82
82
|
if (loaded || allCount <= currentCount || allCount === 0) {
|
|
83
83
|
this.config.loading = false;
|
|
84
84
|
this.tryToResizeToCenter();
|
|
85
85
|
this.node.classList.add('ready');
|
|
86
86
|
this.loaded();
|
|
87
87
|
} else {
|
|
88
|
+
this.config.loading = true;
|
|
89
|
+
this.node.classList.remove('ready');
|
|
88
90
|
this.config.updateConfig({
|
|
89
91
|
loadingHTML: `${Math.round(currentCount / allCount * 100)}%`
|
|
90
92
|
});
|
|
@@ -5,14 +5,15 @@ import { AppConfigService } from '@gedit/app-config';
|
|
|
5
5
|
import { debounce, Emitter, URI } from '@gedit/utils';
|
|
6
6
|
import { Editor2dEntity } from './entities/editor2d-entity';
|
|
7
7
|
import type { SelectionEntityManager } from './selection-entity-manager';
|
|
8
|
-
import { Playground
|
|
8
|
+
import { Playground } from '@gedit/playground';
|
|
9
9
|
import { Editor2dDocument } from '../model/editor2d-document';
|
|
10
10
|
import { Editor2dSelection } from '../model/editor2d-selection';
|
|
11
11
|
import { Editor2dModelOptions, Editor2dNode } from '../model/editor2d';
|
|
12
12
|
import { SelectionService } from '@gedit/application-common';
|
|
13
13
|
import { Editor2dContextKeyService } from '../editor2d-context-key-service';
|
|
14
|
-
import SelectionType = TreeSelection.SelectionType;
|
|
15
14
|
import type { CanvasDraw } from './canvas-draw';
|
|
15
|
+
import SelectionType = TreeSelection.SelectionType;
|
|
16
|
+
import { FormService } from '@gedit/ui';
|
|
16
17
|
|
|
17
18
|
export const Editor2dPlayGround = Symbol('Editor2dPlayGround');
|
|
18
19
|
|
|
@@ -32,6 +33,7 @@ export class PlaygroundContext2d {
|
|
|
32
33
|
@inject(SelectionService) readonly selectionService: SelectionService,
|
|
33
34
|
@inject(AppConfigService) readonly appConfig: AppConfigService,
|
|
34
35
|
@inject(Editor2dModelOptions) readonly options: Editor2dModelOptions,
|
|
36
|
+
@inject(FormService) readonly formService: FormService,
|
|
35
37
|
@inject(Editor2dContextKeyService) readonly contextKeyService: Editor2dContextKeyService
|
|
36
38
|
) {
|
|
37
39
|
this.document.toDispose.push(this.onCanvasDataChangedEmitter);
|
|
@@ -66,14 +68,13 @@ export class PlaygroundContext2d {
|
|
|
66
68
|
});
|
|
67
69
|
}, 0);
|
|
68
70
|
|
|
69
|
-
syncToSelectionService(entities: SelectionEntityManager): void {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
// syncToSelectionService(entities: SelectionEntityManager): void {
|
|
72
|
+
// const selectedEntities: Editor2dEntity[] = entities.getSelectedEntities();
|
|
73
|
+
// Selectable.globalAfter(selectedEntities, {
|
|
74
|
+
// selectionService: this.selectionService,
|
|
75
|
+
// });
|
|
76
|
+
// }
|
|
77
|
+
//
|
|
77
78
|
protected expandedNode(node: Editor2dNode): void {
|
|
78
79
|
let parent = node.parent;
|
|
79
80
|
while (parent) {
|