Add setScale to the API
This commit is contained in:
parent
936ac56a7f
commit
3770efd6c5
6 changed files with 37 additions and 1 deletions
|
@ -7,7 +7,8 @@ and this project somewhat adheres to [Semantic Versioning](https://semver.org/sp
|
|||
The **"Breaking Changes"** listed below are changes that have been made in the decompilation projects (e.g. pokeemerald), which porymap requires in order to work properly. It also includes changes to the scripting API that may change the behavior of existing porymap scripts. If porymap is used with a project or API script that is not up-to-date with the breaking changes, then porymap will likely break or behave improperly.
|
||||
|
||||
## [Unreleased]
|
||||
Nothing, yet.
|
||||
### Added
|
||||
- Add `setScale` to the scripting API.
|
||||
|
||||
## [5.0.0] - 2022-10-30
|
||||
### Breaking Changes
|
||||
|
|
|
@ -1034,6 +1034,21 @@ All overlay functions are callable via the global ``overlay`` object.
|
|||
|
||||
:param number scale: the scale to set
|
||||
|
||||
.. js:function:: overlay.setScale(hScale, vScale, layer)
|
||||
|
||||
Sets the horizontal and vertical scale of the specified overlay layer. ``1.0`` is normal size.
|
||||
|
||||
:param number hScale: the horizontal scale to set
|
||||
:param number vScale: the vertical scale to set
|
||||
:param number layer: the layer id
|
||||
|
||||
.. js:function:: overlay.setScale(hScale, vScale)
|
||||
|
||||
This is an overloaded function. Sets the horizontal and vertical scale of all active overlay layers. Layers that have not been used yet will not have their scale changed. ``1.0`` is normal size.
|
||||
|
||||
:param number hScale: the horizontal scale to set
|
||||
:param number vScale: the vertical scale to set
|
||||
|
||||
.. js:function:: overlay.getRotation(layer = 0)
|
||||
|
||||
Gets the angle the specified overlay layer is rotated to.
|
||||
|
|
|
@ -50,6 +50,8 @@ public:
|
|||
Q_INVOKABLE void setHorizontalScale(qreal scale);
|
||||
Q_INVOKABLE void setVerticalScale(qreal scale, int layer);
|
||||
Q_INVOKABLE void setVerticalScale(qreal scale);
|
||||
Q_INVOKABLE void setScale(qreal hScale, qreal vScale, int layer);
|
||||
Q_INVOKABLE void setScale(qreal hScale, qreal vScale);
|
||||
Q_INVOKABLE int getRotation(int layer = 0);
|
||||
Q_INVOKABLE void setRotation(int angle, int layer);
|
||||
Q_INVOKABLE void setRotation(int angle);
|
||||
|
|
|
@ -93,6 +93,7 @@ public:
|
|||
qreal getVScale();
|
||||
void setHScale(qreal scale);
|
||||
void setVScale(qreal scale);
|
||||
void setScale(qreal hScale, qreal vScale);
|
||||
int getRotation();
|
||||
void setRotation(int angle);
|
||||
void rotate(int degrees);
|
||||
|
|
|
@ -179,6 +179,18 @@ void MapView::setVerticalScale(qreal scale) {
|
|||
this->scene()->update();
|
||||
}
|
||||
|
||||
void MapView::setScale(qreal hScale, qreal vScale, int layer) {
|
||||
this->getOverlay(layer)->setScale(hScale, vScale);
|
||||
this->scene()->update();
|
||||
}
|
||||
|
||||
// Overload. No layer provided, set scale of all layers
|
||||
void MapView::setScale(qreal hScale, qreal vScale) {
|
||||
foreach (Overlay * layer, this->overlayMap)
|
||||
layer->setScale(hScale, vScale);
|
||||
this->scene()->update();
|
||||
}
|
||||
|
||||
int MapView::getRotation(int layer) {
|
||||
return this->getOverlay(layer)->getRotation();
|
||||
}
|
||||
|
|
|
@ -106,6 +106,11 @@ void Overlay::setVScale(qreal scale) {
|
|||
this->vScale = scale;
|
||||
}
|
||||
|
||||
void Overlay::setScale(qreal hScale, qreal vScale) {
|
||||
this->hScale = hScale;
|
||||
this->vScale = vScale;
|
||||
}
|
||||
|
||||
int Overlay::getRotation() {
|
||||
return this->angle;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue