Giter VIP home page Giter VIP logo

gooey's Issues

Input state machine doesn't include 'released_now' or 'clickable' fields on last frame

I just started playing around with this library recently (using release 7.5.2), am currently trying to incorporate a basic text input node in my project (on android). For some reason though, on the final touch frame, the 'released_now' and 'clickable' fields that would indicate a completed click do not show up.

Here's the relevant portion of console feedback: (pprinting the input table each frame)

DEBUG:SCRIPT:
{ --[[0xad34a090]]
pressed_now = false,
node = @(0, -24, 0),
long_pressed = true,
current_text = "",
set_visible = function: 0xad34a180,
refresh_fn = function: 0xaed03a10,
marked_text = "",
out_now = false,
total_width = 0,
set_long_pressed_time = function: 0xaed057d0,
text_width = 0,
long_pressed_time = 1.5,
marked_text_width = 0,
clicked = false,
enabled = true,
set_text = function: 0xad34a100,
text = "",
consumed = false,
refresh = function: 0xad34a140,
over = false,
empty = true,
deselected_now = false,
over_now = false,
keyboard_type = 0,
released_now = false
}
DEBUG:SCRIPT:
{ --[[0xad34a090]]
pressed_now = false,
node = @(0, -24, 0),
long_pressed = true,
current_text = "",
set_visible = function: 0xad34a180,
refresh_fn = function: 0xaed03a10,
marked_text = "",
out_now = false,
total_width = 0,
set_long_pressed_time = function: 0xaed057d0,
text_width = 0,
long_pressed_time = 1.5,
marked_text_width = 0,
clicked = false,
enabled = true,
set_text = function: 0xad34a100,
text = "",
consumed = false,
refresh = function: 0xad34a140,
over = false,
empty = true,
deselected_now = false,
over_now = false,
keyboard_type = 0,
released_now = false
}
DEBUG:SCRIPT:
{ --[[0xad34a090]]
pressed_now = false,
node = @(0, -24, 0),
long_pressed = true,
current_text = "",
set_visible = function: 0xad34a180,
refresh_fn = function: 0xaed03a10,
marked_text = "",
out_now = false,
total_width = 0,
set_long_pressed_time = function: 0xaed057d0,
text_width = 0,
long_pressed_time = 1.5,
marked_text_width = 0,
enabled = true,
set_text = function: 0xad34a100,
text = "",
refresh = function: 0xad34a140,
over = false,
empty = true,
deselected_now = false,
over_now = false,
keyboard_type = 0
}

I'm kind of surprised nobody else has had this issue, as it's a pretty big roadblock for me. It's possible I'm doing something wrong but I don't know what that would be. Can anyone else replicate this issue?

Missing return checkbox instance in set_checked or set_visible

From example:

STATE

It is possible to set the state of a checkbox. This is good for setting the initial state of the checkbox:

update_checkbox(gooey.checkbox("checkbox/bg").set_checked(true))
update_checkbox(gooey.checkbox("checkbox/bg").set_visible(false))

but is not available right now. We should return instance to make it work.

It seems we should modify core.instance method:

for name,fn in pairs(functions or {}) do
	data[name] = function(...)
		fn(data, ...)
		+++
		return data
		+++
	end
end

Lists are not updated on list refresh since 10.0.0

Hello!

So in 9.1.4 everything work as expected, but from 10.0.0 it looks like the dynamic lists are not updating list elements according to refresh function. First observation is that list.pressed_now / over_item_now / over_item are always false, regardless if I really point at the node. Tested on examples provided with Gooey. I see there were some breaking changes in 10.0.0, but can't correlate quickly as of now.

dynamic list reports list.scroll as 0 on init

The dynamic list component is initialized with an empty vector3 and only updated on scrolling. Using the dynamic list scroll value to update a scrollbar makes it be "bottomed out".

Dynamic lists shows odd behaviour when screen have been resized

The bottom of the scroll list looks like this when not resizing
Screen Shot 2019-05-15 at 11 36 30

But if I resize the screen with defos.set_window_size(0, 0, 570, 1224) (from 720, 1280) it looks like this instead
Screen Shot 2019-05-15 at 11 36 05

Quite a lot of padding is added and a extra item can be seen. The data is nil (but it get's set even though I check for nil before doing gui.set_text().

The stencil node have Adjustment Mode: Stretch and Y Anchor: Top

List data

Hej! Is dynamic list data dynamic? Can I add items to the list dynamically? Or do I need to set the number of list elements once and then I cannot change it? :)

