[ALOY-717] Improve "reflow"/"repaint" functionality when adding and removing classes
GitHub Issue | n/a |
---|---|
Type | Sub-task |
Priority | High |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2013-08-26T11:37:24.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Alloy 1.2.0, 2013 Sprint 15 |
Components | Runtime, Styling |
Labels | notable, qe-testadded |
Reporter | Tony Lukasavage |
Assignee | Unknown |
Created | 2013-06-21T15:57:20.000+0000 |
Updated | 2018-03-07T22:25:55.000+0000 |
Description
problem
Currently when adding/removing position or visual properties from a proxy via theAlloy.addClass()
or Alloy.removeClass()
, these properties are not reset. To illustrate what I mean, consider the following styles:
".label": {
text: "I'm in the middle",
width: 150
}
".right": {
text: "I'll be on the right",
right: 0
}
If I create an XML UI component like this:
<Label class="label"/>
The label will say "I'm in the middle" and be centered. If I add the "right" class to it via Alloy.addClass()
, as expected, it will then say "I'll be on the right" and will move to the right side of the screen. If I then use Alloy.removeClass()
to remove the "right" class, the expectation would be that it would move back to the center and reset the text to the original. Unfortunately, only the text will be reset since it will be reapplied by the "label" class, but right:0
will remain attached to the proxy, keeping it on the right.
We need to devise a way to automatically, and safely, reset positioning and visual properties on a proxy when removing classes.
workaround
The case given above would behave as expected if you setright:null
in the "label" style, like this:
".label": {
text: "I'm in the middle",
width: 150,
right: null
}
".right": {
text: "I'll be on the right",
right: 0
}
Attachments
File | Date | Size |
---|---|---|
alloy717_1_android_4.0.4.png | 2013-08-26T10:56:54.000+0000 | 52970 |
alloy717_1.png | 2013-08-26T10:56:54.000+0000 | 56886 |
alloy717_3_android_4.0.4.png | 2013-08-26T10:56:54.000+0000 | 96952 |
alloy717_5.png | 2013-08-26T10:56:54.000+0000 | 84559 |