Skip to content

Commit 15610b4

Browse files
Merge branch 'develop'
2 parents cc776f1 + e0dc0ac commit 15610b4

File tree

83 files changed

+3050
-1487
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+3050
-1487
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"workbench.colorTheme": "Solarized Dark"
2+
"workbench.colorTheme": "Nord"
33
}

CHANGELOG.MD

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# Change Log
22

3+
## v3.62.0, Jun 29, 2023
4+
5+
* New Event user property.
6+
* [#284](https://github.com/PhaserEditor2D/PhaserEditor2D-v3/issues/284) Fixes hit area rendering for containers.
7+
* A new Add Prefab Property command that shows a dialog.
8+
* Replaces the Object Depth commands for the Edit move commands.
9+
* Replaces the Object List sort commands by the Editor move commands.
10+
* Allows change prefab properties with the Edit move commands. Remove the Move options from the Prefab Properties section's menu.
11+
* Allows copy/cut/paste of prefab properties.
12+
* Allows copy/cut/paste keyboard keys.
13+
* Shows Keyboard.Key and Object List objects in the Object Variable user property's dialog..
14+
* Adds the new KeyCode User Property.
15+
* Fixes hit area serialization.
16+
* Removes the User Components section and shows user components properties as individual sections:
17+
* Renames the Scripts context menu to Scripting and include:
18+
- Add User Component (`M` key)
19+
- Browse User Components (`Shift+M` key)
20+
* Removes user component nodes from the Outline view.
21+
* Removes the Prefab Instance section, shows the prefab instance user properties as individual sections.
22+
* The Replace Texture Frame command responds to the `F` key.
23+
* Fixes adding a script node to all selected game objects.
24+
[#223](https://github.com/PhaserEditor2D/PhaserEditor2D-v3/issues/222) Fixed tab-focus on the DOM elements of the user properties.
25+
326
## v3.61.0 - May 18, 2023
427

528
* Checks if a scene file was generated by a newer and incompatible version of the editor.

design/logo-icons/gumroad-logo.png

29 KB
Loading

scripts/make-events-files.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
const fs = require("fs");
3+
const process = require("process")
4+
5+
const phaser_path = process.env.PHASER_PATH;
6+
const phaser_json_path = phaser_path + "/phaser3-docs/json/phaser.json";
7+
8+
const content = fs.readFileSync(phaser_json_path);
9+
10+
const data = JSON.parse(content.toString());
11+
12+
const docsMap = {};
13+
14+
let i = 1;
15+
16+
for (const item of data.docs) {
17+
18+
if (item.kind !== "event") {
19+
20+
continue;
21+
}
22+
23+
let { name, memberof } = item;
24+
25+
const fullName = `${memberof}.${name}`;
26+
27+
docsMap[fullName] = item.description || item.classdesc;
28+
29+
console.log(`${i++} Processing event fullName`);
30+
}
31+
32+
const output = JSON.stringify(docsMap, null, 2);
33+
34+
console.log("---");
35+
console.log("Writing to file events.json...");
36+
37+
fs.writeFileSync("../source/editor/plugins/phasereditor2d.scene/data/events-docs.json", output);
38+
39+
console.log("Done.");

source/editor/plugins/colibri/src/ui/controls/Control.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,16 +212,33 @@ namespace colibri.ui.controls {
212212
}
213213

214214
add(control: Control): void {
215+
215216
control._container = this;
217+
216218
this._children.push(control);
219+
217220
this._element.appendChild(control.getElement());
221+
218222
control.onControlAdded();
219223
}
220224

225+
remove(control: Control) {
226+
227+
control.getElement().remove();
228+
229+
this._children = this._children.filter(c => c !== control);
230+
231+
control.onControlRemoved();
232+
}
233+
221234
protected onControlAdded() {
222235
// nothing
223236
}
224237

238+
protected onControlRemoved() {
239+
// nothing
240+
}
241+
225242
getChildren() {
226243
return this._children;
227244
}

source/editor/plugins/colibri/src/ui/controls/properties/FormBuilder.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ namespace colibri.ui.controls.properties {
4747

4848
btn.addEventListener("click", e => callback(e));
4949

50-
parent.appendChild(btn);
50+
if (parent) {
51+
52+
parent.appendChild(btn);
53+
}
5154

5255
return btn;
5356
}

source/editor/plugins/colibri/src/ui/controls/properties/PropertyPage.ts

Lines changed: 32 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -1,151 +1,5 @@
11
namespace colibri.ui.controls.properties {
22

3-
class PropertySectionPane extends Control {
4-
5-
private _section: PropertySection<any>;
6-
private _titleArea: HTMLDivElement;
7-
private _formArea: HTMLDivElement;
8-
private _page: PropertyPage;
9-
private _menuIcon: IconControl;
10-
private _expandIconControl: IconControl;
11-
12-
constructor(page: PropertyPage, section: PropertySection<any>) {
13-
super();
14-
15-
this._page = page;
16-
17-
this._section = section;
18-
19-
this.addClass("PropertySectionPane");
20-
}
21-
22-
createSection() {
23-
24-
if (!this._formArea) {
25-
26-
this._titleArea = document.createElement("div");
27-
this._titleArea.classList.add("PropertyTitleArea");
28-
this._titleArea.addEventListener("click", () => this.toggleSection());
29-
30-
this._expandIconControl = new IconControl(colibri.ColibriPlugin.getInstance().getIcon(colibri.ICON_CONTROL_TREE_COLLAPSE));
31-
32-
this._expandIconControl.getCanvas().classList.add("expanded");
33-
34-
this._expandIconControl.getCanvas().addEventListener("click", e => {
35-
36-
e.stopImmediatePropagation();
37-
38-
this.toggleSection()
39-
});
40-
41-
this._titleArea.appendChild(this._expandIconControl.getCanvas());
42-
43-
const label = document.createElement("label");
44-
label.innerText = this._section.getTitle();
45-
this._titleArea.appendChild(label);
46-
47-
this._menuIcon = new IconControl(ColibriPlugin.getInstance().getIcon(ICON_SMALL_MENU));
48-
this._menuIcon.getCanvas().classList.add("IconButton");
49-
this._menuIcon.getCanvas().style.visibility = this._section.hasMenu() ? "visible" : "hidden";
50-
this._menuIcon.getCanvas().addEventListener("click", e => {
51-
52-
e.stopPropagation();
53-
e.stopImmediatePropagation();
54-
55-
if (this._section.hasMenu()) {
56-
57-
const menu = new Menu();
58-
this._section.createMenu(menu);
59-
menu.createWithEvent(e);
60-
}
61-
});
62-
this._titleArea.appendChild(this._menuIcon.getCanvas());
63-
64-
this._formArea = document.createElement("div");
65-
this._formArea.classList.add("PropertyFormArea");
66-
this._section.create(this._formArea);
67-
68-
this.getElement().appendChild(this._titleArea);
69-
this.getElement().appendChild(this._formArea);
70-
71-
this.updateExpandIcon();
72-
73-
let collapsed = this.getCollapsedStateInStorage();
74-
75-
if (collapsed === undefined) {
76-
77-
this.setCollapsedStateInStorage(this._section.isCollapsedByDefault());
78-
79-
collapsed = this.getCollapsedStateInStorage();
80-
}
81-
82-
if (collapsed === "true") {
83-
84-
this.toggleSection();
85-
}
86-
}
87-
}
88-
89-
private getCollapsedStateInStorage() {
90-
91-
return window.localStorage[this.getLocalStorageKey() + ".collapsed"];
92-
}
93-
94-
private setCollapsedStateInStorage(collapsed: boolean) {
95-
96-
return window.localStorage[this.getLocalStorageKey() + ".collapsed"] = collapsed ? "true" : "false";
97-
}
98-
99-
private getLocalStorageKey() {
100-
101-
return `colibri.ui.controls.properties.PropertySection[${this._section.getId()}]`;
102-
}
103-
104-
105-
isExpanded() {
106-
return this._expandIconControl.getCanvas().classList.contains("expanded");
107-
}
108-
109-
private toggleSection(): void {
110-
111-
if (this.isExpanded()) {
112-
113-
this._formArea.style.display = "none";
114-
this._expandIconControl.getCanvas().classList.remove("expanded");
115-
116-
} else {
117-
118-
this._formArea.style.display = "grid";
119-
this._expandIconControl.getCanvas().classList.add("expanded");
120-
}
121-
122-
this._page.updateExpandStatus();
123-
124-
this.getContainer().dispatchLayoutEvent();
125-
126-
this.updateExpandIcon();
127-
128-
this.setCollapsedStateInStorage(!this.isExpanded());
129-
}
130-
131-
private updateExpandIcon() {
132-
133-
const icon = this.isExpanded() ? colibri.ICON_CONTROL_SECTION_COLLAPSE : colibri.ICON_CONTROL_SECTION_EXPAND;
134-
135-
const image = ColibriPlugin.getInstance().getIcon(icon);
136-
137-
this._expandIconControl.setIcon(image);
138-
}
139-
140-
getSection() {
141-
return this._section;
142-
}
143-
144-
getFormArea() {
145-
return this._formArea;
146-
}
147-
}
148-
1493
export class PropertyPage extends Control {
1504
private _sectionProvider: PropertySectionProvider;
1515
private _sectionPanes: PropertySectionPane[];
@@ -186,6 +40,12 @@ namespace colibri.ui.controls.properties {
18640

18741
const pane = new PropertySectionPane(this, section);
18842

43+
if (section.getTypeHash()) {
44+
45+
this.removePanesWithSameTypeHash(section.getTypeHash());
46+
}
47+
48+
console.log("PropertyPage: create pane for", section.getTitle(), section.getId());
18949
this.add(pane);
19050

19151
this._sectionPaneMap.set(section.getId(), pane);
@@ -197,7 +57,9 @@ namespace colibri.ui.controls.properties {
19757
const sectionIdList = list.map(section => section.getId());
19858

19959
for (const pane of this._sectionPanes) {
60+
20061
const index = sectionIdList.indexOf(pane.getSection().getId());
62+
20163
pane.getElement().style.order = index.toString();
20264
}
20365

@@ -206,12 +68,29 @@ namespace colibri.ui.controls.properties {
20668
} else {
20769

20870
for (const pane of this._sectionPanes) {
209-
71+
21072
pane.getElement().style.display = "none";
21173
}
21274
}
21375
}
21476

77+
private removePanesWithSameTypeHash(typeHash: string) {
78+
79+
for (const pane of this._sectionPanes) {
80+
81+
const section = pane.getSection();
82+
83+
if (section.getTypeHash() === typeHash) {
84+
85+
console.log("PropertyPage: remove dynamic pane", section.getTitle(), section.getId());
86+
this.remove(pane);
87+
}
88+
}
89+
90+
this._sectionPanes = this._sectionPanes
91+
.filter(pane => pane.getSection().getTypeHash() !== typeHash);
92+
}
93+
21594
public updateWithSelection(): void {
21695

21796
if (!this._sectionProvider) {
@@ -288,6 +167,11 @@ namespace colibri.ui.controls.properties {
288167
pane.createSection();
289168
section.updateWithSelection();
290169

170+
if (section.isDynamicTitle()) {
171+
172+
pane.updateTitle();
173+
}
174+
291175
} else {
292176

293177
pane.getElement().style.display = "none";
@@ -357,6 +241,7 @@ namespace colibri.ui.controls.properties {
357241
}
358242

359243
getSectionProvider() {
244+
360245
return this._sectionProvider;
361246
}
362247
}

0 commit comments

Comments
 (0)