1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-24 17:10:29 +00:00

Saving maps in CecilyView

This commit is contained in:
Jeremy Ruston 2012-10-26 17:57:57 +01:00
parent 187b6bfa4d
commit 8730c76884

View File

@ -36,7 +36,7 @@ CecilyListView.prototype.getMapTiddlerTitle = function() {
}; };
CecilyListView.prototype.loadMap = function() { CecilyListView.prototype.loadMap = function() {
this.map = this.listMacro.wiki.getTiddlerData(this.getMapTiddlerTitle(),{positions: []}); this.map = this.listMacro.wiki.getTiddlerData(this.getMapTiddlerTitle(),{positions: {}});
}; };
CecilyListView.prototype.saveMap = function() { CecilyListView.prototype.saveMap = function() {
@ -62,13 +62,17 @@ CecilyListView.prototype.lookupTiddlerInMap = function(title,domNode) {
this.newTiddlerPosition.x += newPosition.w * 1.2; this.newTiddlerPosition.x += newPosition.w * 1.2;
break; break;
} }
// Return the position // A default position
return newPosition || { newPosition = newPosition || {
x: 0, x: 0,
y: 0, y: 0,
w: 100, w: 100,
h: 100 h: 100
}; };
// Save the position back to the map
this.map.positions[title] = newPosition;
this.saveMap();
return newPosition;
}; };
CecilyListView.prototype.positionTiddler = function(title,domNode) { CecilyListView.prototype.positionTiddler = function(title,domNode) {