<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>John Wells &#187; UI scripting</title>
	<atom:link href="http://www.jfwhome.com/category/ui-scripting/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jfwhome.com</link>
	<description>Knowledge Management and Social Web App Guru</description>
	<lastBuildDate>Mon, 04 Jan 2016 17:26:35 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9</generator>
	<item>
		<title>jsPlumb anchors jump to their correct positions only after starting to draw</title>
		<link>http://www.jfwhome.com/2012/11/21/jsplumb-anchors-jump-to-their-correct-positions-only-after-starting-to-draw/</link>
		<comments>http://www.jfwhome.com/2012/11/21/jsplumb-anchors-jump-to-their-correct-positions-only-after-starting-to-draw/#comments</comments>
		<pubDate>Wed, 21 Nov 2012 09:35:10 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[UI scripting]]></category>

		<guid isPermaLink="false">http://www.jfwhome.com/?p=198</guid>
		<description><![CDATA[This foxed me for a while. I was setting up a connector-based UI using the excellent jsPlumb. In jsPlumb, you declare elements to hold your endpoints, and then the endpoints are painted onto your elements according to anchors you specify. For example, you could set your anchor to the middle of the left side of&#8230;]]></description>
				<content:encoded><![CDATA[<p>This foxed me for a while. I was setting up a connector-based UI using the excellent jsPlumb. </p>
<p>In jsPlumb, you declare elements to hold your endpoints, and then the endpoints are painted onto your elements according to anchors you specify. For example, you could set your anchor to the middle of the left side of your element, with the connector coming our of it towards the left.</p>
<p>This is all quite simple, but I spent hours trying to get it to work &#8212; whatever happened, the endpoints appeared in the wrong place. The frustrating part was that they would jump into the correct place after I started to draw connectors. So jsPlumb clearly couldn&#8217;t figure out the dimensions of the element when it was declared &#8212; only after I had started drawing.</p>
<p>It turns out that the problem was with jQuery UI tabs &#8212; the endpoints were inside a tab. Despite the tab being the default one and visible on page load, it was preventing jsPlumb from positioning endpoints correctly.</p>
<p>Once I had figured out that tabs were the culprit, the solution was really simple: Just call <code>jsPlumb.repaintEverything();</code> whenever the tab is &#8216;shown&#8217;. This way all positions can be re-calculated when the page is set up and all elements are visible and in their final positions. I put the call to repaintEverything in the tabs&#8217; show() event.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jfwhome.com/2012/11/21/jsplumb-anchors-jump-to-their-correct-positions-only-after-starting-to-draw/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
