| | |
| | | |
| | | <!-- 动画按钮 --> |
| | | <view class="controls" v-if="showControls"> |
| | | <uv-button type="primary" :plain="true" text="分辨率" @click="changeRatio()"></uv-button> |
| | | <!-- <uv-button type="primary" :plain="true" text="分辨率" @click="changeRatio()"></uv-button> --> |
| | | <uv-button type="primary" :plain="true" text="颜色" @click="changeColor()"></uv-button> |
| | | <uv-button type="primary" :plain="true" text="左移" @click="shiftLeft()"></uv-button> |
| | | <uv-button type="primary" :plain="true" text="下移" @click="shiftDown()"></uv-button> |
| | | <uv-button type="primary" :plain="true" text="右移" @click="shiftRight()"></uv-button> |
| | | <uv-button type="primary" :plain="true" text="文字" @click="addText()"></uv-button> |
| | | <uv-button type="primary" :plain="true" text="清除" @click="clear()"></uv-button> |
| | |
| | | } |
| | | } |
| | | }, |
| | | shiftDown() { |
| | | const colCount = this.width * (this.modeVal == 2 ? 10 : 1) |
| | | const lastRowStart = (this.height - 1) * colCount |
| | | const lastRow = this.pixelData.slice(lastRowStart, lastRowStart + colCount) |
| | | for (let r = this.height - 1; r > 0; r--) { |
| | | const currentStart = r * colCount |
| | | const prevStart = (r - 1) * colCount |
| | | for (let c = 0; c < colCount; c++) { |
| | | this.$set(this.pixelData, currentStart + c, this.pixelData[prevStart + c]) |
| | | } |
| | | } |
| | | for (let c = 0; c < colCount; c++) { |
| | | this.$set(this.pixelData, c, lastRow[c]) |
| | | } |
| | | }, |
| | | toggleControls() { |
| | | this.showControls = !this.showControls; |
| | | }, |