Example for eloquently handling input consumption

I'm looking at the examples, kenneyblue to be specific.
on_input contains all the theme specific updates for the buttons, checkboxes etc.
Looking at the theme's file's specific fucntions, the M.button returns the gooey.button call.

I'm adopting this style into a theme of my own, where I have a custom type of buttons. When pressing on (pressed_now == true) and fully qualified 'clicks' I want to consume the input.
Reason being that I want interaction on my buttons to take priority and not allow my game area to react to that input. Only on 'accidental' interactions, like releasing on top of the button but not having done the initial press - a non fully qualified click so to say.

My initial thought was to - inside the gui_scripts on_input- save a boolean result for all calls to the theme button function. Then check if any of those were true to know whether or not input should be consumed or not.

At this point I'm thinking I might be doing things wrong, it seems a bit unwieldy. Is there a recommended way for handling input consumption with gooey?

General UI wishlist

Here's a wishlist I made for another UI project but some may be useful for this one too.

  • need to disable hover / input on other UI while touch click is held down start on another - take/releas focus
  • holding down input while moving around over a button should not make its image state change like it currently does
  • color picker
  • circular progress bar
  • alerts
  • modal popup
  • knobs
  • progress bar
  • option list
  • rgb slider
  • infinite loop scroller
  • toolbar
  • tab bar
  • tooltips
  • scrollbars
  • audio volume slider
  • notched slider (snap to notches)
  • momentum / friction / drag and click threshold for scrollers
  • accelerated backspace not relying on game.project input repeat?
  • clicking into text boxes to change pointer
  • selecting areas of text box with click drag or holding shift plus arrow keys
  • panels within panels

Scroll list flick

Implement the ability to "flick" scroll list. After a fast swipe the list should keep its momentum

Missed backspaces on iOS

On iOS devices I get missed backspace presses in input fields, as the ones on the examples.

If I type "123" using the on-screen keyboard then click backspace two times the resulting text can be either "1", "12" or "123".

Devices: iPad 2018 and iPhone 8
OS: iOS 14.4
Browsers: Safari and Chrome

Not detecting a reload in Defold 1.2.151

I face to problem that it could not detect a reload in core.instance function.
You can reproduce the problem by scene reloading in example project.

I think it is because __dm_script_instance__ has been removed in Defold 1.2.151.
ref: Defold Forum

-- detect a reload (unload and load cycle) and start with an
-- empty instance
-- if the script instance has changed then we're certain that
-- it's reloaded
local script_instance = _G.__dm_script_instance__
if instance and instance.__script ~= script_instance then
instances[key] = nil
end

Currently, I added temporary reset function in my local and call this for detecting a reload of gui script.

Softcrash when using the gooey.vertical_scrollbar with gooey.dynamic_list

Happens when you do gooey.dynamic_list(...) before gooey.vertical_scrollbar(...) in on_input(..) or init(...) (as if you use update_list(gooey.dynamic_list(...)) on init(...))

dynamic_list will call update_list before gooey.vertical_scrollbar(...) so action will always have been nil.

Workaround is to pass the expected variables in init(...) before update_list like gooey.vertical_scrollbar("scrollbar/handle", "scrollbar/bar", nil, {x=0, y=0})

Trying to erase none utf8 characters throw errors

Easily reproduced with a emoji such as 😄 while typing on a phone.

@britzl How do you think we should handle this?

ERROR:SCRIPT: /gooey/internal/utf8.lua:128: Invalid UTF-8 character
stack traceback:
	[C]: in function 'error'
	/gooey/internal/utf8.lua:128: in function 'utf8charbytes'
	/gooey/internal/utf8.lua:190: in function 'utf8len'
	/gooey/internal/utf8.lua:207: in function 'sub'
	/gooey/internal/input.lua:168: in function 'input'
	/gooey/gooey.lua:162: in function 'input'
	/screens/change_pokemon/edit/edit.gui_script:150: in function </screens/change_pokemon/edit/edit.gui_script:146>

Bug: If dynamic list becomes empty, items have invalid data attached

Because of this early bail:

	-- bail early if the list is empty
	if list.data_size == 0 then
		if refresh_fn then refresh_fn(list) end
		return list
	end

...

	update_dynamic_listitem_data(list)

When the list had items but then became empty, item.data for items that previously had data stays what it was before.

How can I change the theme ?

Hi,

I have a working project using gooey GUI with a single button.

I would like to use the gooey-dirtylarry theme for example. I added the following dependencies in my game.project file :

