Also its scrollbar.
Z5M23NTKKGEACSQJT27DRNS7NEK6OSLR2IOWVAH2C2PRAIU46BIQC
TEDSEOCWSHACRYLLQJHAR4ZT6T5FUOQWUWPDI2WIIPHHKCG5OHPAC
A5NQFECKMZBC7XXGYDG3U2ZAOK7PHSZTEOZNDJERMDYG3FJ3SDIAC
WR2WMEPEKNFAB4CAUBVFBACAJJSX2VX5B2VHKKSNTJSJBIIXFVZQC
R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC
IP4LD33DQFWQ4654YPNJRKQ3CNYSHRZPX6U6ZPY7OLE744XX3MEQC
G4TDWMNZWMZNJTVVCUO7OUX5DWMTW2BP5KCCZPWZLJCJLQ7QV5AQC
MZ3DMYPD4LSSQKEA3GNI5MK2QNTJ523DTNG6DUPWEWLH4FLUIQSAC
LBQBZT4I5CMGWZMLANB2ENFHT2Y6BGKYUOZDMULOPDR5X7HNWUBQC
RLZTVQN6FBR2UNPNY7ZCOOTU6PBAKTOUGOJYN6PPAOINZOUHOFQAC
VEAVIL4X64VGFCIKDQQTPGS2NSEX77VTSSZIJQMFH65D3EQMX7UAC
5RUFNRJOK3PXQKJTPDEN5K5PI67MGB25QUA44WOCCH2O5KHXT45QC
ZM7NOBRMD5HHA35Y4JDC76EOA2RD4KQOQCPURXYKXA6ABMKOJIGQC
UEG224LHBOPWSKOVXTKVAUEL47HET566LJF7ZSWVKMMLBSJWUHFAC
Output_editor_state = nil
on_editor_scrollbar_area = function(x,y)
if x < Editor_state.right+15 then return end
if x > Editor_state.right+45 then return end
if y < Editor_state.top then return end
if y > Editor_state.bottom then return end
on_editor_scrollbar_area = function(state, x,y)
if x < state.right+15 then return end
if x > state.right+45 then return end
if y < state.top then return end
if y > state.bottom then return end
on_editor_scrollbar = function(x,y)
if x < Editor_state.right+15 then return end
if x > Editor_state.right+45 then return end
if y < Editor_scrollbar_top then return end
if y > Editor_scrollbar_bottom then return end
on_editor_scrollbar = function(state, x,y)
if x < state.right+15 then return end
if x > state.right+45 then return end
if y < state.scrollbar_top then return end
if y > state.scrollbar_bottom then return end
adjust_scrollbar = function(y)
local s = (y-Editor_state.top) / (Editor_state.bottom-Editor_state.top)
local screen_line = s*Editor_state.screen_line_count
adjust_scrollbar = function(state, y)
local s = (y-state.top) / (state.bottom-state.top)
local screen_line = s*state.screen_line_count
love.graphics.line(Editor_state.right+30, Editor_state.top, Editor_state.right+30, Editor_state.bottom)
love.graphics.line(Editor_state.right+25, Editor_state.top, Editor_state.right+35, Editor_state.top)
love.graphics.line(Editor_state.right+25, Editor_state.bottom, Editor_state.right+35, Editor_state.bottom)
local sbtop, sbbot = compute_scrollbar(Editor_state)
local topy = Editor_state.top + sbtop*(Editor_state.bottom - Editor_state.top)
local boty = Editor_state.top +sbbot*(Editor_state.bottom - Editor_state.top)
love.graphics.line(state.right+30, state.top, state.right+30, state.bottom)
love.graphics.line(state.right+25, state.top, state.right+35, state.top)
love.graphics.line(state.right+25, state.bottom, state.right+35, state.bottom)
local sbtop, sbbot = compute_scrollbar(state)
local topy = state.top + sbtop*(state.bottom - state.top)
local boty = state.top +sbbot*(state.bottom - state.top)
love.graphics.rectangle('fill', Editor_state.right+15, topy+5, 30, math.max(boty-topy-10, 5), 5,5)
Editor_scrollbar_top = topy
Editor_scrollbar_bottom = boty
love.graphics.rectangle('fill', state.right+15, topy+5, 30, math.max(boty-topy-10, 5), 5,5)
state.scrollbar_top = topy
state.scrollbar_bottom = boty
if Editor_scrollbar_drag then
adjust_scrollbar(y)
Editor_scrollbar_drag = nil
elseif on_editor_scrollbar_area(x,y) then
adjust_scrollbar(y)
if Editor_state.scrollbar_drag then
adjust_scrollbar(Editor_state, y)
Editor_state.scrollbar_drag = nil
elseif on_editor_scrollbar_area(Editor_state, x,y) then
adjust_scrollbar(Editor_state, y)