Comments (7)
This issue is caused by openfl/openfl#2177
from feathersui-openfl.
It also occurs if you set the style provider after the component has been initialized. The setter method will call applyStyles because the control is initialized and then applyStyles will get called again on update.
Either way, wouldn't the fix be to not reapply styles if the styleProvider hasn't changed?
from feathersui-openfl.
The setter method will call applyStyles because the control is initialized and then applyStyles will get called again on update.
From which line exactly does applyStyles() get called the second time?
from feathersui-openfl.
From FeathersControl.hx
private function set_styleProvider(value:IStyleProvider):IStyleProvider {
if (this._customStyleProvider == value) {
return this._customStyleProvider;
}
this._customStyleProvider = value;
if (this.initialized) {
// ignore if we're not initialized yet because it will be handled
// later. otherwise, apply the new styles immediately.
this.applyStyles();
}
this.setInvalid(InvalidationFlag.STYLES);
return this._customStyleProvider;
}
If this.initialized is true then this.applyStyles() will get called. Then the invalidation flag is set which results in it getting called again.
from feathersui-openfl.
How does setInvalid(InvalidationFlag.STYLES) cause applyStyles() to get called again?
from feathersui-openfl.
You're right. I just stepped through the code again. The second call is actually because of the duplicate added to stage event. I'd incorrectly assumed the invalidation was going to applyStyles again.
I still think it would be useful to not clearStyles() if it's not necessary. I'm actually porting a skin class from the Starling version which already guards against duplicate calls. This meant that the styles were getting cleared the second time through and then my skin wasn't reapplying them again.
from feathersui-openfl.
I added a guard for the duplicate Event.ADDED_TO_STAGE event.
I need to think some more about adding a guard for clearStyles(). If I were to add something, it would only prevent clearStyles() from being called if _currentStyleProvider were null. I suspect that you are expecting some additional conditions for clearStyles() to be skipped, but any other reason for skipping it could cause some old styles to be left behind that shouldn't be.
from feathersui-openfl.
Related Issues (20)
- ValidatingSprite using map instead of flags HOT 3
- Only the first row is rendered in `GridView` in a specific configuration.
- GridView: skin property for region to the right of headers and above scroll bar
- AssetLoader: property to display BitmapData and/or an arbitrary DisplayObject instead of loading with a string
- ToggleSwitch: optional on and off text
- Exception: Null Object Reference - Rectangle.hx HOT 5
- Exception: Null Object Reference - Clicking on Button HOT 9
- ItemRenderer: option to disable mouse/touch states
- ListView: scroll selected item fully into view if it is clicked/tapped
- Alert: optional close button in header
- New Component: Window/dialog: Similar to Alert, but allows completely custom content
- Inline Label cutting off in AIR HOT 2
- Fade in throwing reference error HOT 2
- HorizontalAlign.JUSTIFY not working in AIR HOT 1
- ListView: option to wrap keyboard navigation with arrow keys
- ListView: option to commit selection on item trigger only
- LongPress: property for maximum distance moved between mouseDown and mouseUp
- ToggleSwitch: optional on icon and off icon
- Label: expose antiAliasType property and pass to internal TextField (same for other text controls)
- AnchorLayout: error when `relativeTo` points to something not in the layout. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from feathersui-openfl.