Merge template-live-editor-mobile
This commit is contained in:
commit
fa355e55d3
3
edit.lua
3
edit.lua
|
@ -27,8 +27,7 @@ function edit.initialize_state(top, bottom, left, right, font, font_height, line
|
|||
|
||||
-- rendering wrapped text lines needs some additional short-lived data per line:
|
||||
-- startpos, the index of data the line starts rendering from, can only be >1 for topmost line on screen
|
||||
-- fragments: snippets of the line guaranteed to not straddle screen lines
|
||||
-- screen_line_starting_pos: optional array of grapheme indices if it wraps over more than one screen line
|
||||
-- screen_line_starting_pos: optional array of codepoint indices if it wraps over more than one screen line
|
||||
-- start_screen_line_index: a count of the number of screen lines above this line
|
||||
line_cache = {},
|
||||
|
||||
|
|
14
reference.md
14
reference.md
|
@ -48,7 +48,7 @@ two categories.
|
|||
* `on.resize(w,h)` -- called when you resize the app window. Provides new
|
||||
window dimensions in `w` and `h`. Don't bother updating `App.screen.width`
|
||||
and `App.screen.height`, that will happen automatically before calling
|
||||
`App.resize`.
|
||||
`on.resize`.
|
||||
(Based on [LÖVE](https://love2d.org/wiki/love.resize))
|
||||
|
||||
* `on.code_change()` -- called when you make changes to the app using
|
||||
|
@ -120,7 +120,7 @@ two categories.
|
|||
|
||||
* `on.text_input(t)` -- called when you press a key combination that yields
|
||||
(roughly) a printable character. For example, `shift` and `a` pressed
|
||||
together will call `App.textinput` with `A`.
|
||||
together will call `on.textinput` with `A`.
|
||||
(Based on [LÖVE](https://love2d.org/wiki/love.textinput).)
|
||||
|
||||
* `on.key_release(key)` -- called when you press a key on the keyboard.
|
||||
|
@ -295,9 +295,9 @@ clicked. It requires setting up 3 things:
|
|||
- a `state` table housing all buttons. Can be the same `state` variable the
|
||||
text-editor widget uses, but doesn't have to be.
|
||||
- specifying buttons to create in `state`. This must happen either directly
|
||||
or indirectly within `App.draw`.
|
||||
or indirectly within `on.draw`.
|
||||
- responding to clicks on buttons in `state`. This must happen either
|
||||
directly or indirectly within `App.mousepressed`.
|
||||
directly or indirectly within `on.mouse_press`.
|
||||
|
||||
The following facilities help set these things up:
|
||||
|
||||
|
@ -318,7 +318,7 @@ The following facilities help set these things up:
|
|||
})
|
||||
```
|
||||
|
||||
Call this either directly or indirectly from `App.draw`. It will assign a
|
||||
Call this either directly or indirectly from `on.draw`. It will assign a
|
||||
rectangle with the given dimensions and trigger the provided (zero-arg)
|
||||
`onpress1` callback when the primary mouse button is clicked within.
|
||||
It will also optionally paint the rectangle with the specified background
|
||||
|
@ -330,7 +330,7 @@ The following facilities help set these things up:
|
|||
|
||||
* `mouse_press_consumed_by_any_button(state, x,y, mouse_button)`
|
||||
|
||||
Call this either directly or indirectly from `App.mousepressed`. It will
|
||||
Call this either directly or indirectly from `on.mouse_press`. It will
|
||||
pass on a click to any button registered in `state`. It's also helpful to
|
||||
ensure clicks on a button don't have other effects, so I prefer the
|
||||
following boilerplate early in `mousepressed`:
|
||||
|
@ -348,7 +348,7 @@ The following facilities help set these things up:
|
|||
(Based on [LÖVE](https://love2d.org/wiki/love.mouse.setPosition).)
|
||||
|
||||
* `App.mouse_down(mouse_button)` -- returns `true` if the button
|
||||
`mouse_button` is pressed. See `App.mousepressed` for `mouse_button` codes.
|
||||
`mouse_button` is pressed. See `on.mouse_press` for `mouse_button` codes.
|
||||
(Based on [LÖVE](https://love2d.org/wiki/love.mouse.isDown).)
|
||||
|
||||
* `App.mouse_x()` -- returns the x coordinate of the current position of the
|
||||
|
|
Loading…
Reference in New Issue