Closed jeff-h closed 10 years ago
Simple addition to allow javascript to read the X,Y coordinates of the window. Amongst other things this is useful to allow javascript to move the window around when an element in the DOM is dragged. I tested this using the following code:
var dragging = false; document.onmousemove = function() { if (!dragging) return; macgap.window.move({ x: macgap.window.getX() + event.clientX - xstart, y: macgap.window.getY() +ystart - event.clientY, }); } document.onmousedown = function(){ dragging = true; xstart = event.clientX; ystart = event.clientY; } document.onmouseup = function(){ dragging = false; }
Note, this technique has an unavoidable flaw; you won't be able to drag the app onto another space like you should.
Simple addition to allow javascript to read the X,Y coordinates of the window. Amongst other things this is useful to allow javascript to move the window around when an element in the DOM is dragged. I tested this using the following code:
Note, this technique has an unavoidable flaw; you won't be able to drag the app onto another space like you should.