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

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




another epic here.  I didn't solve it yet, but this lays the test cases out for someone who can.

its probably simply that the check to draw or not draw (am I onscreen ?) is checking the rel bounds and thinking its an abs bounds.



when you move the slider, it does not redraw, it disappears.

actually its the containing composite view that disappears.

the same thing is happening in many different places, but this isolates the problem.


(

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));

});

});



)


all these figures look correct

the bounds are all visibily in the right place.

none of the inner views overlap the outer views.



// > flow >

indentedRemaining: Rect(104, 2, 290, 392)


// values the outer func

// > flow >

indentedRemaining: Rect(2, 2, 286, 388)

// inner func valued, the slider is placed on f

used: Rect(0, 0, 104, 21)

resized: Rect(2, 2, 104, 21)

moved: Rect(0, 0, 104, 21)


// needs to relow the parent flow now

// flowView.flow would do that


// we return to the outer one

used: Rect(0, 0, 290, 392)

resized: Rect(104, 2, 290, 392)

moved: Rect(0, 0, 290, 392)



e.background = "" style="color: #0000bf">Color.yellow

// another part of the bug: changing the color makes it disappear

// or if you have already moved the slider, its already gone

f.background = "" style="color: #0000bf">Color.blue

g.background = "">



d.bounds;

e.bounds;

f.bounds;

g.bounds;


// Rect(110, 8, 100, 17)

g.absoluteBounds


// Rect(108, 6, 104, 21)

f.absoluteBounds


//true

f.absoluteBounds.containsRect( g.absoluteBounds )




// Rect(106, 4, 290, 392)

e.absoluteBounds



// Rect(2, 2, 396, 396)

a.absoluteBounds


// so why is the slider/comp not drawing ?





here is the same thing but with relativeOrigin = false

and the bounds specified absolutely


no problems drawing the slider/comp

(

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 = false;

view.decorator = FlowLayout.new(view.bounds,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;


view

};

w = SCWindow.new;

w.front;


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

a.relativeOrigin = false;

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

//a.background = "">


l = a;



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));

});

});



)




On Feb 4, 2008 1:25 PM, Jan Trutzschler <sc3@xxxxxxxxxxxxxxxxx> wrote:
Hi,
thanks for testing, ' will look into the posted issues the coming days.
Jan