https://github.com/britzl/gooey/archive/master.zip 
https://github.com/britzl/gooey-dirtylarry/archive/main.zip

So, if I replaced the line :

local gooey = require "gooey.gooey"

by this line :

local gooey = require "gooey.themes.dirtylarry.dirtylarry"

(because my assumption is : this is the same interface for acquire_input and button functions between the genuine gooey interface and the dirtylarry gooey theme interface...)

when I execute my code, I got this error :

/example/menu.gui_script
	The file '/gooey/themes/dirtylarry/dirtylarry.lua' could not be found.

What is my mistake ?
Thanks for your help...

Text limit for input box

Limit number of characters for input boxes.

At function M.input(node_id, keyboard_type, action_id, action) add additional optional parameter like

function M.input(node_id, keyboard_type, action_id, action, max_text_width)

and then in code just check if this parameter is set, don't add new characters to string

No typing input from Android browsers

I'm not getting any keyboard showing up when clicking the text input fields on the Gooey demo.
If I go to the home screen and back to the browser with the text field already selected, the keyboard will pop up but the text field doesn't respond to any typing. Could it be that some android update has broken something?

Device: Galaxy S10E
OS: Android 11
Browser: Chrome and Firefox
Keyboard: Samsung default and Microsoft Swiftkey

Themes: defold-dark, gooey

Making a note here for a todo for me to make these themes. defold-dark replicate the general look of editor 2's colors and style, gooey to be a theme which looks appropriate fit in theme for the gooey logo.

Bug: text:gmatch instead of text:gfind?

Hi Britzl,

it seems, there is a bug in Gooey:

In master/gooey/internal/input.lua, line 37, you use:

function M.utf8_gfind(text)
return text:gfind("([%z\1-\127\194-\244][\128-\191]*)")
end

That seems to be deprecated and causes an error.
I assume, it should be replaced by:

function M.utf8_gfind(text)
return text:gmatch("([%z\1-\127\194-\244][\128-\191]*)")
end

Regards,
Lutz

Add function to set text on text node

Setting the text using gui.set_text() will be replaced the next time the input field is updated. Perhaps detect when gui.set_text() has been done?

Non-native feel on backspace on inputs, Android

My Galaxy S7 is on Android 7.0.
Trying the example project in the repo, using kenneyblue, and testing the input.

When focusing on the input text, my phone's keyboard pops up. Writing text works fine. When pressing the backspace button on the keyboard, I have to hold it down to make it remove characters. A single tap on backspace does not register "long enough" for it to remove any text.

Reproduce:

  • Android phone
  • Focus on text field, write something
  • Tap backspace button on keyboard

Expected:

  • Single character removed

Actual:

  • Nothing removed (unless continuously holding down button)

.nodes failing on list items in dynamic_list

Have a new interesting error, i use a gooey dynamic_list with x number of item rows in it, i want to find out on what element inside one list item i have clicked on, for example a delete button, so i use

if gui.pick_node(list.items[list.selected_item].nodes[hash(“giftitem/delete_btn”)], action.x, action.y)

inside the gooey dynamic_list function, and it works fine for item 1 to 9, but number 10 and above fails, and it looks like it is the .nodes that doesnt work when i debug printed out them like you se in the picture here

i made an example based on the gooey example project, and maybe the errors are coming as soon as i scroll the list and try to click on an scene object in one list item. So in the project i include it looks like it start failing on item nr 6

gooey-list_error.zip

Input widget's "deselected_now" property always false

local function input_callback(input)
	if input.pressed_now then
		gui.set_color(input.node, dcolors.palette.c2)
	elseif input.deselected_now then
		gui.set_color(input.node, dcolors.palette.c3)
	end
end

Input widget's input.deselected_now property is always false. Tested by selecting the widget, entering text, then deselecting the widget. Input bindings match Gooey's expectations correctly.

On line 136 of /gooey/internal/input.lua, local deselected_now = false is never referenced again, so it is never changed to true.

Input text issues

Reported by forum user Febuse:

There are a few bugs in the gooey kenney implementation: go in kenney mode, write some text, select something in the list and a radio button, mark the checkbox, hit back, enter kenney mode again, it looks like it was unchanged, move mouse, everything reverts to how you left it. The textfield also seems to only trigger from the middle and on mobile browser it needs 2 clicks on the textfield: one to make blinking cursor and one to show the keyboard. After that the keyboard needs to be manually closed even if the focus would no longer be on the textfield (click button).

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.