Compare commits

..

No commits in common. "a82eddab7561f6757b0ea1ab0e0e54a8cb48c047" and "68cff74b1f8f43cbb50a866c4f4c67ca85db4866" have entirely different histories.

2 changed files with 6 additions and 48 deletions

View File

@ -1,6 +1,3 @@
local shared = require("tevgit:core/teverseUI/shared.lua")
local draggableUi = shared.draggableUi
local container = teverse.construct("guiFrame", {
parent = teverse.coreInterface,
size = guiCoord(0.1, 150, 0.4, 200),
@ -12,22 +9,19 @@ local container = teverse.construct("guiFrame", {
visible = false
})
local top = teverse.construct("guiTextBox", {
teverse.construct("guiTextBox", {
parent = container,
size = guiCoord(1, 0, 0, 20),
position = guiCoord(0, 0, 0, 0),
backgroundAlpha = 0.5,
size = guiCoord(1, -10, 0, 20),
position = guiCoord(0, 5, 0, 0),
backgroundAlpha = 0.0,
textSize = 20,
textAlign = "middleLeft",
-- bit hacky but works for slight indent
text = " Console",
backgroundColour = colour.rgb(112, 112, 112)
text = "Console"
})
local logContainer = teverse.construct("guiScrollView", {
parent = container,
size = guiCoord(1, -10, 1, -27),
size = guiCoord(1, -10, 1, -22),
position = guiCoord(0, 5, 0, 20),
backgroundAlpha = 0.0,
canvasSize = guiCoord(1, -1, 10, 0),
@ -35,8 +29,6 @@ local logContainer = teverse.construct("guiScrollView", {
scrollbarRadius = 2
})
draggableUi(container, top)
local lastPos = 0
function addLog (msg, time)
local txt = teverse.construct("guiTextBox", {
@ -76,5 +68,4 @@ else
end
return container

View File

@ -1,33 +0,0 @@
function draggableUi (uiToMove, activator)
local mouseIsDown = false
if not uiToMove then
return error("Failed to create draggableUi: No UI provided!")
end
if not activator then
activator = uiToMove
end
local evA = activator:on("mouseLeftDown", function( mousePos )
mouseIsDown = true
local startPos = uiToMove.position:get2D(teverse.input.screenSize)
local offset = teverse.input.mousePosition - startPos
spawn(function ()
while mouseIsDown do
-- Calculate new position relative to the mouse pointer
local mousePos = teverse.input.mousePosition
local targetPos = mousePos - offset
uiToMove.position = guiCoord(0, targetPos.x, 0, targetPos.y)
sleep()
end
end)
end)
local evB = teverse.input:on("mouseLeftUp", function( mousePosition )
mouseIsDown = false
end)
end
return {
draggableUi = draggableUi
}