self.next = new PanelPosition();
sibling = siblingNode.el;
self.next.node = siblingNode;
}
PanelPosition affected = self.next;
MouseEvent e = (MouseEvent) evt;
if (vertical) {
self.mouseStart = e.getClientY();
// We parse from the css values set (which we set before this is called),
// so we don't have to do any measuring
// or compensate for weird offsets in the client elements.
self.posStart = CssUtils.parsePixels(wrapper.getStyle().getTop());
self.sizeStart = CssUtils.parsePixels(wrapper.getStyle().getHeight());
if (sibling != null) {
affected.posStart = CssUtils.parsePixels(sibling.getStyle().getTop());
affected.sizeStart = CssUtils.parsePixels(sibling.getStyle().getHeight());
}
} else {
self.mouseStart = e.getClientX();
self.posStart = CssUtils.parsePixels(wrapper.getStyle().getLeft());
self.sizeStart = CssUtils.parsePixels(wrapper.getStyle().getWidth());
if (sibling != null) {
affected.posStart = CssUtils.parsePixels(sibling.getStyle().getLeft());
affected.sizeStart = CssUtils.parsePixels(sibling.getStyle().getWidth());
}
}
final EventRemover[] remover = new EventRemover[2];
// TODO put these event listeners over an empty iframe, to cover up any iframes on page.
remover[0] = Browser.getWindow().addEventListener("mouseup", new EventListener() {
@Override
public void handleEvent(Event evt) {
if (remover[0] != null){
remover[0].remove();
remover[1].remove();
onResizeFinished(siblingNode, self);
remover[0] = null;
}
}
}, true);
remover[1] = Browser.getWindow().addEventListener("mousemove", new EventListener() {
@Override
public void handleEvent(Event evt) {
evt.preventDefault();
final MouseEvent e = (MouseEvent) evt;
final Element el = self.next == null ? null : self.next.node.el;
assert el != wrapper;
double delta;
if (vertical) {
delta = e.getClientY() - self.mouseStart;
if (first) {
// A top drag affects top and height
wrapper.getStyle().setTop((int)(self.posStart+ delta),"px");
wrapper.getStyle().setHeight((int)(self.sizeStart - delta),"px");
if (el != null) {
// TODO implement max/min/pref values, and iterate through the
// nodes to push delta off on any neighbors
el.getStyle().setHeight((int)(self.next.sizeStart + delta),"px");
}
} else {
wrapper.getStyle().setHeight((int)(self.sizeStart + delta),"px");
if (el != null) {
el.getStyle().setTop((int)(self.next.posStart+ delta),"px");
el.getStyle().setHeight((int)(self.next.sizeStart - delta),"px");
}
}
} else {
delta = e.getClientX() - self.mouseStart;
if (first) {
// A left drag affects left and size
wrapper.getStyle().setLeft((int)(self.posStart + delta),"px");
wrapper.getStyle().setWidth((int)(self.sizeStart - delta),"px");
if (el != null) {