-
-
Notifications
You must be signed in to change notification settings - Fork 7
feat(PdfReader): add OnRotationChanged parameter #758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -56,10 +56,10 @@ public partial class PdfReader | |||||
| public uint CurrentPage { get; set; } | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// 获得/设置 当前缩放倍率 默认 null 使用 100% | ||||||
| /// 获得/设置 当前旋转角度 默认 0 数值范围 0 90 180 270 | ||||||
| /// </summary> | ||||||
| [Parameter] | ||||||
| public string? CurrentScale { get; set; } | ||||||
| public int CurrentRotation { get; set; } | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// 获得/设置 是否适配当前页面宽度 默认 false | ||||||
|
|
@@ -109,6 +109,12 @@ public partial class PdfReader | |||||
| [Parameter] | ||||||
| public Func<float, Task>? OnScaleChangedAsync { get; set; } | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// 页面旋转回调方法 | ||||||
| /// </summary> | ||||||
| [Parameter] | ||||||
| public Func<int, Task>? OnRotationChanged { get; set; } | ||||||
|
||||||
| public Func<int, Task>? OnRotationChanged { get; set; } | |
| public Func<int, Task>? OnRotationChangedAsync { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): Use a consistent integer type for rotation instead of mixing int and float.
CurrentRotation is an int with documented discrete values (0, 90, 180, 270), but the backing field is a float. This mismatch is unnecessary and could mask accidental non-discrete values in future changes. Please make _currentRotation an int so the type matches the public API, the value domain, and the comparisons in OnAfterRenderAsync.
Copilot
AI
Nov 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type mismatch: The field '_currentRotation' is declared as 'float', but the 'CurrentRotation' property is 'int'. This inconsistency could lead to type conversion issues. Since rotation angles are discrete values (0, 90, 180, 270) as documented, '_currentRotation' should be 'int' to match the property type.
| private float _currentRotation; | |
| private int _currentRotation; |
Copilot
AI
Nov 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Equality checks on floating point values can yield unexpected results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment describes the CurrentRotation property but appears in the diff as replacing the previous CurrentScale comment. While the comment itself is correct for CurrentRotation, verify this is intentional and that CurrentScale was truly removed. If CurrentScale was actually removed as a breaking change, this should be documented in the PR description or CHANGELOG.