# zoomage
**Repository Path**: chinasoft4_ohos/zoomage
## Basic Information
- **Project Name**: zoomage
- **Description**: 简单缩放 Image 库,强调流畅自然的感觉。
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 2
- **Forks**: 0
- **Created**: 2021-06-08
- **Last Updated**: 2022-02-09
## Categories & Tags
**Categories**: harmonyos-image
**Tags**: None
## README
# zoomage
#### 项目介绍
- 项目名称:zoomage
- 所属系列:openharmony的第三方组件适配移植
- 功能:简单缩放图片库。
- 项目移植状态:主功能完成
- 调用差异:无
- 开发版本:sdk6,DevEco Studio2.2 Beta1
- 基线版本:Release v1.3.1
#### 效果演示
#### 安装教程
1.在项目根目录下的build.gradle文件中,
```
allprojects {
repositories {
maven {
url 'https://s01.oss.sonatype.org/content/repositories/releases/'
}
}
}
```
2.在entry模块的build.gradle文件中,
```
dependencies {
implementation('com.gitee.chinasoft_ohos:ohos_zoomage:1.0.1')
......
}
```
在sdk6,DevEco Studio2.2 Beta1下项目可直接运行
如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件,
并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下
#### 使用说明
布局文件定义,提供控件:ZoomageView
代码中可动态设置自定义属性:
设置是否允许缩放
setZoomEnabled(boolean zoomEnabled)
设置是否允许移动
setPanEnabled(boolean translatable)
限制图像的边界,使其在小于原大小时不会在 Image 的边界外徘徊,并在图像大于原大小时限制边界停止在 Image 的边缘。
setRestrictBounds(boolean restrictBounds)
如果为 true,则在重置时图像将动画恢复到其起始大小,如果为 false,则将恢复到其起始大小。
setAnimateOnReset(boolean animateOnReset)
如果图像部分在屏幕外,这将导致图像将自身拉入屏幕上。
setAutoCenter(final boolean autoCenter)
确定图像将在什么时候重置为其起始大小。如果图像大小改变,则 UNDER、OVER 和 ALWAYS 都具有将图像重置为其起始位置的效果。(UNDER|OVER|ALWAYS|NEVER)
setAutoResetMode(@AutoResetMode final int autoReset)
图像的最大允许比例
setMaxRatio(float scale)
图像的最小允许比例
setMinScale(float scale)
设置双击缩放功能的比例值
setDoubleTapZoomScale(float quickScale)
设置是否启用双击缩放功能
setQuickScaleEnabled(boolean quickScaleEnabled)
自定义ZoomageView控件,可以添加自定义属性,具体可用属性如下:
| name | type | info |
|-------------------------|-----------|--------------------------------------------------------|
| zoomage_translatable | boolean | 设置是否允许移动,默认值为true |
| zoomage_zoomable | boolean | 设置是否允许缩放,默认值为true |
| zoomage_animateOnReset | boolean | 如果为 true,则在重置时图像将动画恢复到其起始大小,如果为 false,则将恢复到其起始大小。默认值为true |
| zoomage_autoCenter | boolean | 如果图像部分在屏幕外,这将导致图像将自身拉入屏幕上。默认值为true。 |
| zoomage_restrictBounds | boolean | 限制图像的边界,使其在小于原大小时不会在 Image 的边界外徘徊,并在图像大于原大小时限制边界停止在 Image 的边缘。默认值为false。 |
| zoomage_doubleTapToZoom | boolean | 设置是否启用双击缩放功能。默认为true |
| zoomage_minScale | double | 图像的最小允许比例,默认值为 0.6 |
| zoomage_maxScale | double | 图像的最大允许比例,默认值为 8 |
| zoomage_doubleTapToZoomScaleFactor | double | 设置双击缩放功能的比例值。默认值为 3。 |
| zoomage_autoResetMode | int | 确定图像将在什么时候重置为其起始大小。如果图像大小改变,则 UNDER、OVER 和 ALWAYS 都具有将图像重置为其起始位置的效果。默认值为UNDER。 |
#### 测试信息
CodeCheck代码测试无异常
CloudTest代码测试无异常
病毒安全检测通过
当前版本demo功能与原组件基本无差异
#### 版本迭代
- 1.0.1
#### 版权和许可信息
Copyright 2016 Jeffrey Sibbold
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.