Skip to content

Spatial scale scales the whole canvas #3

@davidkovaccs

Description

@davidkovaccs

Right now (in the master branch) if I set a scale != 1 (in a Spatial component) then it scales the whole canvas in every cycle.

I've tried to figure out but I couldn't, however I've found two possible bugs in the spatial component:
In addScale it sais:
this.pos.x -= Math.abs((this.dim.x - (this.dim.x * x)) / 2);
this.pos.y -= Math.abs((this.dim.y - (this.dim.y * y)) / 2);

I think abs is not necessary because if we scale down then we should add to the coordinates, if we scale up we should subtract from the coordinate (If I understand this right and we would like to preserve the center of the component)

getUnscaledDim seems not to do the right thing (it should do the reverse of the addScale but with the unscaled dimensions if I'm correct):
getUnscaledDim:function()
{
this._unscaledDim.x = this.dim.x / this.scaleX;
this._unscaledDim.y = this.dim.y / this.scaleY;
return this._unscaledDim;
},

The problem can be seen here:
http://jbsdev.dyndns.org:2030/projects/gangnam/
If I set 1.0, 1.0 for the scaleX and scaleY in the entityfactory.js then it works well. It behaves differently on smaller and on larger browser windows. Press SPACE to start (clicks are not working in 0.5.6?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions