Skip to content

Commit

Permalink
v1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
theyangfan committed Sep 4, 2023
1 parent afb4b4c commit 31be31f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) Microsoft Corporation
Copyright (c) 2023, YangFan, [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
17 changes: 10 additions & 7 deletions PictureViewer.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ namespace WordPictureViewer
public partial class PictureViewer : Window
{
#region Private Members
private const int MINIMUM_SCALE = 50;
private int _scale = 100;
private int _scaleStep = 9;
private int _scaleStep = 10;
private bool _zoomIn = true;
#endregion

#region Constructor
Expand Down Expand Up @@ -187,18 +189,19 @@ private void PictureViewer_MouseWheel(object sender, MouseWheelEventArgs e)
{
if(e.Delta > 0) // zoom in
{
if(_scaleStep < 0)_scaleStep = -_scaleStep;
else _scaleStep++;
if(_zoomIn && _scale > 100) _scaleStep++;
_scale += _scaleStep;
_zoomIn = true;
}
else // zoom out
{
if (_scaleStep > 0) _scaleStep = -_scaleStep;
else if(_scale + _scaleStep >= 99) _scaleStep++;
if (!_zoomIn && _scale > 100) _scaleStep--;
if (_scale - _scaleStep < MINIMUM_SCALE) return;
_scale -= _scaleStep;
_zoomIn = false;
}
if (_scale + _scaleStep < 100) return;
// smooth scale animation
DoubleAnimation aniScale = new DoubleAnimation() { Duration = TimeSpan.FromMilliseconds(250) };
_scale += _scaleStep;
aniScale.To = (double)_scale / 100;
System.Windows.Point mouse = Mouse.GetPosition(UIImage);
double centerX = mouse.X;
Expand Down
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,29 @@ This project is a Word VSTO add-in program (plug-in) for **double-click to enlar

![Example](https://github.com/theyangfan/WordPictureViewer/blob/main/example.gif)



## 下载 (Downloads)

| Office AddIn | Download |
| ------------ | ---------------------------------------------------------------------------------------------------------- |
| Word | [word_v1.0.2.zip](https://github.com/theyangfan/WordPictureViewer/releases/download/1.0.2/word_v1.0.2.zip) |


| Word | [word_v1.0.3.zip](https://github.com/theyangfan/WordPictureViewer/releases/download/1.0.3/word_v1.0.3.zip) |

## 安装 (Install)

解压压缩包,双击 setup.exe,点击安装,完成。

Unzip the package, double-click setup.exe, click Install, and finish.



## 卸载 (Uninstall)

打开 Windows 设置,进入【应用】-【应用和功能】,搜索 WordPictureViewer,点击卸载,完成。

Open Windows Settings, go to 【Apps】 - 【Apps and Features】, search for WordPictureViewer, click Uninstall, and done.

## 更新日志 (Release History)

### v1.0.3 (2023-09-04)

## 更新日志 (Release History)
- 最小缩放率调整为 50%。

### v1.0.2 (2023-04-10)

Expand Down
2 changes: 1 addition & 1 deletion WordPictureViewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<PublishUrl>publish\</PublishUrl>
<InstallUrl />
<TargetCulture>zh-chs</TargetCulture>
<ApplicationVersion>1.0.2.0</ApplicationVersion>
<ApplicationVersion>1.0.3.0</ApplicationVersion>
<AutoIncrementApplicationRevision>false</AutoIncrementApplicationRevision>
<UpdateEnabled>true</UpdateEnabled>
<UpdateInterval>7</UpdateInterval>
Expand Down

0 comments on commit 31be31f

Please sign in to comment.