@gedit/editor-2d 0.1.114 → 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.js +66 -85
- package/lib/browser/editor2d-service.js.map +1 -1
- package/lib/browser/model/editor2d-document.d.ts +1 -1
- package/lib/browser/model/editor2d-document.d.ts.map +1 -1
- package/lib/browser/model/editor2d-document.js +358 -526
- 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.js +142 -244
- package/lib/browser/playground/canvas-draw.js.map +1 -1
- package/lib/browser/playground/canvas-layer.js +54 -101
- 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 -1
- package/lib/browser/playground/playground-context.d.ts.map +1 -1
- package/lib/browser/playground/playground-context.js +49 -47
- 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.js +74 -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/model/editor2d-document.ts +6 -2
- package/src/browser/playground/playground-context.ts +2 -0
- package/src/browser/playground/selector-extend-renderer.tsx +43 -10
|
@@ -1,19 +1,4 @@
|
|
|
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
2
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -23,57 +8,42 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
23
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
10
|
};
|
|
26
|
-
var __values = (this && this.__values) || function(o) {
|
|
27
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
28
|
-
if (m) return m.call(o);
|
|
29
|
-
if (o && typeof o.length === "number") return {
|
|
30
|
-
next: function () {
|
|
31
|
-
if (o && i >= o.length) o = void 0;
|
|
32
|
-
return { value: o && o[i++], done: !o };
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
36
|
-
};
|
|
37
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
12
|
exports.CanvasLayer = void 0;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
_this.node = browser_1.domUtils.createDivWithClass('gedit-canvas-layer');
|
|
50
|
-
return _this;
|
|
13
|
+
const playground_1 = require("@gedit/playground");
|
|
14
|
+
const entities_1 = require("./entities");
|
|
15
|
+
const browser_1 = require("@gedit/utils/lib/browser");
|
|
16
|
+
const math_1 = require("@gedit/math");
|
|
17
|
+
const selection_entity_manager_1 = require("./selection-entity-manager");
|
|
18
|
+
const canvas_draw_1 = require("./canvas-draw");
|
|
19
|
+
class CanvasLayer extends playground_1.Layer {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.node = browser_1.domUtils.createDivWithClass('gedit-canvas-layer');
|
|
51
23
|
}
|
|
52
|
-
|
|
53
|
-
var
|
|
54
|
-
this.selectionEntityManager = new selection_entity_manager_1.SelectionEntityManager(this.entityManager, this.context, function () { var _a; return !!((_a = _this.canvasDrawer) === null || _a === void 0 ? void 0 : _a.loading); }, function () { return _this.document; }, function () { var _a; return !!((_a = _this.documentEntity.config) === null || _a === void 0 ? void 0 : _a.visible); });
|
|
24
|
+
onReady() {
|
|
25
|
+
this.selectionEntityManager = new selection_entity_manager_1.SelectionEntityManager(this.entityManager, this.context, () => { var _a; return !!((_a = this.canvasDrawer) === null || _a === void 0 ? void 0 : _a.loading); }, () => this.document, () => { var _a; return !!((_a = this.documentEntity.config) === null || _a === void 0 ? void 0 : _a.visible); });
|
|
55
26
|
this.canvasDrawer = new canvas_draw_1.CanvasDraw({
|
|
56
27
|
host: this.node,
|
|
57
28
|
renderEngine: this.context.renderEngine,
|
|
58
29
|
assetsURI: this.getAssetsURI(),
|
|
59
|
-
getComponentContent:
|
|
30
|
+
getComponentContent: (compId, parentNode) => { var _a; return (_a = this.document) === null || _a === void 0 ? void 0 : _a.getComponentContent(compId, parentNode); },
|
|
60
31
|
isTemplate: this.context.options.isTemplate,
|
|
61
32
|
});
|
|
62
33
|
this.toDispose.pushAll([
|
|
63
34
|
this.canvasDrawer,
|
|
64
35
|
this.canvasDrawer.onGameObjectChange(this.onGameObjectChange.bind(this)),
|
|
65
36
|
this.canvasDrawer.onLoading(this.updateLoading.bind(this)),
|
|
66
|
-
this.listenPlaygroundEvent('mousedown',
|
|
67
|
-
|
|
37
|
+
this.listenPlaygroundEvent('mousedown', () => {
|
|
38
|
+
this.context.syncToSelectionTree(this.selectionEntityManager);
|
|
68
39
|
}, -2),
|
|
69
40
|
]);
|
|
70
41
|
// this.entityManager.getEntity<RulerConfigEntity>(RulerConfigEntity)?.customizeOriginClick(this.config.scrollPageBoundsToCenter.bind(this));
|
|
71
42
|
this.config.loading = true;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
var _this = this;
|
|
43
|
+
}
|
|
44
|
+
onGameObjectChange(e) {
|
|
75
45
|
var _a, _b;
|
|
76
|
-
|
|
46
|
+
const { gameObject, state } = e;
|
|
77
47
|
switch (e.type) {
|
|
78
48
|
case canvas_draw_1.GameObjectEventType.CREATE:
|
|
79
49
|
(_a = this.document) === null || _a === void 0 ? void 0 : _a.updateNode(e.node, { error: undefined });
|
|
@@ -85,8 +55,8 @@ var CanvasLayer = /** @class */ (function (_super) {
|
|
|
85
55
|
case canvas_draw_1.GameObjectEventType.UPDATE:
|
|
86
56
|
this.selectionEntityManager.updateEntity(gameObject.id, gameObject);
|
|
87
57
|
// TODO 父节点更新则通知子节点更新, 用于刷新transform
|
|
88
|
-
gameObject.children.forEach(
|
|
89
|
-
|
|
58
|
+
gameObject.children.forEach(c => {
|
|
59
|
+
this.selectionEntityManager.updateEntity(c.id, c);
|
|
90
60
|
});
|
|
91
61
|
break;
|
|
92
62
|
case canvas_draw_1.GameObjectEventType.ERROR:
|
|
@@ -94,23 +64,19 @@ var CanvasLayer = /** @class */ (function (_super) {
|
|
|
94
64
|
break;
|
|
95
65
|
}
|
|
96
66
|
this.context.onCanvasDataChangedEmitter.fire(this.canvasDrawer);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
67
|
+
}
|
|
68
|
+
getAssetsURI() {
|
|
69
|
+
const uri = this.context.getResourceURI();
|
|
100
70
|
return uri.parent.parent.resolve('assets').toString();
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
enumerable: false,
|
|
107
|
-
configurable: true
|
|
108
|
-
});
|
|
71
|
+
}
|
|
72
|
+
get document() {
|
|
73
|
+
return this.documentEntity.config.document;
|
|
74
|
+
}
|
|
109
75
|
/**
|
|
110
76
|
* 加载完成
|
|
111
77
|
*/
|
|
112
|
-
|
|
113
|
-
|
|
78
|
+
updateLoading(loadingState) {
|
|
79
|
+
const { loaded, allCount, currentCount, reload } = loadingState;
|
|
114
80
|
if (!this.config.loading && !reload)
|
|
115
81
|
return;
|
|
116
82
|
if (loaded || allCount <= currentCount || allCount === 0) {
|
|
@@ -123,59 +89,47 @@ var CanvasLayer = /** @class */ (function (_super) {
|
|
|
123
89
|
this.config.loading = true;
|
|
124
90
|
this.node.classList.remove('ready');
|
|
125
91
|
this.config.updateConfig({
|
|
126
|
-
loadingHTML:
|
|
92
|
+
loadingHTML: `${Math.round(currentCount / allCount * 100)}%`
|
|
127
93
|
});
|
|
128
94
|
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
var e_1, _a;
|
|
95
|
+
}
|
|
96
|
+
loaded() {
|
|
132
97
|
// TODO 目前只有模板编辑器需要触发
|
|
133
98
|
if (!this.canvasDrawer || this.config.loading || !this.context.options.isTemplate)
|
|
134
99
|
return;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (item.onSceneCreated) {
|
|
139
|
-
item.onSceneCreated();
|
|
140
|
-
}
|
|
100
|
+
for (const item of this.canvasDrawer.gameObjectCache.values()) {
|
|
101
|
+
if (item.onSceneCreated) {
|
|
102
|
+
item.onSceneCreated();
|
|
141
103
|
}
|
|
142
104
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
try {
|
|
146
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
147
|
-
}
|
|
148
|
-
finally { if (e_1) throw e_1.error; }
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
CanvasLayer.prototype.onZoom = function () {
|
|
105
|
+
}
|
|
106
|
+
onZoom() {
|
|
152
107
|
var _a;
|
|
153
|
-
|
|
108
|
+
const config = this.config.config;
|
|
154
109
|
(_a = this.canvasDrawer) === null || _a === void 0 ? void 0 : _a.refreshScale(true, config.zoom);
|
|
155
|
-
}
|
|
110
|
+
}
|
|
156
111
|
// private currentResolution = 1;
|
|
157
|
-
|
|
158
|
-
var _this = this;
|
|
112
|
+
tryToResizeToCenter() {
|
|
159
113
|
var _a;
|
|
160
|
-
|
|
114
|
+
const { visible } = this.documentEntity.config;
|
|
161
115
|
// const resolution = appConfig?.resolution || 1;
|
|
162
|
-
|
|
116
|
+
const size = (_a = this.canvasDrawer) === null || _a === void 0 ? void 0 : _a.getSceneSize();
|
|
163
117
|
if (!visible || !size || this.config.loading || this.config.config.width === 0 || this.config.config.height === 0)
|
|
164
118
|
return;
|
|
165
|
-
|
|
119
|
+
const newRect = new math_1.Rectangle(0, 0, size.width, size.height);
|
|
166
120
|
if (!this.currentRectangle || !this.currentRectangle.isEqual(newRect)) {
|
|
167
121
|
this.currentRectangle = newRect;
|
|
168
122
|
// this.currentResolution = resolution;
|
|
169
123
|
// this.config.updateConfig({resolution});
|
|
170
124
|
this.config.setPageBounds(newRect);
|
|
171
125
|
this.config.scrollPageBoundsToCenter(true, 16, !this.context.options.isTemplate)
|
|
172
|
-
.then(
|
|
126
|
+
.then(() => this.onZoom());
|
|
173
127
|
}
|
|
174
|
-
}
|
|
175
|
-
|
|
128
|
+
}
|
|
129
|
+
draw() {
|
|
176
130
|
var _a, _b;
|
|
177
|
-
|
|
178
|
-
|
|
131
|
+
const config = this.documentEntity.config;
|
|
132
|
+
const document = config.document;
|
|
179
133
|
(_a = this.canvasDrawer) === null || _a === void 0 ? void 0 : _a.update({
|
|
180
134
|
visible: !!config.visible,
|
|
181
135
|
content: document === null || document === void 0 ? void 0 : document.root,
|
|
@@ -193,12 +147,11 @@ var CanvasLayer = /** @class */ (function (_super) {
|
|
|
193
147
|
*/
|
|
194
148
|
this.selectionEntityManager.scrollToSelectedNodes();
|
|
195
149
|
document === null || document === void 0 ? void 0 : document.reloadEnd();
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}(playground_1.Layer));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
__decorate([
|
|
153
|
+
(0, playground_1.entity)(entities_1.DocumentEntity),
|
|
154
|
+
__metadata("design:type", entities_1.DocumentEntity)
|
|
155
|
+
], CanvasLayer.prototype, "documentEntity", void 0);
|
|
203
156
|
exports.CanvasLayer = CanvasLayer;
|
|
204
157
|
//# sourceMappingURL=canvas-layer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-layer.js","sourceRoot":"","sources":["../../../src/browser/playground/canvas-layer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"canvas-layer.js","sourceRoot":"","sources":["../../../src/browser/playground/canvas-layer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAkD;AAClD,yCAA4C;AAC5C,sDAAoD;AAGpD,sCAAwC;AACxC,yEAAoE;AACpE,+CAA+G;AAE/G,MAAa,WAAY,SAAQ,kBAA0B;IAA3D;;QAEE,SAAI,GAAG,kBAAQ,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;IAwI3D,CAAC;IApIC,OAAO;QACL,IAAI,CAAC,sBAAsB,GAAG,IAAI,iDAAsB,CACtD,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,OAAO,EACZ,GAAG,EAAE,WAAC,OAAA,CAAC,CAAC,CAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,OAAO,CAA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,MAAM,EAAE,CAAC,CAAC;SAC9B;IACH,CAAC;IACD,IAAI;;QACF,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC;QAC1C,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QACjC,MAAA,IAAI,CAAC,YAAY,0CAAE,MAAM,CAAC;YACxB,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO;YACzB,OAAO,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI;YACvB,UAAU,EAAE,CAAA,MAAA,MAAM,CAAC,SAAS,0CAAE,MAAM,KAAI,EAAE;YAC1C,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,GAAG,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,GAAG;SACnB,CAAC,CAAC;QACH;;WAEG;QACH,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC3B;;WAEG;QACH,IAAI,CAAC,sBAAsB,CAAC,qBAAqB,EAAE,CAAC;QACpD,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,SAAS,EAAE,CAAC;IACxB,CAAC;CACF;AAzIyB;IAAvB,IAAA,mBAAM,EAAC,yBAAc,CAAC;8BAAiB,yBAAc;mDAAC;AADzD,kCA0IC"}
|
|
@@ -1,33 +1,14 @@
|
|
|
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.DocumentEntity = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function DocumentEntity() {
|
|
23
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
-
}
|
|
25
|
-
DocumentEntity.prototype.getDefaultConfig = function () {
|
|
4
|
+
const playground_1 = require("@gedit/playground");
|
|
5
|
+
class DocumentEntity extends playground_1.ConfigEntity {
|
|
6
|
+
getDefaultConfig() {
|
|
26
7
|
return {
|
|
27
8
|
selectedNodes: [],
|
|
28
9
|
visible: false
|
|
29
10
|
};
|
|
30
|
-
}
|
|
11
|
+
}
|
|
31
12
|
/*
|
|
32
13
|
/!**
|
|
33
14
|
* 会触发CanvasLayer刷新
|
|
@@ -42,16 +23,15 @@ var DocumentEntity = /** @class */ (function (_super) {
|
|
|
42
23
|
return false;
|
|
43
24
|
}
|
|
44
25
|
*/
|
|
45
|
-
|
|
26
|
+
toJSON() {
|
|
46
27
|
return {
|
|
47
28
|
type: this.type,
|
|
48
29
|
id: this.id,
|
|
49
30
|
ableList: this.ables.toJSON(),
|
|
50
31
|
dataList: []
|
|
51
32
|
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return DocumentEntity;
|
|
55
|
-
}(playground_1.ConfigEntity));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
56
35
|
exports.DocumentEntity = DocumentEntity;
|
|
36
|
+
DocumentEntity.type = 'Editor2dDocumentConfigEntity';
|
|
57
37
|
//# sourceMappingURL=document-entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-entity.js","sourceRoot":"","sources":["../../../../src/browser/playground/entities/document-entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"document-entity.js","sourceRoot":"","sources":["../../../../src/browser/playground/entities/document-entity.ts"],"names":[],"mappings":";;;AAAA,kDAA6D;AAc7D,MAAa,cAAe,SAAQ,yBAA0B;IAG5D,gBAAgB;QACd,OAAO;YACL,aAAa,EAAE,EAAE;YACjB,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;IACD;;;;;;;;;;;;;IAaA;IAEA,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;YAC7B,QAAQ,EAAE,EAAE;SACb,CAAC;IACJ,CAAC;;AA/BH,wCAgCC;AA/BQ,mBAAI,GAAG,8BAA8B,CAAC"}
|
|
@@ -1,56 +1,33 @@
|
|
|
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.Editor2dEntity = void 0;
|
|
19
|
-
|
|
4
|
+
const browser_1 = require("@gedit/playground/lib/browser");
|
|
20
5
|
// import { Compare } from '@gedit/utils';
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
6
|
+
class Editor2dEntity extends browser_1.SelectableEntity {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.selectableInit = false;
|
|
10
|
+
this.adsorbableInit = false;
|
|
11
|
+
this.ignoreTransformChanged = true;
|
|
12
|
+
}
|
|
13
|
+
get node() {
|
|
14
|
+
return this.document.getNode(this.nodeId);
|
|
29
15
|
}
|
|
30
|
-
Object.defineProperty(Editor2dEntity.prototype, "node", {
|
|
31
|
-
get: function () {
|
|
32
|
-
return this.document.getNode(this.nodeId);
|
|
33
|
-
},
|
|
34
|
-
enumerable: false,
|
|
35
|
-
configurable: true
|
|
36
|
-
});
|
|
37
16
|
// private data?: GameObjectSelectionData;
|
|
38
|
-
|
|
17
|
+
update(data) {
|
|
39
18
|
if (data) {
|
|
40
19
|
this.transform.update(data);
|
|
41
20
|
// this.data = data;
|
|
42
21
|
// this.transform.fireChanged();
|
|
43
22
|
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return Editor2dEntity;
|
|
47
|
-
}(browser_1.SelectableEntity));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
48
25
|
exports.Editor2dEntity = Editor2dEntity;
|
|
26
|
+
Editor2dEntity.type = 'Editor2dEntity';
|
|
49
27
|
(function (Editor2dEntity) {
|
|
50
28
|
function is(e) {
|
|
51
29
|
return e && e instanceof Editor2dEntity;
|
|
52
30
|
}
|
|
53
31
|
Editor2dEntity.is = is;
|
|
54
32
|
})(Editor2dEntity = exports.Editor2dEntity || (exports.Editor2dEntity = {}));
|
|
55
|
-
exports.Editor2dEntity = Editor2dEntity;
|
|
56
33
|
//# sourceMappingURL=editor2d-entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor2d-entity.js","sourceRoot":"","sources":["../../../../src/browser/playground/entities/editor2d-entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"editor2d-entity.js","sourceRoot":"","sources":["../../../../src/browser/playground/entities/editor2d-entity.ts"],"names":[],"mappings":";;;AAAA,2DAAiE;AAMjE,0CAA0C;AAE1C,MAAa,cAAe,SAAQ,0BAAgB;IAApD;;QAEE,mBAAc,GAAG,KAAK,CAAC;QACvB,mBAAc,GAAG,KAAK,CAAC;QAIvB,2BAAsB,GAAG,IAAI,CAAC;IAahC,CAAC;IAXC,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAE,CAAC;IAC7C,CAAC;IACD,0CAA0C;IAC1C,MAAM,CAAC,IAAyC;QAC9C,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC5B,oBAAoB;YACpB,gCAAgC;SACjC;IACH,CAAC;;AAnBH,wCAoBC;AAnBQ,mBAAI,GAAG,gBAAgB,CAAC;AAqBjC,WAAiB,cAAc;IAC7B,SAAgB,EAAE,CAAC,CAAM;QACvB,OAAO,CAAC,IAAI,CAAC,YAAY,cAAc,CAAC;IAC1C,CAAC;IAFe,iBAAE,KAEjB,CAAA;AACH,CAAC,EAJgB,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAI9B"}
|
|
@@ -10,6 +10,7 @@ import { Editor2dModelOptions, Editor2dNode } from '../model/editor2d';
|
|
|
10
10
|
import { SelectionService } from '@gedit/application-common';
|
|
11
11
|
import { Editor2dContextKeyService } from '../editor2d-context-key-service';
|
|
12
12
|
import type { CanvasDraw } from './canvas-draw';
|
|
13
|
+
import { FormService } from '@gedit/ui';
|
|
13
14
|
export declare const Editor2dPlayGround: unique symbol;
|
|
14
15
|
export declare type Editor2dPlayGround = Playground<PlaygroundContext2d>;
|
|
15
16
|
export declare class PlaygroundContext2d {
|
|
@@ -19,13 +20,14 @@ export declare class PlaygroundContext2d {
|
|
|
19
20
|
readonly selectionService: SelectionService;
|
|
20
21
|
readonly appConfig: AppConfigService;
|
|
21
22
|
readonly options: Editor2dModelOptions;
|
|
23
|
+
readonly formService: FormService;
|
|
22
24
|
readonly contextKeyService: Editor2dContextKeyService;
|
|
23
25
|
readonly onCanvasDataChangedEmitter: Emitter<CanvasDraw>;
|
|
24
26
|
/**
|
|
25
27
|
* 监听画布变化,可用于生成缩略图
|
|
26
28
|
*/
|
|
27
29
|
readonly onCanvasDataChanged: import("@gedit/utils").Event<CanvasDraw>;
|
|
28
|
-
constructor(renderEngine: RenderEngineIDEService, document: Editor2dDocument, selection: Editor2dSelection, selectionService: SelectionService, appConfig: AppConfigService, options: Editor2dModelOptions, contextKeyService: Editor2dContextKeyService);
|
|
30
|
+
constructor(renderEngine: RenderEngineIDEService, document: Editor2dDocument, selection: Editor2dSelection, selectionService: SelectionService, appConfig: AppConfigService, options: Editor2dModelOptions, formService: FormService, contextKeyService: Editor2dContextKeyService);
|
|
29
31
|
/**
|
|
30
32
|
* 刷新 tree selection
|
|
31
33
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playground-context.d.ts","sourceRoot":"","sources":["../../../src/browser/playground/playground-context.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAY,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,Y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C3C,QAAQ,CAAC,SAAS,EAAE,gBAAgB;IAChC,QAAQ,CAAC,OAAO,EAAE,oBAAoB;IAC/C,QAAQ,CAAC,WAAW,EAAE,WAAW;IACnB,QAAQ,CAAC,iBAAiB,EAAE,yBAAyB;IAb1F,QAAQ,CAAC,0BAA0B,sBAA6B;IAChE;;OAEG;IACH,QAAQ,CAAC,mBAAmB,2CAAyC;gBAE1B,YAAY,EAAE,sBAAsB,EAC1C,QAAQ,EAAE,gBAAgB,EACzB,SAAS,EAAE,iBAAiB,EAC7B,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,gBAAgB,EACvB,OAAO,EAAE,oBAAoB,EACtC,WAAW,EAAE,WAAW,EACV,iBAAiB,EAAE,yBAAyB;IAO1F;;OAEG;IACH,mBAAmB,4CAAuB,sBAAsB,WAsB1D;IASN,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;IAWhD,cAAc,IAAI,GAAG;CAGtB"}
|
|
@@ -13,27 +13,28 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.PlaygroundContext2d = exports.Editor2dPlayGround = void 0;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
const inversify_1 = require("inversify");
|
|
17
|
+
const render_engine_ide_1 = require("@gedit/render-engine-ide");
|
|
18
|
+
const tree_1 = require("@gedit/tree");
|
|
19
|
+
const app_config_1 = require("@gedit/app-config");
|
|
20
|
+
const utils_1 = require("@gedit/utils");
|
|
21
|
+
const editor2d_document_1 = require("../model/editor2d-document");
|
|
22
|
+
const editor2d_selection_1 = require("../model/editor2d-selection");
|
|
23
|
+
const editor2d_1 = require("../model/editor2d");
|
|
24
|
+
const application_common_1 = require("@gedit/application-common");
|
|
25
|
+
const editor2d_context_key_service_1 = require("../editor2d-context-key-service");
|
|
26
26
|
var SelectionType = tree_1.TreeSelection.SelectionType;
|
|
27
|
+
const ui_1 = require("@gedit/ui");
|
|
27
28
|
exports.Editor2dPlayGround = Symbol('Editor2dPlayGround');
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var _this = this;
|
|
29
|
+
let PlaygroundContext2d = class PlaygroundContext2d {
|
|
30
|
+
constructor(renderEngine, document, selection, selectionService, appConfig, options, formService, contextKeyService) {
|
|
31
31
|
this.renderEngine = renderEngine;
|
|
32
32
|
this.document = document;
|
|
33
33
|
this.selection = selection;
|
|
34
34
|
this.selectionService = selectionService;
|
|
35
35
|
this.appConfig = appConfig;
|
|
36
36
|
this.options = options;
|
|
37
|
+
this.formService = formService;
|
|
37
38
|
this.contextKeyService = contextKeyService;
|
|
38
39
|
this.onCanvasDataChangedEmitter = new utils_1.Emitter();
|
|
39
40
|
/**
|
|
@@ -43,23 +44,23 @@ var PlaygroundContext2d = /** @class */ (function () {
|
|
|
43
44
|
/**
|
|
44
45
|
* 刷新 tree selection
|
|
45
46
|
*/
|
|
46
|
-
this.syncToSelectionTree = (0, utils_1.debounce)(
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
this.syncToSelectionTree = (0, utils_1.debounce)((entities) => {
|
|
48
|
+
const selectedEntities = entities.getSelectedEntities();
|
|
49
|
+
const selectedNodes = this.selection.selectedNodes;
|
|
49
50
|
// 清空数据
|
|
50
|
-
selectedNodes.forEach(
|
|
51
|
-
if (!selectedEntities.find(
|
|
52
|
-
|
|
51
|
+
selectedNodes.forEach(node => {
|
|
52
|
+
if (!selectedEntities.find(e => e.nodeId === node.id)) {
|
|
53
|
+
this.selection.addSelection({
|
|
53
54
|
node: node,
|
|
54
55
|
type: SelectionType.TOGGLE
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
58
|
});
|
|
58
|
-
selectedEntities.forEach(
|
|
59
|
-
|
|
60
|
-
if (node && !selectedNodes.find(
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
selectedEntities.forEach(entity => {
|
|
60
|
+
const node = entity.node;
|
|
61
|
+
if (node && !selectedNodes.find(e => e.id === node.id)) {
|
|
62
|
+
this.expandedNode(node);
|
|
63
|
+
this.selection.addSelection({
|
|
63
64
|
node: node,
|
|
64
65
|
type: SelectionType.TOGGLE
|
|
65
66
|
});
|
|
@@ -68,7 +69,7 @@ var PlaygroundContext2d = /** @class */ (function () {
|
|
|
68
69
|
}, 0);
|
|
69
70
|
this.document.toDispose.push(this.onCanvasDataChangedEmitter);
|
|
70
71
|
if (options.onCanvasDataChanged) {
|
|
71
|
-
this.onCanvasDataChanged(
|
|
72
|
+
this.onCanvasDataChanged(drawer => options.onCanvasDataChanged(drawer));
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
// syncToSelectionService(entities: SelectionEntityManager): void {
|
|
@@ -78,8 +79,8 @@ var PlaygroundContext2d = /** @class */ (function () {
|
|
|
78
79
|
// });
|
|
79
80
|
// }
|
|
80
81
|
//
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
expandedNode(node) {
|
|
83
|
+
let parent = node.parent;
|
|
83
84
|
while (parent) {
|
|
84
85
|
if (!parent.expanded) {
|
|
85
86
|
parent.expanded = true;
|
|
@@ -87,26 +88,27 @@ var PlaygroundContext2d = /** @class */ (function () {
|
|
|
87
88
|
}
|
|
88
89
|
parent = parent.parent;
|
|
89
90
|
}
|
|
90
|
-
}
|
|
91
|
-
|
|
91
|
+
}
|
|
92
|
+
getResourceURI() {
|
|
92
93
|
return new utils_1.URI(this.document.uri);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
PlaygroundContext2d = __decorate([
|
|
97
|
+
(0, inversify_1.injectable)(),
|
|
98
|
+
__param(0, (0, inversify_1.inject)(render_engine_ide_1.RenderEngineIDEService)),
|
|
99
|
+
__param(1, (0, inversify_1.inject)(editor2d_document_1.Editor2dDocument)),
|
|
100
|
+
__param(2, (0, inversify_1.inject)(editor2d_selection_1.Editor2dSelection)),
|
|
101
|
+
__param(3, (0, inversify_1.inject)(application_common_1.SelectionService)),
|
|
102
|
+
__param(4, (0, inversify_1.inject)(app_config_1.AppConfigService)),
|
|
103
|
+
__param(5, (0, inversify_1.inject)(editor2d_1.Editor2dModelOptions)),
|
|
104
|
+
__param(6, (0, inversify_1.inject)(ui_1.FormService)),
|
|
105
|
+
__param(7, (0, inversify_1.inject)(editor2d_context_key_service_1.Editor2dContextKeyService)),
|
|
106
|
+
__metadata("design:paramtypes", [render_engine_ide_1.RenderEngineIDEService,
|
|
107
|
+
editor2d_document_1.Editor2dDocument,
|
|
108
|
+
editor2d_selection_1.Editor2dSelection,
|
|
109
|
+
application_common_1.SelectionService,
|
|
110
|
+
app_config_1.AppConfigService, Object, ui_1.FormService,
|
|
111
|
+
editor2d_context_key_service_1.Editor2dContextKeyService])
|
|
112
|
+
], PlaygroundContext2d);
|
|
111
113
|
exports.PlaygroundContext2d = PlaygroundContext2d;
|
|
112
114
|
//# sourceMappingURL=playground-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playground-context.js","sourceRoot":"","sources":["../../../src/browser/playground/playground-context.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"playground-context.js","sourceRoot":"","sources":["../../../src/browser/playground/playground-context.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yCAA+C;AAC/C,gEAAkE;AAClE,sCAAgE;AAChE,kDAAqD;AACrD,wCAAsD;AAItD,kEAA8D;AAC9D,oEAAgE;AAChE,gDAAuE;AACvE,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