Hi Isomorphic,
we're using SC for building SPA containing many-many pages. We've found (and resolved) couple of problems related to content sizing:
1. When individual page needs to perform custom styling, we want all it's CSS declarations to be contained under single container CSS class (that container CSS class could be assigned to specific screen top-level Canvas). Specifying borders, paddings and margins by cascading CSS rules does not work good with SmartClient though. After digging into SC source code it's clear this is due to the fact SC analyzes CSS classes by applying them to tester DIV. Container class names are not taken into account though.
2. The Canvas.getScrollWidth() method checks this.useClipDiv although it does not seem to be relevant there. As a result clipDiv existence is not taken into account (borders+paddings width is not calculated). The problem does not exist in Canvas.getScrollHeight() which only checks clipDivDrew without referencing this.useClipDiv
3. When inner Canvas is sized based on parent Canvas size, especially in a "width:100%, height:100%" way, there is a kind of misbehaviour. The percent resolution is made relative to innerWidth/innerHeight. It's pretty obvious that at
least in case of "100%" (I would say in all other cases too) the innerContentWidth/innerContentHeight should be used to prevent sizing over defined parent paddings
4. In case outer Canvas is automatically sized to resolve overflow (overflow=="VISIBLE"), there is a problem with the fact SC is using scrollWidth and scrollHeight DOM properties when margins are specified on inner Canvas. The behavior is different in different browsers. In Chrome scrollWidth does not take right margin into account (it does take left margin though) and scrollHeight does take top and bottom margins. In IE neither right nor bottom margins taken into account
I've build a script which "resolves" issues 1,2 and 3. I did not resolve issue 4 because it would require to make modifications (and not just replace) to SC methods and we tend to use minified version supplied by you
Issues 1,2 and 3 are resolved but resolution involved replacing some methods in a minified code which I don't like as well.
Attached are:
SmartClientSizingFixes.js ( SmartClientSizingFixes.js )--> "Resolution" code
TestCase.htm --> HTML showing number of scenarious ------ I WAS NOT ABLE TO ATTACH IT for some reason (the system shown "Invalid image..." message?!?)
BeforeFix.png ( ) --> Picture showing above HTML output without SmartClientSizingFixes.js applied
AfterFix.png ( ) --> Picture showing above HTML output with SmartClientSizingFixes.js applied
we're using SC for building SPA containing many-many pages. We've found (and resolved) couple of problems related to content sizing:
1. When individual page needs to perform custom styling, we want all it's CSS declarations to be contained under single container CSS class (that container CSS class could be assigned to specific screen top-level Canvas). Specifying borders, paddings and margins by cascading CSS rules does not work good with SmartClient though. After digging into SC source code it's clear this is due to the fact SC analyzes CSS classes by applying them to tester DIV. Container class names are not taken into account though.
2. The Canvas.getScrollWidth() method checks this.useClipDiv although it does not seem to be relevant there. As a result clipDiv existence is not taken into account (borders+paddings width is not calculated). The problem does not exist in Canvas.getScrollHeight() which only checks clipDivDrew without referencing this.useClipDiv
3. When inner Canvas is sized based on parent Canvas size, especially in a "width:100%, height:100%" way, there is a kind of misbehaviour. The percent resolution is made relative to innerWidth/innerHeight. It's pretty obvious that at
least in case of "100%" (I would say in all other cases too) the innerContentWidth/innerContentHeight should be used to prevent sizing over defined parent paddings
4. In case outer Canvas is automatically sized to resolve overflow (overflow=="VISIBLE"), there is a problem with the fact SC is using scrollWidth and scrollHeight DOM properties when margins are specified on inner Canvas. The behavior is different in different browsers. In Chrome scrollWidth does not take right margin into account (it does take left margin though) and scrollHeight does take top and bottom margins. In IE neither right nor bottom margins taken into account
I've build a script which "resolves" issues 1,2 and 3. I did not resolve issue 4 because it would require to make modifications (and not just replace) to SC methods and we tend to use minified version supplied by you
Issues 1,2 and 3 are resolved but resolution involved replacing some methods in a minified code which I don't like as well.
Attached are:
SmartClientSizingFixes.js ( SmartClientSizingFixes.js )--> "Resolution" code
TestCase.htm --> HTML showing number of scenarious ------ I WAS NOT ABLE TO ATTACH IT for some reason (the system shown "Invalid image..." message?!?)
BeforeFix.png ( ) --> Picture showing above HTML output without SmartClientSizingFixes.js applied
AfterFix.png ( ) --> Picture showing above HTML output with SmartClientSizingFixes.js applied
Comment