mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-11 18:00:26 +00:00
Keep the new tiddler positioning nozzle within the Cecily map
This commit is contained in:
parent
07c5a43404
commit
c030f735a8
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user