mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
Fix circular offset
This commit is contained in:
parent
9d74a01f04
commit
bce96b0c4a
2 changed files with 12 additions and 2 deletions
|
|
@ -33,6 +33,16 @@ function (Parent, Settings, nc, Layer) {
|
|||
nc.trigger(nc.ns.client.view.mesh.add, self.layerId, mesh);
|
||||
}
|
||||
|
||||
// Determine pivot point based on item type
|
||||
var pivotY;
|
||||
if (this.options.type === "circle") {
|
||||
// For circular items, center the pivot
|
||||
pivotY = this.options.height / 2;
|
||||
} else {
|
||||
// For rectangular items, pivot at bottom center
|
||||
pivotY = this.options.height;
|
||||
}
|
||||
|
||||
nc.trigger(nc.ns.client.view.mesh.create,
|
||||
this.layerId,
|
||||
texturePath,
|
||||
|
|
@ -42,7 +52,7 @@ function (Parent, Settings, nc, Layer) {
|
|||
height: this.options.height,
|
||||
pivot: {
|
||||
x: this.options.width / 2,
|
||||
y: this.options.height
|
||||
y: pivotY
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue