mirror of
https://github.com/huderlem/porymap.git
synced 2026-11-10 19:08:22 -06:00
Update onMapResized
This commit is contained in:
@@ -268,14 +268,13 @@ void Scripting::cb_LayoutOpened(QString layoutName) {
|
||||
instance->invokeCallback(OnLayoutOpened, args);
|
||||
}
|
||||
|
||||
void Scripting::cb_MapResized(int oldWidth, int oldHeight, int newWidth, int newHeight) {
|
||||
void Scripting::cb_MapResized(int oldWidth, int oldHeight, const QMargins &delta) {
|
||||
if (!instance) return;
|
||||
|
||||
QJSValueList args {
|
||||
oldWidth,
|
||||
oldHeight,
|
||||
newWidth,
|
||||
newHeight,
|
||||
Scripting::margins(delta),
|
||||
};
|
||||
instance->invokeCallback(OnMapResized, args);
|
||||
}
|
||||
@@ -356,6 +355,15 @@ QJSValue Scripting::dimensions(int width, int height) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
QJSValue Scripting::margins(const QMargins &margins) {
|
||||
QJSValue obj = instance->engine->newObject();
|
||||
obj.setProperty("left", margins.left());
|
||||
obj.setProperty("right", margins.right());
|
||||
obj.setProperty("top", margins.top());
|
||||
obj.setProperty("bottom", margins.bottom());
|
||||
return obj;
|
||||
}
|
||||
|
||||
QJSValue Scripting::position(int x, int y) {
|
||||
QJSValue obj = instance->engine->newObject();
|
||||
obj.setProperty("x", x);
|
||||
|
||||
Reference in New Issue
Block a user