1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-04 19:23:29 +00:00

Keep the new tiddler positioning nozzle within the Cecily map

This commit is contained in:
Jeremy Ruston 2012-10-28 08:54:31 +00:00
parent 07c5a43404
commit c030f735a8
2 changed files with 10 additions and 7 deletions

View File

@ -117,7 +117,9 @@ exports.createListElement = function(title) {
attributes = {"class": ["tw-list-element"]},
eventHandler = {handleEvent: function(event) {
// Add context information to the event
event.navigateFromTitle = title;
if(!event.navigateFromTitle) {
event.navigateFromTitle = title;
}
return true;
}};
node.execute(this.parents,this.tiddlerTitle);

View File

@ -18,8 +18,6 @@ function CecilyListView(listMacro) {
// Prepare the list frame
var listFrameDomNode = this.listMacro.listFrame.domNode;
listFrameDomNode.style.position = "relative";
// Prepare the nozzle for dispensing new tiddlers onto the map
this.newTiddlerPosition = {x: 0, y: 0};
// Position the initial list entries on the map
this.loadMap();
for(var t=0; t<listFrameDomNode.children.length; t++) {
@ -35,7 +33,10 @@ CecilyListView.prototype.getMapTiddlerTitle = function() {
};
CecilyListView.prototype.loadMap = function() {
this.map = this.listMacro.wiki.getTiddlerData(this.getMapTiddlerTitle(),{positions: {}});
this.map = this.listMacro.wiki.getTiddlerData(this.getMapTiddlerTitle(),{
positions: {},
newTiddlerPosition: {x: 0, y: 0}
});
};
CecilyListView.prototype.saveMap = function() {
@ -53,12 +54,12 @@ CecilyListView.prototype.lookupTiddlerInMap = function(title,domNode) {
switch(this.map.positionNew) {
default: // "right"
newPosition = {
x: this.newTiddlerPosition.x,
y: this.newTiddlerPosition.y,
x: this.map.newTiddlerPosition.x,
y: this.map.newTiddlerPosition.y,
w: 100,
h: 100
};
this.newTiddlerPosition.x += newPosition.w * 1.2;
this.map.newTiddlerPosition.x += newPosition.w * 1.2;
break;
}
// A default position