private void setSize(Event event, boolean updateVariables) { if (!cursorInsideBrowserContentArea(event)) { // Only drag while cursor is inside the browser client area return; } int w = Util.getTouchOrMouseClientX(event) - startX + origW; int h = Util.getTouchOrMouseClientY(event) - startY + origH; w = Math.max(w, getMinWidth()); h = Math.max(h, getMinHeight()); setWidth(w + "px"); setHeight(h + "px"); if (updateVariables) { // sending width back always as pixels, no need for unit client.updateVariable(id, "width", w, false); client.updateVariable(id, "height", h, immediate); } if (updateVariables || !resizeLazy) { // Resize has finished or is not lazy updateContentsSize(); } else { // Lazy resize - wait for a while before re-rendering contents delayedContentsSizeUpdater.trigger(); } }
/** * Called when a resize event is received. * * <p>This may trigger a lazy refresh or perform the size check immediately depending on the * browser used and whether the server side requests resizes to be lazy. */ private void triggerSizeChangeCheck() { /* * IE (pre IE9 at least) will give us some false resize events due to * problems with scrollbars. Firefox 3 might also produce some extra * events. We postpone both the re-layouting and the server side event * for a while to deal with these issues. * * We may also postpone these events to avoid slowness when resizing the * browser window. Constantly recalculating the layout causes the resize * operation to be really slow with complex layouts. */ boolean lazy = resizeLazy || BrowserInfo.get().isIE8(); if (lazy) { delayedResizeExecutor.trigger(); } else { performSizeCheck(); } }