If anybody is willing to take on experimenting with getting labels in
Timelines adjust to the width of their text, rather than truncating on
a fix 200 pixels, here is a bit of code to get you started. parseInt(
getStyle( labelnode, 'width', '200px'), 10) should get you a width in
pixels, when run on the rendered node.

It is likely a good idea to set the parent node's style property
white-space: nowrap (Google Mail does this to good effect). Nobody on
the developer has the time to do the full R&D, but I'm sure David
wouldn't mind dropping a suggestion or two about where to poke around
in the code, should you need more pointers to get you started.

-- 
 / Johan Sundström, http://ecmanaut.blogspot.com/

---------- Forwarded message ----------
From: Johan Sundström <[EMAIL PROTECTED]>
Date: Feb 16, 2007 10:14 AM
Subject: Re: Timeline: How do I stop title truncation?
To: Development List <[EMAIL PROTECTED]>

On 2/16/07, David Huynh <[EMAIL PROTECTED]> wrote:
> Johan, does getComputedStyle work in all browsers?... Is it fast enough?

It's fast enough, but IE6 hasn't implemented it. This one (somewhat
optimised version of Dojo.style.getComputedStyle) should be portable,
though (you could shave off some additional corners if you like; for
instance, document.defaultView === window, so you could do just
"getComputedStyle" in that call, as in my example, and tossing the
fallback code saves some additional cycles):

function getStyle(node, property, fallback) {
  if (!node || !node.style) {
    return fallback;
  }
  if (document.defaultView) {
    try {
      var cs = document.defaultView.getComputedStyle(node, "");
      if (cs) {
        return cs.getPropertyValue(property);
      }
    } catch (e) {
      if (node.style.getPropertyValue) {
        return node.style.getPropertyValue(property);
      }
      return fallback;
    }
  } else if (node.currentStyle) { // IE fallback
    var humps = property.split("-");
    for (var i = 1, hump; hump = humps[i]; i++) {
      humps[i] = hump.charAt(0).toUpperCase() + hump.substring(1);
    }
    return node.currentStyle[humps.join('')];
  }

  if (node.style.getPropertyValue)
    return node.style.getPropertyValue(property);
  return fallback;
}

--
 / Johan Sundström, http://ecmanaut.blogspot.com/

_______________________________________________
General mailing list
[email protected]
http://simile.mit.edu/mailman/listinfo/general

Reply via email to