Skip to content

Commit

Permalink
Merge branch 'hotfix/v1.4.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
CosmoMyzrailGorynych committed Aug 9, 2020
2 parents 92ccebb + 6d13523 commit a6b2109
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 26 deletions.
12 changes: 12 additions & 0 deletions app/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## v1.4.1

*Sun Aug 10 2020*

### 🐛 Bug Fixes

* Fix indefinite behavior after placing copies and switching to the properties tab in the room editor
* Fix loading error while migrating a project without tile layers to v1.4.0
* Fix regression with custom script typings: they were not loaded on project load
* Fix type picker being empty right after opening the room editor
* Icons in the room editor, on the left side, should be centered if no labels are shown next to them.

## v1.4.0

*Sun Aug 09 2020*
Expand Down
2 changes: 1 addition & 1 deletion app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"main": "index.html",
"name": "ctjs",
"description": "ct.js — a free 2D game engine",
"version": "1.4.0",
"version": "1.4.1",
"homepage": "https://ctjs.rocks/",
"author": {
"name": "Cosmo Myzrail Gorynych",
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ctjsbuildenvironment",
"version": "1.4.0",
"version": "1.4.1",
"description": "",
"directories": {
"doc": "docs"
Expand Down
8 changes: 8 additions & 0 deletions src/js/loadProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@
document.title = global.currentProject.settings.title + ' — ct.js';
}

glob.scriptTypings = {};
for (const script of global.currentProject.scripts) {
glob.scriptTypings[script.name] = [
monaco.languages.typescript.javascriptDefaults.addExtraLib(script.code),
monaco.languages.typescript.typescriptDefaults.addExtraLib(script.code)
];
}

const {loadAllTypedefs, resetTypedefs} = require('./data/node_requires/resources/modules/typedefs');
resetTypedefs();
loadAllTypedefs();
Expand Down
4 changes: 4 additions & 0 deletions src/js/migration/1.4.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ window.migrationProcess.push({
* Tile layers at rooms can now be extended and have an object `exts`.
*/
for (const room of project.rooms) {
if (!room.tiles) {
room.tiles = [];
continue;
}
for (const layer of room.tiles) {
layer.extends = layer.extends || {};
delete layer.exts; // Leftovers from development of v1.3.2
Expand Down
7 changes: 0 additions & 7 deletions src/riotTags/project-settings/scripts-setttings.tag
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ scripts-settings
this.currentProject.scripts = this.currentProject.scripts || [];

const glob = require('./data/node_requires/glob');
glob.scriptTypings = glob.scriptTypings || {};
for (const script of global.currentProject.scripts) {
glob.scriptTypings[script.name] = [
monaco.languages.typescript.javascriptDefaults.addExtraLib(script.code),
monaco.languages.typescript.typescriptDefaults.addExtraLib(script.code)
];
}

this.addNewScript = () => {
var script = {
Expand Down
10 changes: 5 additions & 5 deletions src/riotTags/rooms/room-editor.tag
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ room-editor.panel.view
li(onclick="{changeTab('roomcopies')}" title="{voc.copies}" class="{active: tab === 'roomcopies'}")
svg.feather
use(xlink:href="data/icons.svg#type")
span(show="{sidebarWidth > 500}") {voc.copies}
span(if="{sidebarWidth > 500}") {voc.copies}
li(onclick="{changeTab('roombackgrounds')}" title="{voc.backgrounds}" class="{active: tab === 'roombackgrounds'}")
svg.feather
use(xlink:href="data/icons.svg#image")
span(show="{sidebarWidth > 500}") {voc.backgrounds}
span(if="{sidebarWidth > 500}") {voc.backgrounds}
li(onclick="{changeTab('roomtiles')}" title="{voc.tiles}" class="{active: tab === 'roomtiles'}")
svg.feather
use(xlink:href="data/icons.svg#texture")
span(show="{sidebarWidth > 500}") {voc.tiles}
span(if="{sidebarWidth > 500}") {voc.tiles}
li(onclick="{changeTab('properties')}" title="{voc.properties}" class="{active: tab === 'properties'}")
svg.feather
use(xlink:href="data/icons.svg#settings")
span(show="{sidebarWidth > 500}") {voc.properties}
span(if="{sidebarWidth > 500}") {voc.properties}
.relative
room-type-picker(show="{tab === 'roomcopies'}" current="{currentType}")
room-backgrounds-editor(show="{tab === 'roombackgrounds'}" room="{room}")
Expand Down Expand Up @@ -237,7 +237,7 @@ room-editor.panel.view
this.tab = 'roomcopies';
this.changeTab = tab => () => {
this.tab = tab;
if (tab === 'roombackgrounds') {
if (tab === 'roombackgrounds' || tab === 'properties') {
this.roomUnpickType();
}
};
Expand Down
29 changes: 19 additions & 10 deletions src/riotTags/rooms/room-type-picker.tag
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,6 @@ room-type-picker.room-editor-TypeSwatches.tabbed.tall

this.getTypeTextureRevision = type => glob.texturemap[type.texture].g.lastmod;

this.updateTypeList = () => {
this.types = [...global.currentProject.types];
this.types.sort((a, b) => a.name.localeCompare(b.name));
this.fuseSearch();
};
var typesChanged = () => {
this.updateTypeList();
this.update();
};
window.signals.on('typesChanged', typesChanged);
this.on('unmount', () => {
window.signals.off('typesChanged', typesChanged);
Expand All @@ -64,6 +55,10 @@ room-type-picker.room-editor-TypeSwatches.tabbed.tall
};
const Fuse = require('fuse.js');
this.fuseSearch = e => {
if (!this.mounted) {
this.searchResults = null;
return;
}
var val = (e ? e.target.value : this.refs.fusesearch.value).trim();
if (val) {
var fuse = new Fuse(this.types, fuseOptions);
Expand All @@ -76,4 +71,18 @@ room-type-picker.room-editor-TypeSwatches.tabbed.tall
this.parent.currentType = type;
this.parent.selectedCopies = false;
};
this.on('mount', this.updateTypeList);

this.updateTypeList = () => {
this.types = [...global.currentProject.types];
this.types.sort((a, b) => a.name.localeCompare(b.name));
this.fuseSearch();
};
this.updateTypeList();
var typesChanged = () => {
this.updateTypeList();
this.update();
};

this.on('mount', () => {
this.mounted = true;
});

0 comments on commit a6b2109

Please sign in to comment.