Skip to content

Commit

Permalink
Remove debug output
Browse files Browse the repository at this point in the history
This includes ignoring spacer objects when we render
  • Loading branch information
andydotxyz committed Sep 3, 2018
1 parent cc7aea9 commit af08a5a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
1 change: 0 additions & 1 deletion canvas_test.go
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
package fyne

20 changes: 18 additions & 2 deletions desktop/canvas.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import "unsafe"
import "github.com/fyne-io/fyne"
import "github.com/fyne-io/fyne/canvas"
import "github.com/fyne-io/fyne/theme"
import "github.com/fyne-io/fyne/layout"

var canvases = make(map[*C.Evas]*eflCanvas)

Expand Down Expand Up @@ -64,6 +65,14 @@ type eflCanvas struct {
dirty map[fyne.CanvasObject]bool
}

func ignoreObject(o fyne.CanvasObject) bool {
if _, ok := o.(layout.SpacerObject); ok {
return true
}

return false
}

func (c *eflCanvas) buildObject(o fyne.CanvasObject, target fyne.CanvasObject, offset fyne.Position) *C.Evas_Object {
var obj *C.Evas_Object
var opts canvas.Options
Expand Down Expand Up @@ -144,7 +153,9 @@ func (c *eflCanvas) buildContainer(parent fyne.CanvasObject, objs []fyne.CanvasO
parent = child
}

c.buildObject(child, parent, childOffset)
if !ignoreObject(child) {
c.buildObject(child, parent, childOffset)
}
}
}

Expand Down Expand Up @@ -210,6 +221,9 @@ func (c *eflCanvas) refreshObject(o, o2 fyne.CanvasObject) {

// TODO a better solution here as objects are added to the UI
if obj == nil {
if ignoreObject(o) {
return
}
obj = c.buildObject(o, o2, c.offsets[o])
}
pos := c.offsets[o].Add(o.CurrentPosition())
Expand Down Expand Up @@ -330,7 +344,9 @@ func (c *eflCanvas) setup(o fyne.CanvasObject, offset fyne.Position) {
c.buildContainer(set, set.Renderer().Objects(),
set.MinSize(), o.CurrentPosition(), offset)
default:
c.buildObject(o, o, offset)
if !ignoreObject(o) {
c.buildObject(o, o, offset)
}
}

C.ecore_thread_main_loop_end()
Expand Down
3 changes: 1 addition & 2 deletions layout/listlayout.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package layout
import (
"github.com/fyne-io/fyne"
"github.com/fyne-io/fyne/theme"
"log"
)

type listLayout struct {
Expand Down Expand Up @@ -38,7 +37,7 @@ func (g *listLayout) Layout(objects []fyne.CanvasObject, size fyne.Size) {
if len(spacers) > 0 {
extraCellHeight = int(float64(extraHeight) / float64(len(spacers)))
}
log.Println("Missing allocation", extraHeight)

for _, child := range objects {
height := child.MinSize().Height
if isVerticalSpacer(child) {
Expand Down

0 comments on commit af08a5a

Please sign in to comment.