Fix interaction of borders/background and scrolling
StBoxLayout: Make consistent that the area scrolled and clipped to is the content area (excluding borders and padding.) Translate back appropriately when chaining up so that the parent background is drawn at the right place and picking on the box (if it's reactive) picks at the right place on the screen. clip-to-allocation is removed from StScrollView since it's just not right - if the child has any non-moving elements, like headers or borders, it will need to set a narrower clip. And even if the entire child scrolls, we want to clip to an arrow that excludes the scrollbars. https://bugzilla.gnome.org/show_bug.cgi?id=595997
This commit is contained in:
@ -8,11 +8,17 @@ const UI = imports.testcommon.ui;
|
||||
UI.init();
|
||||
let stage = Clutter.Stage.get_default();
|
||||
|
||||
let v = new St.ScrollView({});
|
||||
stage.add_actor(v);
|
||||
let vbox = new St.BoxLayout({ vertical: true,
|
||||
width: stage.width,
|
||||
height: stage.height,
|
||||
style: "padding: 10px;" });
|
||||
stage.add_actor(vbox);
|
||||
|
||||
let v = new St.ScrollView();
|
||||
vbox.add(v, { expand: true });
|
||||
|
||||
let b = new St.BoxLayout({ vertical: true,
|
||||
width: stage.width,
|
||||
height: stage.height });
|
||||
style: "border: 2px solid #880000; border-radius: 10px; padding: 0px 5px;" });
|
||||
v.add_actor(b);
|
||||
|
||||
let cc_a = "a".charCodeAt(0);
|
||||
@ -20,9 +26,16 @@ let s = "";
|
||||
for (let i = 0; i < 26 * 3; i++) {
|
||||
s += String.fromCharCode(cc_a + i % 26);
|
||||
|
||||
let t = new St.Label({ "text": s});
|
||||
let t = new St.Label({ text: s,
|
||||
reactive: true });
|
||||
let line = i + 1;
|
||||
t.connect('button-press-event',
|
||||
function() {
|
||||
log("Click on line " + line);
|
||||
});
|
||||
b.add(t);
|
||||
}
|
||||
|
||||
stage.show();
|
||||
Clutter.main();
|
||||
stage.destroy();
|
||||
|
Reference in New Issue
Block a user