Skip to content

Commit 18df068

Browse files
author
Patrick Sachs
authored
Merge pull request #21 from PatrickSachs/develop
1.0.1
2 parents f94e736 + dd942ea commit 18df068

File tree

6 files changed

+22
-5
lines changed

6 files changed

+22
-5
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "slow-tree",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "",
55
"main": "index.js",
66
"scripts": {

src/commands/CommandManager.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ export default class CommandManager {
3535
}
3636
}
3737

38+
/**
39+
* Clears the undo/redo stacks.
40+
*/
41+
public clear() {
42+
this._undo = [];
43+
this._redo = [];
44+
}
45+
3846
/**
3947
* Redoes the last undone command and removes it from the redo stack. If no command has
4048
* been undone before no action is performed.

src/commands/DestroyTreeElementCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default class DestroyTreeElementCommand implements ICommand {
4040
if (!owner) {
4141
throw new SlowTreeError("Could not un-delete tree element with owner " + this.owner);
4242
}
43-
// A kinda hacky workaround leveraging the fact that the save data strcuture is the
43+
// A kinda hacky workaround leveraging the fact that the save data structure is the
4444
// same as the one used in game.
4545
// For a larger project a better solution might be warraned, but in this case it does
4646
// the job just fine.

src/components/App.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
</v-content>
131131
<v-footer app height="auto">
132132
<v-flex text-xs-center xs12>
133-
slow-tree &copy;2019 —
133+
slow-tree {{pkg.version}} &copy;2019 —
134134
<strong>sahnee.de</strong>
135135
</v-flex>
136136
</v-footer>
@@ -204,6 +204,7 @@ import TreeType from "@/TreeType";
204204
import uuid from "@/utils/uuid";
205205
import LeavesGameObject from "@/gameobjects/LeavesGameObject";
206206
import FileSaver from "file-saver";
207+
import pkg from "../../package.json";
207208
208209
interface IMenuItem {
209210
id: string;
@@ -241,6 +242,7 @@ export default class STApp extends Vue {
241242
private angle: integer = 25;
242243
private oldSavegameVersion: boolean = false;
243244
private errorMessage: string = "";
245+
private pkg = pkg;
244246
245247
/**
246248
* Called when the component is ready to be used, but has no HTMl elements yet.
@@ -424,6 +426,7 @@ export default class STApp extends Vue {
424426
const json = JSON.parse(reader.result as string);
425427
console.log("Uploaded file ...", json);
426428
try {
429+
this.game!.cmd.clear();
427430
scene.loadGame(json);
428431
this.cache();
429432
} catch (error) {
@@ -441,8 +444,9 @@ export default class STApp extends Vue {
441444
* Called when the user clicks on the delete button.
442445
*/
443446
onClickDelete() {
444-
if (this.scene) {
447+
if (this.game && this.scene) {
445448
this.scene.clear();
449+
this.game.cmd.clear();
446450
this.tree = this.scene.tree.treeType.id;
447451
}
448452
localStorage.removeItem("cache");

src/d/json.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
declare module '*.json' {
2+
type JSON = { [key: string]: JSON | string | number | boolean | null | undefined };
3+
const JSONObject: JSON;
4+
export default JSONObject;
5+
}

0 commit comments

Comments
 (0)