add event bandaid to slider and remove logging
This commit is contained in:
parent
3aab658b1e
commit
8cf53ab325
2 changed files with 2 additions and 4 deletions
|
|
@ -36,21 +36,17 @@ class UiCompass{
|
|||
Control.set_process(compass){|control, state, event, x,y,w,h|
|
||||
if(event.control != control) return
|
||||
|
||||
System.print("event: %(event) - currently captured: %(UI.get_captured(ent))")
|
||||
|
||||
if(event.type == UIEvent.press){
|
||||
var relative_pos = AABB.new(x, y, w, h).relative_pos([event.x, event.y])
|
||||
var inside = M.length(relative_pos.map{|comp| comp - 0.5}) < 0.5
|
||||
if(inside) {
|
||||
state["pressed"] = true
|
||||
UI.capture(control)
|
||||
System.print("CAPTURE COMPASS")
|
||||
}
|
||||
}
|
||||
if(event.type == UIEvent.release){
|
||||
state["pressed"] = false
|
||||
UI.uncapture(control)
|
||||
System.print("UNCAPTURE COMPASS")
|
||||
}
|
||||
if((event.type == UIEvent.move || event.type == UIEvent.press) && state["pressed"]){
|
||||
var center = [x + w/2, y + h/2]
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import "globals" for Globals
|
|||
import "math/rect" for AABB
|
||||
import "math/math" for M
|
||||
import "blocks/debug" for DrawDebug
|
||||
import "math/util" for Util
|
||||
|
||||
class UiSlider{
|
||||
static horizontal{"horiz"}
|
||||
|
|
@ -50,6 +51,7 @@ class UiSlider{
|
|||
}
|
||||
Control.set_process(slider){|control, state, event, x,y,w,h|
|
||||
if(event.control != control) return
|
||||
if(!Util.valid_event(event)) return
|
||||
if(event.type == UIEvent.press){
|
||||
state["pressed"] = true
|
||||
UI.capture(control)
|
||||
|
|
|
|||
Loading…
Reference in a new issue