Skip to content

Instantly share code, notes, and snippets.

@funkatron
Created January 29, 2011 22:44
Show Gist options
  • Save funkatron/802288 to your computer and use it in GitHub Desktop.
Save funkatron/802288 to your computer and use it in GitHub Desktop.
var resizeHandle = document.getElementById('resize-se');
resizeHandle.addEventListener('mousedown', function (e){
var isDragging = true;
var mousePosition = {x:event.clientX, y:event.clientY};
document.addEventListener('mousemove', drag, false);
document.addEventListener('mouseup', function (e){
document.removeEventListener('mousemove', drag, false);
document.removeEventListener('mouseup', arguments.callee, false);
}, false);
function drag(event) {
// console.log("firing drag", event.clientX, event.clientY);
var wnd = Titanium.UI.currentWindow;
wnd.setBounds({'x':wnd.getX(), 'y':wnd.getY(), 'width':event.clientX, 'height':event.clientY});
Spaz.Windows.onWindowResize();
return;
}
event.stopPropagation();
}, false);
@bytespider
Copy link

Do you find this is laggy? All my experiments show updating the window size is slow

@funkatron
Copy link
Author

I do find it laggy (see my comment on the issue in lighthouse). Really hoping they can patch it up somehow to work better. I don't know of a better approach though.

@bytespider
Copy link

Well your code its virtually the same as mine, so i think this is the best solution for now. Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment