Files
VOREStation/code/_helpers/view.dm
ShadowLarkens 8d97f43bd0 General improvements to Action Buttons (#16488)
* Add screen helpers, reorganize action button files

Separates screen objects from datums in action button files

* Add a mouse drag indicator to movable screen objects and use new helpers

* Fix shift-clicking actions to reset position

* Fix dreamchecker errors
2024-10-17 10:57:53 +02:00

26 lines
802 B
Plaintext

/proc/getviewsize(view)
var/viewX
var/viewY
if(isnum(view))
var/totalviewrange = 1 + 2 * view
viewX = totalviewrange
viewY = totalviewrange
else
var/list/viewrangelist = splittext(view,"x")
viewX = text2num(viewrangelist[1])
viewY = text2num(viewrangelist[2])
return list(viewX, viewY)
/// Takes a string or num view, and converts it to pixel width/height in a list(pixel_width, pixel_height)
/proc/view_to_pixels(view)
if(!view)
return list(0, 0)
var/list/view_info = getviewsize(view)
view_info[1] *= ICON_SIZE_X
view_info[2] *= ICON_SIZE_Y
return view_info
// Used to get `atom/O as obj|mob|turf in view()` to match against strings containing apostrophes immediately after substrings that match to other objects. Somehow. - Ater
/proc/_validate_atom(atom/A)
return view()