[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sc-devel] relative coordinates in SCCompositeView ?




OK, I actually fixed this one!

the test is below.

I assume its ok to commit.


--- SCView.M    (revision 7242)
+++ SCView.M    (working copy)
@@ -1003,7 +1003,9 @@
 
 void SCContainerView::drawIfNecessary(SCRect inDamage)
 {
-    if (SCRectsDoIntersect(inDamage, mBounds) && mVisible) {
+       SCRect drawBounds;
+       drawBounds = getDrawBounds();
+    if (SCRectsDoIntersect(inDamage, drawBounds) && mVisible) {
             draw(inDamage);
             SCView *child = mChildren;
                        SCView *children[mNumChildren];



On Feb 4, 2008 4:42 PM, felix <felix@xxxxxxxxxxxxxxxxxxx> wrote:


(

var flow;


// this replicates FlowView-flow

flow = { arg l,func;

var view,bounds,used;

"> flow > ".debug;

view = GUI.compositeView.new(l,l.decorator.indentedRemaining.debug("indentedRemaining"));

view.relativeOrigin = true;

view.decorator = FlowLayout.new(view.bounds.moveTo(0,0),2@2,4@4);

func.value(view);


// flow view resizeToFit

used = view.decorator.used;

used.debug("used");

bounds = view.bounds.resizeTo(used.width,used.height);

bounds.debug("resized");

view.bounds = bounds;

bounds = bounds.moveTo(0,0);

bounds.debug("moved");

view.decorator.bounds = bounds;


// l reflow all would normally happen now

// but I can already see the bug

view

};

w = SCWindow.new;

w.front;


a = GUI.compositeView.new(w,w.view.bounds.insetAll(2,2,2,2));

a.relativeOrigin = true;

a.decorator = FlowLayout.new(a.bounds.moveTo(0,0),2@2,4@4);

//a.background = "">


l = a;


// to get the bug you have to have a few things before the comp/flow 

b = SCButton(l,Rect(0,0,30,30)).states_([["1",Color.black,Color.red]]);

c = SCButton(l,Rect(0,0,30,30)).states_([["1",Color.black,Color.red]]);

// draw bug only happens after this last one is added !!!

d = SCButton(l,Rect(0,0,30,30)).states_([["1",Color.black,Color.red]]);


// and only with a flow within a flow

e = flow.(l,{ |l|

f = flow.(l,{ |l|

g = GUI.slider.new(l, Rect(0,0,100,17));

});

});



)