Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
PhaserEditor2D committed Nov 30, 2021
2 parents d8bb953 + 1b817cf commit 836e979
Show file tree
Hide file tree
Showing 82 changed files with 1,869 additions and 755 deletions.
27 changes: 25 additions & 2 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
# Change Log

## v3.30.0 - Sep 18, 2020
## v3.31.0 - Nov 29, 2021

### Added

* [#145](https://github.com/PhaserEditor2D/PhaserEditor2D-v3/issues/145): BitmapText: adds support for `maxWidth` property.
* Scene editor: commands for setting default render type.

### Changed

* AllInOne: the Play Project command opens the default browser.
* Scene compiler: formats Text style JSON with a VSCode similar formatting.

### Fixed

* Scene editor: fixes Break Parent command.
* [#143](https://github.com/PhaserEditor2D/PhaserEditor2D-v3/issues/143) Fixes bitmap font loading when pasting a bitmap text object from other scene.
* [#154](https://github.com/PhaserEditor2D/PhaserEditor2D-v3/issues/154) Incorrect position values passed to super call in derived class of nested prefab.
* [150](https://github.com/PhaserEditor2D/PhaserEditor2D-v3/issues/150) Incorrect editor representation: Unlocked nested prefab properties aren't applied to instances of the prefab.
* Fixes serialization of default origin values in Text and BitmapText objects. It now uses `(0, 0)` in those cases.
* Always include the value of an unlocked property in the scene serialization and the code generation.
* Scene Editor: allows changing the origin of a container prefab instance with unlocked position.
* Scene Editor: fixes var name of nested prefabs.

## v3.30.0 - Sep 18, 2021

### Added

Expand Down Expand Up @@ -45,7 +68,7 @@
* Scene Editor (BitmapText): fixes error when the font data isn't available in the cache.
* [#134](https://github.com/PhaserEditor2D/PhaserEditor2D-v3/issues/134) Creating a list in the editor results in an initialized array in the generated code.
* [#135](https://github.com/PhaserEditor2D/PhaserEditor2D-v3/issues/135) Word wrap width does not behave correctly
* Scene Editor: fixes Move To Parent dialog in context of prefab s\cenes.
* Scene Editor: fixes Move To Parent dialog in context of prefab scenes.
* Scene Editor: fixes Scene section layout when shows a prefab's instance.
* [#142](https://github.com/PhaserEditor2D/PhaserEditor2D-v3/issues/142) Animations Editor: fixes changing multiple properties of the same animation.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,51 @@ namespace colibri.ui.controls.properties {

return text;
}

private static NEXT_ID = 0;

createCheckbox(parent: HTMLElement, label?: HTMLLabelElement) {

const check = document.createElement("input");

if (label) {

const id = (PropertySection.NEXT_ID++).toString();

label.htmlFor = id;

check.setAttribute("id", id);
}

check.type = "checkbox";
check.classList.add("formCheckbox");

parent.appendChild(check);

return check;
}

createMenuIcon(parent: HTMLElement, menuProvider: () => Menu, alignRight = true) {

const icon = new controls.IconControl(colibri.ColibriPlugin.getInstance().getIcon(colibri.ICON_SMALL_MENU));

icon.getCanvas().classList.add("IconButton");

parent.appendChild(icon.getCanvas());

icon.getCanvas().addEventListener("click", e => {

const menu = menuProvider();

menu.createWithEvent(e);
});

if (alignRight) {

icon.getCanvas().style.float = "right";
}

return icon;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ namespace colibri.ui.controls.properties {

this._titleArea = document.createElement("div");
this._titleArea.classList.add("PropertyTitleArea");
this._titleArea.addEventListener("mouseup", () => this.toggleSection());
this._titleArea.addEventListener("click", () => this.toggleSection());

this._expandIconControl = new IconControl(colibri.ColibriPlugin.getInstance().getIcon(colibri.ICON_CONTROL_TREE_COLLAPSE));

this._expandIconControl.getCanvas().classList.add("expanded");

this._expandIconControl.getCanvas().addEventListener("mouseup", e => {
this._expandIconControl.getCanvas().addEventListener("click", e => {

e.stopImmediatePropagation();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,278 +234,6 @@ namespace colibri.ui.controls.properties {
return div;
}

createLabel(parent: HTMLElement, text = "", tooltip = "") {

const label = document.createElement("label");

label.classList.add("formLabel");
label.innerText = text;

if (tooltip) {
Tooltip.tooltip(label, tooltip);
}

parent.appendChild(label);

return label;
}

createButton(parent: HTMLElement, text: string, callback: (e?: MouseEvent) => void) {

const btn = document.createElement("button");

btn.innerText = text;

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

parent.appendChild(btn);

return btn;
}

createMenuButton(
parent: HTMLElement, text: string,
getItems: () => Array<{ name: string, value: any, icon?: controls.IImage }>,
callback: (value: any) => void) {

const btn = this.createButton(parent, text, e => {

const menu = new controls.Menu();

for (const item of getItems()) {

menu.add(new Action({
text: item.name,
icon: item.icon,
callback: () => {
callback(item.value);
}
}));
}

menu.createWithEvent(e);
});

return btn;
}

createText(parent: HTMLElement, readOnly = false) {

const text = document.createElement("input");

text.type = "text";
text.classList.add("formText");
text.readOnly = readOnly;

parent.appendChild(text);

return text;
}

createTextDialog(parent: HTMLElement, dialogTitle: string, readOnly = false) {

const text = this.createTextArea(parent, false);
text.rows = 1;

const btn = document.createElement("button");
btn.textContent = "...";
btn.addEventListener("click", () => {

const dlg = new StringDialog();

dlg.create();

dlg.setTitle(dialogTitle);

dlg.addButton("Accept", () => {

text.value = dlg.getValue();
text.dispatchEvent(new Event("change"));

dlg.close();
});

dlg.addCancelButton();

dlg.setValue(text.value);
});

const container = document.createElement("div");
container.classList.add("StringDialogField")

container.appendChild(text);
container.appendChild(btn);

parent.appendChild(container);

return { container, text, btn };
}

createColor(parent: HTMLElement, readOnly = false, allowAlpha = true) {

const text = document.createElement("input");

text.type = "text";
text.classList.add("formText");
text.readOnly = readOnly;

const btn = document.createElement("button");
// btn.textContent = "...";
btn.classList.add("ColorButton");
btn.appendChild(
new IconControl(ColibriPlugin.getInstance().getIcon(colibri.ICON_COLOR)).getCanvas());

const colorElement = document.createElement("div");
colorElement.style.display = "grid";
colorElement.style.gridTemplateColumns = "1fr auto";
colorElement.style.gridGap = "5px";
colorElement.style.alignItems = "center";
colorElement.appendChild(text);
colorElement.appendChild(btn);

parent.appendChild(colorElement);

btn.addEventListener("mousedown", e => {

if (text.readOnly) {

return;
}

e.preventDefault();
e.stopImmediatePropagation();

if (ColorPickerManager.isActivePicker()) {

ColorPickerManager.closeActive();

return;
}

const picker = ColorPickerManager.createPicker();

btn["__picker"] = picker;

picker.setOptions({
popup: "left",
editor: false,
alpha: false,
onClose: () => {

ColorPickerManager.closeActive();
},
onDone: (color) => {

text.value = allowAlpha ? color.hex : color.hex.substring(0, 7);
btn.style.background = text.value;
text.dispatchEvent(new CustomEvent("change"));
}
});

try {

picker.setColour(text.value, false);

} catch (e) {

picker.setColour("#fff", false);
}

picker.show();

const pickerElement = picker.domElement as HTMLElement;
const pickerBounds = pickerElement.getBoundingClientRect();
const textBounds = text.getBoundingClientRect();

pickerElement.getElementsByClassName("picker_arrow")[0].remove();

let top = textBounds.top - pickerBounds.height;

if (top + pickerBounds.height > window.innerHeight) {

top = window.innerHeight - pickerBounds.height;
}

if (top < 0) {

top = textBounds.bottom;
}

let left = textBounds.left;

if (left + pickerBounds.width > window.innerWidth) {

left = window.innerWidth - pickerBounds.width;
}

pickerElement.style.top = top + "px";
pickerElement.style.left = left + "px";

});

return {
element: colorElement,
text: text,
btn: btn
};
}

createTextArea(parent: HTMLElement, readOnly = false) {

const text = document.createElement("textarea");

text.classList.add("formText");
text.readOnly = readOnly;

parent.appendChild(text);

return text;
}

private static NEXT_ID = 0;

createCheckbox(parent: HTMLElement, label?: HTMLLabelElement) {

const check = document.createElement("input");

if (label) {

const id = (PropertySection.NEXT_ID++).toString();

label.htmlFor = id;

check.setAttribute("id", id);
}

check.type = "checkbox";
check.classList.add("formCheckbox");

parent.appendChild(check);

return check;
}

createMenuIcon(parent: HTMLElement, menuProvider: () => Menu, alignRight = true) {

const icon = new controls.IconControl(colibri.ColibriPlugin.getInstance().getIcon(colibri.ICON_SMALL_MENU));

icon.getCanvas().classList.add("IconButton");

parent.appendChild(icon.getCanvas());

icon.getCanvas().addEventListener("click", e => {

const menu = menuProvider();

menu.createWithEvent(e);
});

if (alignRight) {

icon.getCanvas().style.float = "right";
}

return icon;
}

}
}
2 changes: 1 addition & 1 deletion source/editor/plugins/phasereditor2d.ide/src/IDEPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ namespace phasereditor2d.ide {

/* program entry point */

export const VER = "3.30.0";
export const VER = "3.31.0";

async function main() {

Expand Down
Loading

0 comments on commit 836e979

Please sign in to comment.