parent
e7f16645eb
commit
7637133b81
@ -75,7 +75,8 @@ func (this *System) newBox (outer anyBox) *box {
|
|||||||
if box.parent == nil { return nil }
|
if box.parent == nil { return nil }
|
||||||
parentCanvas := box.parent.getCanvas()
|
parentCanvas := box.parent.getCanvas()
|
||||||
if parentCanvas == nil { return nil }
|
if parentCanvas == nil { return nil }
|
||||||
return parentCanvas.SubCanvas(box.bounds)
|
drawableArea := box.bounds.Intersect(box.parent.getInnerClippingBounds())
|
||||||
|
return parentCanvas.SubCanvas(drawableArea)
|
||||||
})
|
})
|
||||||
if outer == nil {
|
if outer == nil {
|
||||||
box.drawer = box
|
box.drawer = box
|
||||||
|
@ -298,6 +298,10 @@ func (this *containerBox) getCanvas () canvas.Canvas {
|
|||||||
return this.canvas.Value()
|
return this.canvas.Value()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *containerBox) getInnerClippingBounds () image.Rectangle {
|
||||||
|
return this.innerClippingBounds
|
||||||
|
}
|
||||||
|
|
||||||
func (this *containerBox) notifyMinimumSizeChange (child anyBox) {
|
func (this *containerBox) notifyMinimumSizeChange (child anyBox) {
|
||||||
this.invalidateMinimum()
|
this.invalidateMinimum()
|
||||||
size := child.minimumSize()
|
size := child.minimumSize()
|
||||||
|
@ -193,6 +193,10 @@ func (this *Hierarchy) getCanvas () canvas.Canvas {
|
|||||||
return this.canvas
|
return this.canvas
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Hierarchy) getInnerClippingBounds () image.Rectangle {
|
||||||
|
return this.canvas.Bounds()
|
||||||
|
}
|
||||||
|
|
||||||
func (this *Hierarchy) getModifiers () input.Modifiers {
|
func (this *Hierarchy) getModifiers () input.Modifiers {
|
||||||
return this.modifiers
|
return this.modifiers
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,9 @@ type parent interface {
|
|||||||
getHierarchy () *Hierarchy
|
getHierarchy () *Hierarchy
|
||||||
// canvas returns the canvas held by the parent.
|
// canvas returns the canvas held by the parent.
|
||||||
getCanvas () canvas.Canvas
|
getCanvas () canvas.Canvas
|
||||||
|
// getInnerClippingBounds returns the area of the canvas that children
|
||||||
|
// can draw to.
|
||||||
|
getInnerClippingBounds () image.Rectangle
|
||||||
// notifyMinimumSizeChange informs the parent that the minimum size of
|
// notifyMinimumSizeChange informs the parent that the minimum size of
|
||||||
// one of its children has changed.
|
// one of its children has changed.
|
||||||
notifyMinimumSizeChange (anyBox)
|
notifyMinimumSizeChange (anyBox)
|
||||||
|
Loading…
Reference in New Issue
Block a user