add scale to each image in Images components

This commit is contained in:
2022-07-05 00:14:17 +00:00
parent d51940f1fc
commit 0d0f7b01d5
6 changed files with 68 additions and 19 deletions

View File

@@ -8,18 +8,17 @@
&prop :ArchiveController controller]
[&mut :Bool selected false]
(super position.x position.y)
(if (hasComponent e Images)
(let [images (readComponent e Images)]
(if (hasComponent e Images2)
(let [images (readComponent e Images2)]
(.onComplete (BitmapData.loadFromFile (joinPath archive.archiveDir "files" (nth images.imageFiles images.pinnedImageIndex)))
->bitmapData {
(loadGraphic bitmapData)
}))
(set pixels .pixels (new FlxText 0 0 0 (readComponent e Name) PlayState.TEXT_SIZE)))
(set pixels .pixels (new FlxText 0 0 0 (readComponent e Name) PlayState.TEXT_SIZE)))
(updateColor)
(when (hasComponent e Scale)
(let [:Float scale (readComponent e Scale)]
(this.scale.set scale scale)
(updateHitbox)))
(let [:Float scale (getScale e)]
(this.scale.set scale scale)
(updateHitbox))
(enableMouseClicks false)
(enableMouseDrag)
(set mouseStartDragCallback