-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't clip elements of non-clipping div.
The default `Div` is non-clipping. However, when children changed we clipped them. This meant that the initial draw would happily draw elements outside the borders, but further updates would not.
- Loading branch information
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (C) 2023 Toitware ApS. | ||
// Use of this source code is governed by a Zero-Clause BSD license that can | ||
// be found in the TESTS_LICENSE file. | ||
|
||
// Tests some simple vertical sliders where there is a movable boundary between | ||
// two different backgrounds. | ||
|
||
import expect show * | ||
import font show * | ||
import pixel-display show * | ||
import .png-visualizer | ||
|
||
main args: | ||
if args.size != 1: | ||
print "Usage: script.toit png-basename" | ||
exit 1 | ||
WIDTH ::= 220 | ||
HEIGHT ::= 140 | ||
driver := TrueColorPngVisualizer WIDTH HEIGHT args[0] --outline=0x4040ff | ||
display := PixelDisplay.true-color driver | ||
display.background = 0x808080 | ||
|
||
sans10 := Font.get "sans10" | ||
label := Label --x=0 --y=0 --text="foo" --font=sans10 | ||
div := Div --x=30 --y=30 --w=(WIDTH - 60) --h=(HEIGHT - 60) [ | ||
// Since this isn't a clipping div, the label is drawn, even though it is | ||
// outside the div. | ||
label | ||
] | ||
display.add div | ||
|
||
display.draw | ||
|
||
label.text = "bar" | ||
display.draw | ||
|
||
driver.write-png |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.