@react-native-ohos/react-native-image-crop-picker 0.50.2-rc.6 → 0.50.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## 鸿蒙化Log
4
4
 
5
+ ### v0.50.2
6
+
7
+ - release: @react-native-ohos/react-native-image-crop-picker@0.50.2
8
+
5
9
  ### v0.50.2-rc.6
6
10
 
7
11
  - pre-release: @react-native-ohos/react-native-image-crop-picker@0.50.2-rc.6
@@ -3,7 +3,7 @@
3
3
  "description": "Please describe the basic information.",
4
4
  "main": "index.ets",
5
5
  "type": "module",
6
- "version": "0.50.2-rc.6",
6
+ "version": "0.50.2",
7
7
  "dependencies": {
8
8
  "@rnoh/react-native-openharmony": "file:../../node_modules/@react-native-oh/react-native-harmony/harmony/react_native_openharmony.har"
9
9
  },
@@ -21,6 +21,7 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
+
24
25
  import image from '@ohos.multimedia.image';
25
26
  import Logger from '../Logger';
26
27
  import display from '@ohos.display';
@@ -191,14 +192,13 @@ export struct ImageEditInfo {
191
192
 
192
193
  this.maxClipSize = new Rectangle(left, top, right, bottom);
193
194
 
194
- if (this.initWidth > 0 && this.initHeight > 0) {
195
- let flag = imageWidth/this.initWidth < imageHeight/this.initHeight;
196
- let _imgWidth = flag ? imgWidth : Math.round(imgHeight * this.initWidth / this.initHeight)
197
- let _imgHeight = !flag ? imgHeight : Math.round(imgWidth * this.initHeight / this.initWidth)
198
- left = (screenWidth - _imgWidth) / 2;
199
- right = _imgWidth + left;
200
- top = (screenHeight - _imgHeight) / 2 - 66;
201
- bottom = _imgHeight + top;
195
+ if (this.initWidth > 0) {
196
+ left = (screenWidth - this.initWidth) / 2;
197
+ right = this.initWidth + left;
198
+ }
199
+ if (this.initHeight > 0) {
200
+ top = (screenHeight - this.initHeight) / 2 - 66;
201
+ bottom = this.initHeight + top;
202
202
  }
203
203
 
204
204
  this.clipSize = new Rectangle(left, top, right, bottom);
@@ -227,10 +227,9 @@ export struct ImageEditInfo {
227
227
  .fontSize(20)
228
228
  .textAlign(TextAlign.Center)
229
229
  .width('100%')
230
- .height(66)
231
- .position({ x: 0, y: 0 })
230
+ .height(46)
231
+ .position({ x: 0, y: 20 })
232
232
  .backgroundColor(Color.Black)
233
- .padding({top:32})
234
233
  }
235
234
 
236
235
  @Builder
@@ -384,20 +383,17 @@ export struct ImageEditInfo {
384
383
  let region: image.Region = { x: 0, y: 0, size: { height: cropHeight, width: cropWidth } };
385
384
  region.x =
386
385
  (this.clipSize.left - this.maxClipSize.left) / this.imgScale * this.clb + (xOff / this.imgScale) - this.imgOffSetX / this.imgScale * this.clb;
387
- region.size.width = Math.round(cropWidth - region.x - (this.maxClipSize.right - this.clipSize.right) / this.imgScale * this.clb
388
- - (xOff / this.imgScale) - this.imgOffSetX / this.imgScale * this.clb);
386
+ region.size.width = cropWidth - region.x - (this.maxClipSize.right - this.clipSize.right) / this.imgScale * this.clb
387
+ - (xOff / this.imgScale) - this.imgOffSetX / this.imgScale * this.clb;
389
388
  region.y =
390
389
  (this.clipSize.top - this.maxClipSize.top) / this.imgScale * this.clb + (yOff / this.imgScale) - this.imgOffSetY / this.imgScale * this.clb;
391
- region.size.height = Math.round(cropHeight - region.y - (this.maxClipSize.bottom - this.clipSize.bottom) / this.imgScale * this.clb
392
- - (yOff / this.imgScale) - this.imgOffSetY / this.imgScale * this.clb);
390
+ region.size.height = cropHeight - region.y - (this.maxClipSize.bottom - this.clipSize.bottom) / this.imgScale * this.clb
391
+ - (yOff / this.imgScale) - this.imgOffSetY / this.imgScale * this.clb;
393
392
  this.icon.crop(region, async (err: BusinessError) => {
394
393
  if (err != undefined) {
395
394
  console.error("Failed to crop pixelmap.");
396
395
  return;
397
396
  } else {
398
- if (this.initWidth > 0 && this.initHeight > 0){
399
- this.icon?.scaleSync( this.initWidth / region.size.width, this.initHeight / region.size.height )
400
- }
401
397
  let imgPath = await encode(this, this.icon);
402
398
  AppStorage.setOrCreate('cropImagePath', imgPath)
403
399
  AppStorage.setOrCreate('cropRect', {
@@ -413,7 +409,7 @@ export struct ImageEditInfo {
413
409
  })
414
410
  }
415
411
  .width('100%')
416
- .height(66)
412
+ .height(56)
417
413
  .position({ x: 0, y: (this.screenHeight - 66) })
418
414
  .backgroundColor(Color.Black)
419
415
  }
@@ -572,7 +568,7 @@ export struct ImageEditInfo {
572
568
  return;
573
569
  }
574
570
  this.imageFlag = false;
575
- if (!this.freeStyleCropEnabled) {
571
+ if (this.freeStyleCropEnabled) {
576
572
  return;
577
573
  }
578
574
  let touch = event.touches[0];
@@ -583,7 +579,6 @@ export struct ImageEditInfo {
583
579
  let newPosition = this.clipSize.clone();
584
580
 
585
581
  let direction = this.dragObj.action;
586
-
587
582
  if (this.dragObj.multiCrop) {
588
583
  this.getMultiCropRect(delX, delY, newPosition, direction, event.pressure);
589
584
  } else {
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-ohos/react-native-image-crop-picker",
3
- "version": "0.50.2-rc.6",
3
+ "version": "0.50.2",
4
4
  "description": "Select single or multiple images, with cropping option",
5
5
  "main": "js/index.js",
6
6
  "scripts": {
@@ -34,7 +34,7 @@
34
34
  "react-native-image-crop-picker": "^0.50.1"
35
35
  },
36
36
  "devDependencies": {
37
- "@react-native-oh/react-native-harmony-cli": "file:./packages/react-native-oh-react-native-harmony-cli-0.77.18.tgz"
37
+ "@react-native-oh/react-native-harmony-cli": "file:./packages/rnoh-react-native-harmony-cli-0.77.10.tgz"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "react": "*",