mirror of
https://github.com/TangentFoxy/Pop.Box.git
synced 2024-12-15 12:44:20 +00:00
#39 repaired
This commit is contained in:
parent
c9df709c80
commit
048e8c7961
@ -325,6 +325,7 @@ do
|
||||
self.header.mousereleased = function(self, x, y, button)
|
||||
if button == pop.constants.left_mouse then
|
||||
selected = false
|
||||
pop.focused = false
|
||||
return true
|
||||
end
|
||||
return false
|
||||
|
@ -152,6 +152,7 @@ class window extends element
|
||||
@header.mousereleased = (x, y, button) =>
|
||||
if button == pop.constants.left_mouse
|
||||
selected = false
|
||||
pop.focused = false -- maybe it should check if it is focused first?
|
||||
return true
|
||||
return false
|
||||
|
||||
|
5
init.lua
5
init.lua
@ -300,7 +300,9 @@ pop.mousereleased = function(x, y, button, element)
|
||||
end
|
||||
else
|
||||
log("mousereleased", x, y, button)
|
||||
if element == pop.focused then
|
||||
do
|
||||
element = pop.focused
|
||||
if element then
|
||||
if element.data.draw and (x >= element.data.x) and (x <= element.data.x + element.data.w) and (y >= element.data.y) and (y <= element.data.y + element.data.h) then
|
||||
if element.clicked then
|
||||
clickedHandled = element:clicked(x - element.data.x, y - element.data.y, button)
|
||||
@ -313,6 +315,7 @@ pop.mousereleased = function(x, y, button, element)
|
||||
return clickedHandled, mousereleasedHandled
|
||||
end
|
||||
end
|
||||
end
|
||||
pop.mousereleased(x, y, button, pop.screen)
|
||||
end
|
||||
return clickedHandled, mousereleasedHandled
|
||||
|
@ -374,7 +374,7 @@ pop.mousereleased = (x, y, button, element) ->
|
||||
if element.mousereleased
|
||||
mousereleasedHandled = element\mousereleased x - element.data.x, y - element.data.y, button
|
||||
|
||||
-- if we clicked, we're focused!
|
||||
-- if we clicked (AND returned true), we're focused!
|
||||
if clickedHandled != false
|
||||
log " #{clickedHandled} (click handled)", "#{element} (#{element.data.type})"
|
||||
if clickedHandled
|
||||
@ -393,7 +393,7 @@ pop.mousereleased = (x, y, button, element) ->
|
||||
else
|
||||
log "mousereleased", x, y, button
|
||||
|
||||
if element == pop.focused
|
||||
if element = pop.focused
|
||||
if element.data.draw and (x >= element.data.x) and (x <= element.data.x + element.data.w) and (y >= element.data.y) and (y <= element.data.y + element.data.h)
|
||||
if element.clicked
|
||||
clickedHandled = element\clicked x - element.data.x, y - element.data.y, button
|
||||
|
14
main.lua
14
main.lua
@ -51,7 +51,9 @@ love.load = function()
|
||||
h = 10
|
||||
}):align("center", "bottom")
|
||||
pop.text(centerBox, "Align me!"):align("right", "top")
|
||||
pop.window(centerBox):align("right", "bottom")
|
||||
pop.window(centerBox, {
|
||||
closeable = true
|
||||
}):align("right", "bottom")
|
||||
centerBox:setPadding(5)
|
||||
pop.box(centerBox, {
|
||||
w = 10,
|
||||
@ -119,7 +121,7 @@ love.load = function()
|
||||
100
|
||||
}
|
||||
}, "Align me!"):align("right", "top")
|
||||
return pop.window(centerBox, {
|
||||
pop.window(centerBox, {
|
||||
titleColor = {
|
||||
0,
|
||||
0,
|
||||
@ -139,6 +141,14 @@ love.load = function()
|
||||
100
|
||||
}
|
||||
}):align("right", "bottom")
|
||||
pop.window(centerBox, {
|
||||
containMethod = "title",
|
||||
w = 125
|
||||
}, "Title can't leave")
|
||||
return pop.window(centerBox, {
|
||||
containMethod = "body",
|
||||
w = 125
|
||||
}, "Body can't leave")
|
||||
end
|
||||
local new_method
|
||||
new_method = function()
|
||||
|
@ -24,7 +24,7 @@ love.load = ->
|
||||
pop.box(centerBox)\align("left", "bottom")\setSize 5, 5
|
||||
pop.box(centerBox, {w: 25, h: 10})\align "center", "bottom"
|
||||
pop.text(centerBox, "Align me!")\align "right", "top"
|
||||
pop.window(centerBox)\align "right", "bottom"
|
||||
pop.window(centerBox, {closeable: true})\align "right", "bottom"
|
||||
|
||||
centerBox\setPadding 5
|
||||
|
||||
@ -36,6 +36,8 @@ love.load = ->
|
||||
pop.box(centerBox, {w: 25, h: 10, background: {0, 0, 255, 100}})\align "center", "bottom"
|
||||
pop.text(centerBox, {color: {0, 0, 255, 100}}, "Align me!")\align "right", "top"
|
||||
pop.window(centerBox, {titleColor: {0, 0, 0, 150}, titleBackground: {0, 0, 255, 100}, windowBackground: {200, 200, 255, 100}})\align "right", "bottom"
|
||||
pop.window(centerBox, {containMethod: "title", w: 125}, "Title can't leave")
|
||||
pop.window(centerBox, {containMethod: "body", w: 125}, "Body can't leave")
|
||||
|
||||
new_method = ->
|
||||
partsGrid = pop.dynamicGrid!
|
||||
|
Loading…
Reference in New Issue
Block a user