Skip to content

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

Merged
merged 8 commits into from
Nov 18, 2023

Conversation

ParsaArvanehPA
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[✔] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Application (the showcase website) / infrastructure changes
[ ] Other... Please describe:

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 to 0.5 to match the default value of the Antd image component.

• The nz-image directive now accepts an input called nzScaleStep, which determines the amount of zooming in or out. The default value of nzScaleStep is 0.5, and it can be configured globally.

• The nz-image-group component also has an input called nzScaleStep, which applies to all the images inside the group. However, if an individual image has its own nzScaleStep value, it will override the group value and use its own value instead.

Does this PR introduce a breaking change?

[ ] Yes
[✔] No

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

Copy link

zorro-bot bot commented Nov 16, 2023

This preview will be available after the AzureCI is passed.

Copy link

codecov bot commented Nov 16, 2023

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (b2d971e) 91.69% compared to head (1f35794) 91.72%.
Report is 4 commits behind head on master.

❗ Current head 1f35794 differs from pull request most recent head 5a2c363. Consider uploading reports for the commit 5a2c363 to get more accurate results

Files Patch % Lines
components/image/image-preview.component.ts 89.47% 0 Missing and 2 partials ⚠️
components/image/image.directive.ts 77.77% 0 Missing and 2 partials ⚠️
...nents/cron-expression/cron-expression.component.ts 96.00% 1 Missing ⚠️
components/menu/menu-group.component.ts 66.66% 0 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

@simplejason simplejason merged commit 5aa4db9 into NG-ZORRO:master Nov 18, 2023
Copy link
Collaborator

@HyperLife1119 HyperLife1119 left a 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?

Comment on lines +47 to +49
export const DEFAULT_NZ_SCALE_STEP = 0.5;
const DEFAULT_NZ_ZOOM = 1;
const DEFAULT_NZ_ROTATE = 0;
Copy link
Collaborator

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;
Copy link
Collaborator

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)

@ParsaArvanehPA
Copy link
Contributor Author

This PR has been merged, can you open another PR and resolve them?

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.
@HyperLife1119

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants