WidgetItem

Methods
7
Fields
None

Getting one

WidgetItem.new(…)

Methods

MethodReturnsDescription
getId()numberThe item id.
getQuantity()numberThe quantity.
getWidget()Widget?The widget drawing it.
getCanvasBounds()Rectangle(WidgetItem) -> Rectangle: Where it is drawn, the drag included. The same Rectangle while the item is drawn there (and a new one once a…
getCanvasBounds(boolean)Rectangle?
getDraggingCanvasBounds()Rectangle?Where it is drawn while dragged, nil when it is not: the same Rectangle getCanvasBounds() hands out while it is dragged.
getCanvasLocation()PointThe top-left corner of getCanvasBounds().
new(number, number, Rectangle, Widget?, Rectangle?)WidgetItemA widget item: the item, its quantity, where it is drawn, the widget drawing it, and where it is drawn while dragged (nil when it is not).

Returned by

MethodReturnsDescription
WidgetItemClass.newWidgetItemA widget item: the item, its quantity, where it is drawn, the widget drawing it, and where it is drawn while dragged (nil when it is not).

Method details

getCanvasBounds

getCanvasBounds: ((WidgetItem) -> Rectangle) & ((WidgetItem, boolean) -> Rectangle?)

(WidgetItem) -> Rectangle: Where it is drawn, the drag included. The same Rectangle while the item is drawn there (and a new one once a plugin changed the one it had).

(WidgetItem, boolean) -> Rectangle?: Where it is drawn: while dragged (nil when it is not) or not. The same Rectangle getCanvasBounds() hands out for those bounds.

new

new: (number, number, Rectangle, Widget?, Rectangle?) -> WidgetItem

A widget item: the item, its quantity, where it is drawn, the widget drawing it, and where it is drawn while dragged (nil when it is not).