1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-30 16:00:46 +00:00

Fixes for sideways view

Fixed problem with starting up with the empty message displayed, and
problem with incorrect width reading of newly inserted list elements
This commit is contained in:
Jeremy Ruston 2012-11-05 15:14:27 +00:00
parent c95618e42c
commit 6819365dfc

View File

@ -17,13 +17,16 @@ function SidewaysListView(listMacro) {
// Prepare the list frame // Prepare the list frame
var listFrame = this.listMacro.listFrame, var listFrame = this.listMacro.listFrame,
listFrameDomNode = listFrame.domNode; listFrameDomNode = listFrame.domNode;
for(var t=0; t<listFrame.children.length; t++) { // Prepare any list elements
var title = listFrame.children[t].listElementInfo.title, for(var t=0; t<this.listMacro.list.length; t++) {
domNode = listFrame.children[t].domNode; var index = this.listMacro.findListElementByTitle(0,this.listMacro.list[t]);
$tw.utils.setStyle(domNode,[ if(index !== undefined) {
{verticalAlign: "top"}, var listElement = listFrame.children[index];
{display: "inline-block"} $tw.utils.setStyle(listElement.domNode,[
]); {verticalAlign: "top"},
{display: "inline-block"}
]);
}
} }
} }
@ -37,14 +40,16 @@ SidewaysListView.prototype.navigateTo = function(historyInfo) {
SidewaysListView.prototype.insert = function(index) { SidewaysListView.prototype.insert = function(index) {
var listElementNode = this.listMacro.listFrame.children[index], var listElementNode = this.listMacro.listFrame.children[index],
targetElement = listElementNode.domNode, targetElement = listElementNode.domNode;
currWidth = targetElement.offsetWidth + parseInt(window.getComputedStyle(targetElement).marginLeft,10);
// Set up the initial position of the element // Set up the initial position of the element
$tw.utils.setStyle(targetElement,[ $tw.utils.setStyle(targetElement,[
{verticalAlign: "top"}, {verticalAlign: "top"},
{display: "inline-block"}, {display: "inline-block"},
{transition: "none"}, {transition: "none"},
{opacity: "0.0"}, {opacity: "0.0"},
]);
var currWidth = targetElement.offsetWidth + parseInt(window.getComputedStyle(targetElement).marginLeft,10);
$tw.utils.setStyle(targetElement,[
{marginRight: (-currWidth) + "px"} {marginRight: (-currWidth) + "px"}
]); ]);
$tw.utils.forceLayout(targetElement); $tw.utils.forceLayout(targetElement);