ORIGIN , set custom anchor picture .

HI
I had asked the question as long time ago but was answer me, to found another way, photoshop, because it was complicated.
However, I am falling on this function.
Is there a reason for she not takings the arrays?
Is this the right way to do it?

I do not know the reason well, but it must be very good.
Why not allow to choose the Origin anchor.x, and anchor.y ?
Code:
Sprite_Picture.prototype.updateOrigin = function() {
    var picture = this.picture();
    if (picture.origin() === 0) {
        this.anchor.x = 0;
        this.anchor.y = 0;
    } else {
        this.anchor.x = 0.5;
        this.anchor.y = 0.5;
    }
};
Is this change the right way to do it?
Or will it cause me some performance or other issues?

Code:
Sprite_Picture.prototype.updateOrigin = function() {
    var picture = this.picture();
    var o = picture.origin();
    if (o  === 0) {
        this.anchor.x = 0;
        this.anchor.y = 0;
    } else if(o === 1) {
        this.anchor.x = 0.5;
        this.anchor.y = 0.5;
    }else {
        this.anchor.x = o[0];
        this.anchor.y = o[1];
    }
};
and for example
// $gameScreen.showPicture(500, 'filename', [0,0.5], 0, 0, 100, 100, 255, 0);
make the origin left,middle !


thanks a lot for suggest and answer
Yes, overwriting the updateOrigin function of Sprite_Picture would allow you to do this. There shouldn't be any performance issue: I don't think Javascript cares much whether a variable receives an integer or an array as long as the function it's passed to can handle whatever it's doing with it.
Spoiler
Yes, overwriting the updateOrigin function of Sprite_Picture would allow you to do this. There shouldn't be any performance issue: I don't think Javascript cares much whether a variable receives an integer or an array as long as the function it's passed to can handle whatever it's doing with it.
Ok, I was wondering, because seeing all the creative interest that this simple line brought, I thought there was necessarily a reason for the dev not to add them.
giphy.gif
I think it was simply a matter of them deciding that "top left" and "center" were the only origin options most developers would need. I can't think of many situations where you would need the origin of a picture to be anything else, but it can be easily coded in for those who want that.
I just tried your plugin and it does in fact take the array.

The only thing I can think of that went wrong is you went to center with y and you used Graphics.width instead of Graphics.height for y position or something.
PHP:
$gameScreen.showPicture(1, 'picture', [0, 0.5], 0, Graphics.height / 2, 100, 100, 255, 0);
Spoiler
I just tried your plugin and it does in fact take the array.

The only thing I can think of that went wrong is you went to center with y and you used Graphics.width instead of Graphics.height for y position or something.
PHP:
$gameScreen.showPicture(1, 'picture', [0, 0.5], 0, Graphics.height / 2, 100, 100, 255, 0);
Its work for me .. !

Spoiler
I think it was simply a matter of them deciding that "top left" and "center" were the only origin options most developers would need. I can't think of many situations where you would need the origin of a picture to be anything else, but it can be easily coded in for those who want that.
There is a lot of possibilities, especially in animation, for example, I rework, my menu, which is an interface with pin, that the player fix some pin.
The pin as elastic easing rotation when fixed so i need the right origin for animation in the engine..
the interface are like thas for now.
hud-play.jpg

Original thread: https://forums.rpgmakerweb.com/threads/origin-set-custom-anchor-picture.75266/