Giter Club home page Giter Club logo

giocanvas's People

Contributors

ajstarks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

giocanvas's Issues

How to add a canvas to an existing gioui app

Sorry I'm rather new to gioui so apologises if this is a stupib question, but how do I utilise the lib with an existing gioui app?

My app builds in what looks like a fairly standard way, I create a set of widgets , buttons, labels etc... and add them to a list and layout etc. These then get applied to the Frame in the FrameEvent

How do I add a canvas to an app, the play example show how to create a canvas in response to the FrameEvent with the canvas returning a context

web demo test harness

I wonder if we should also have all the demos load in a web page too ?
Just a good test harness like the one you have now for desktop.

A simple index page that is just a page of links, that then call each demos index web page.
I think it can be scripted like your bc.sh approach...

Layout options related to resize and perf issues.

I wrote had some code to allow resizing with all the slides of the deck shown as a continuous vertical stack, as well as horizontal resizing.

It worked, BUT, but perf was terrible. After you get to the 10th slide things got slow and blocking...

But last week i realised an elegant way to fix it which i think is worthwhile and would like to propose.

Basically there are 2 viewing modes.

  1. Make it more like how most PDF viewers work, with each slide ( of the whole deck ) as a mini thumbnail on the left pane and a single slide on the right pane. As you click the on the left pane, your loading a new slide and all is good, and the horizontal reising is fine in terms of performance. This avoids the perf problems because there is only deck at a time. The thumbnails are PNGS, so its fine to have a ton of them on the left pane.

  2. If you want the continuous vertical stacking of the slides in a deck with resizing, then we need to do the faked continuous scrolling trick.

Basically we have the terms Screen space versus Model space:

  • Screen space is the size of the window.
  • Model space is the size of the Deck. The deck ( and all its many slides ) extends vertically outside of the Screen Space.

The easy way to do this is to dynamically alter the XML of each slide as the user scrolls. Any slide not in Screen Space ( ie visible ) has no XML inside it. Most importantly the respective deck's size is kept, so that we don't mess up the scrolling bar.
As the user scrolls vertically we put the real XML back in for which ever slide (s) are n Screen space.

A deck with 500 pages is possible with no performance issues.


Technique 2 impacts how we do Technique 1 too. In Technique 1 the left pane with hundreds of Slides can use the same trick. SO we dont have to convert to PNG thumbnails. We can show the real vector format.

Resize: Canvas and Responsive options

The new resize works well. Been experimenting with it and it works fine.

I would like to see discus 2 further options:

  1. Canvas with scroll bars.

It never resizes, but instead allows zoom and scroll bars.

Use cases are many. My use case is needing to CAD like layouts.

  1. Responsive with scroll bars.

When you make the window smaller it pushes things over and does not rescale things. It's more like how GIOUI layout itself works.
The bottom scroll and right scroll bars appear appear as needed.

Uses cases are when you want App like behaviour

Fails to compile with the latest version of Gio

$ go run github.com/ajstarks/giocanvas/hello
go: finding module for package github.com/ajstarks/giocanvas/hello
go: found github.com/ajstarks/giocanvas/hello in github.com/ajstarks/giocanvas v0.0.0-20200531170401-8df5478cf848
go: finding module for package gioui.org/app
go: finding module for package gioui.org/op
go: finding module for package gioui.org/f32
go: finding module for package gioui.org/layout
go: finding module for package gioui.org/text
go: finding module for package gioui.org/font/gofont
go: finding module for package gioui.org/widget/material
go: finding module for package gioui.org/op/paint
go: finding module for package gioui.org/io/system
go: finding module for package gioui.org/op/clip
go: finding module for package gioui.org/unit
go: found gioui.org/app in gioui.org v0.0.0-20200531112915-23c2d44b8cfe
# github.com/ajstarks/giocanvas
../../go/pkg/mod/github.com/ajstarks/[email protected]/giocanvas.go:218:12: cannot use c.Context (type *layout.Context) as type layout.Context in argument to l.Layout

Thank you so much for creating this library.

build busted

Did a checkout on master, but build is broken due to dependencies.

Do you want to fix or should i have a go ??


all: init build run

init:
	cd play && go mod init
build:
	## desk
	cd play && go build -o $(PWD)/bin/play
run:
	open $(PWD)/bin/play

i get:


cd /Users/apple/workspace/go/src/github.com/ajstarks/giocanvas/play && go build -o /Users/apple/workspace/go/src/codeberg.org/gerard.webb/junk/sdk/gui/gio/ajstarks-giocanvas/bin/play
go: finding module for package gioui.org/io/key
go: finding module for package gioui.org/unit
go: finding module for package gioui.org/f32
go: finding module for package gioui.org/app
go: finding module for package github.com/ajstarks/giocanvas
go: finding module for package gioui.org/io/system
go: found gioui.org/app in gioui.org v0.0.0-20200630184602-223f8fd40ae4
go: found github.com/ajstarks/giocanvas in github.com/ajstarks/giocanvas v0.0.0-20200630185103-0ffc0a4d0f72
can't load package: package github.com/ajstarks/giocanvas/play: ambiguous import: found package github.com/ajstarks/giocanvas/play in multiple modules:
        github.com/ajstarks/giocanvas/play (/Users/apple/workspace/go/src/github.com/ajstarks/giocanvas/play)
        github.com/ajstarks/giocanvas v0.0.0-20200630185103-0ffc0a4d0f72 (/Users/apple/workspace/go/pkg/mod/github.com/ajstarks/[email protected]/play)
make: *** [build] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.