diff --git a/src/components/Player.vue b/src/components/Player.vue index 3242b19..c121505 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -32,6 +32,10 @@ +
+ + +
@@ -55,6 +59,7 @@ export default { fullscreen: false, sortBySize: false, sortDirection: false, + discardPartial: false, position: 0, tmp_ctx: null, animation_id: null, @@ -68,7 +73,8 @@ export default { computed: { frames: function () { if (this.image === null) return 0; - return Math.ceil((this.image.width - this.offset[0]) / this.width) * Math.ceil((this.image.height - this.offset[1]) / this.height); + const roundFn = this.discardPartial ? Math.floor : Math.ceil; + return roundFn((this.image.width - this.offset[0]) / this.width) * roundFn((this.image.height - this.offset[1]) / this.height); }, canvas_height: function () { return this.height * this.zoom; @@ -81,7 +87,7 @@ export default { let sequence = []; for (let pos = 0; pos < this.frames; pos++) { - let wb = Math.ceil((this.image.width - this.offset[0]) / this.width); // width_blocks + let wb = (this.discardPartial ? Math.floor : Math.ceil)((this.image.width - this.offset[0]) / this.width); // width_blocks let x = this.offset[0] + (pos % wb) * this.width; // x offset let w = x + this.width < this.image.width ? this.width : this.image.width - x; // frame width let y = this.offset[1] + Math.floor(pos / wb) * this.height; // y offset