summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorJouni Koivuviita <jouni@vaadin.com>2014-08-04 10:15:44 +0300
committerJouni Koivuviita <jouni@vaadin.com>2014-08-07 19:04:33 +0000
commit474afffeb87cd2acc632f4bf061763e77dfe08e1 (patch)
treec0158203e9c380d5bc507d7979915c1f5836b1df /client
parent67da8682f4f262ebf2d7598fa0f0a57fa013cd46 (diff)
downloadvaadin-framework-474afffeb87cd2acc632f4bf061763e77dfe08e1.tar.gz
vaadin-framework-474afffeb87cd2acc632f4bf061763e77dfe08e1.zip
ResponsiveConnector should request layout update when breakpoints change
(#14354) Change-Id: Ie995268f8d89a951e9ebb351edde4ba1e824101e
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/extensions/ResponsiveConnector.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/client/src/com/vaadin/client/extensions/ResponsiveConnector.java b/client/src/com/vaadin/client/extensions/ResponsiveConnector.java
index 62913400db..8e349bac7b 100644
--- a/client/src/com/vaadin/client/extensions/ResponsiveConnector.java
+++ b/client/src/com/vaadin/client/extensions/ResponsiveConnector.java
@@ -302,11 +302,11 @@ public class ResponsiveConnector extends AbstractExtensionConnector implements
}-*/;
- private String currentWidthRanges;
- private String currentHeightRanges;
+ private String currentWidthRanges = "";
+ private String currentHeightRanges = "";
@Override
- public void onElementResize(ElementResizeEvent event) {
+ public void onElementResize(final ElementResizeEvent event) {
int width = event.getLayoutManager().getOuterWidth(event.getElement());
int height = event.getLayoutManager()
.getOuterHeight(event.getElement());
@@ -315,6 +315,9 @@ public class ResponsiveConnector extends AbstractExtensionConnector implements
.getElement();
boolean forceRedraw = false;
+ String oldWidthRanges = currentWidthRanges;
+ String oldHeightRanges = currentHeightRanges;
+
// Loop through breakpoints and see which one applies to this width
currentWidthRanges = resolveBreakpoint("width", width,
event.getElement());
@@ -342,6 +345,14 @@ public class ResponsiveConnector extends AbstractExtensionConnector implements
if (forceRedraw) {
forceRedrawIfIE8(element);
}
+
+ // If a new breakpoint is triggered, ensure all sizes are updated in
+ // case some new styles are applied
+ if (!currentWidthRanges.equals(oldWidthRanges)
+ || !currentHeightRanges.equals(oldHeightRanges)) {
+ event.getLayoutManager().setNeedsMeasureRecursively(
+ ResponsiveConnector.this.target);
+ }
}
/**