-
Notifications
You must be signed in to change notification settings - Fork 4k
feat(module:image): add scale step #8163
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
feat(module:image): add scale step #8163
Conversation
This preview will be available after the AzureCI is passed. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #8163 +/- ##
==========================================
+ Coverage 91.69% 91.72% +0.02%
==========================================
Files 517 517
Lines 17806 17828 +22
Branches 2728 2739 +11
==========================================
+ Hits 16328 16353 +25
+ Misses 1179 1175 -4
- Partials 299 300 +1 ☔ View full report in Codecov by Sentry. |
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.
This PR has been merged, can you open another PR and resolve them?
export const DEFAULT_NZ_SCALE_STEP = 0.5; | ||
const DEFAULT_NZ_ZOOM = 1; | ||
const DEFAULT_NZ_ROTATE = 0; |
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.
We uniformly use NZ as the prefix.
DEFAULT_NZ_SCALE_STEP -> NZ_DEFAULT_SCALE_STEP
@@ -267,15 +280,19 @@ export class NzImagePreviewComponent implements OnInit { | |||
} | |||
|
|||
onZoomIn(): void { | |||
this.zoom += 1; | |||
const zoomStep = | |||
this.scaleStepMap.get(this.images[this.index].src ?? this.images[this.index].src) ?? this.scaleStep; |
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.
I think you mean .get(src ?? srcset)
I apologize for the delay. I have opened another PR to resolve the remaining issues. Here is the link to the new PR: [PR #8173]. Please review it and let me know if you have any comments or suggestions. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
The current version of the image component does not allow customization of the scale step, which is fixed at 1.
What is the new behavior?
• The scale step has been updated from
1
to0.5
to match the default value of the Antd image component.• The
nz-image
directive now accepts an input callednzScaleStep
, which determines the amount of zooming in or out. The default value ofnzScaleStep
is 0.5, and it can be configured globally.• The
nz-image-group
component also has an input callednzScaleStep
, which applies to all the images inside the group. However, if an individual image has its ownnzScaleStep
value, it will override the group value and use its own value instead.Does this PR introduce a breaking change?
Other information
The scale step of an image is determined by the following order of priority:
• The value specified on the image itself, if any.
• The value specified on the image group, if any.
• The global value, if any.
• The default value of
0.5
, if none of the above is provide