|
7 | 7 | <div class="g-core-image-corp-container" v-bind:id="'vciu-modal-' + formID" v-show="hasImage">
|
8 | 8 | <crop ref="cropBox" :is-resize="resize && !crop" :ratio="cropRatio"></crop>
|
9 | 9 | <div class="info-aside">
|
| 10 | + <p class="btn-groups rotate-groups" v-if="crop"> |
| 11 | + <button type="button" v-on:click="doRotate" class="btn btn-rotate">↺</button> |
| 12 | + <button type="button" v-on:click="doReverseRotate" class="btn btn-reverserotate">↻</button> |
| 13 | + </p> |
10 | 14 | <p class="btn-groups" v-if="crop">
|
11 | 15 | <button type="button" v-on:click="doCrop" class="btn btn-upload">{{cropBtn.ok}}</button>
|
12 | 16 | <button type="button" v-on:click="cancel" class="btn btn-cancel">{{cropBtn.cancel}}</button>
|
|
133 | 137 | const cropBox = this.$refs.cropBox;
|
134 | 138 | pic.onload= function() {
|
135 | 139 | self.image.minProgress = self.minWidth / pic.naturalWidth;
|
136 |
| - self.imgChangeRatio = cropBox.setImage(src, pic.naturalWidth, pic.naturalHeight); |
| 140 | + canvasHelper.init(src, (src) => { |
| 141 | + self.imgChangeRatio = cropBox.setImage(src, pic.naturalWidth, pic.naturalHeight); |
| 142 | + }); |
137 | 143 | }
|
138 | 144 | },
|
139 | 145 |
|
|
142 | 148 | cropBox.resizeImage(progress);
|
143 | 149 | },
|
144 | 150 |
|
| 151 | + doRotate(e) { |
| 152 | + let self = this; |
| 153 | + const cropBox = this.$refs.cropBox; |
| 154 | + const targetImage = cropBox.getCropImage(); |
| 155 | + this.data.comprose = 100 - this.compress; |
| 156 | + return canvasHelper.rotate(targetImage, 1, (src) => { |
| 157 | + self.__initImage(src) |
| 158 | + }) |
| 159 | + }, |
| 160 | +
|
| 161 | + doReverseRotate(e) { |
| 162 | + let self = this; |
| 163 | + const cropBox = this.$refs.cropBox; |
| 164 | + const targetImage = cropBox.getCropImage(); |
| 165 | + this.data.comprose = 100 - this.compress; |
| 166 | + return canvasHelper.rotate(targetImage, -1, (src) => { |
| 167 | + self.__initImage(src) |
| 168 | + }) |
| 169 | + }, |
| 170 | +
|
145 | 171 | doCrop(e) {
|
146 | 172 | this.__setData('crop');
|
147 | 173 | const cropBox = this.$refs.cropBox;
|
|
159 | 185 | },
|
160 | 186 |
|
161 | 187 | doResize(e) {
|
162 |
| - this.__setData('reszie'); |
| 188 | + this.__setData('resize'); |
163 | 189 | const cropBox = this.$refs.cropBox;
|
164 | 190 | const upload = this.__setUpload(e.target);
|
165 | 191 | if (this.resize === 'local') {
|
|
0 commit comments