-
Notifications
You must be signed in to change notification settings - Fork 277
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
fix(crop): [crop]modify crops component demo problem #2419
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 |
---|---|---|
|
@@ -21,12 +21,12 @@ test('裁剪框最小宽高', async ({ page }) => { | |
|
||
box = await face.boundingBox() | ||
|
||
expect(box.width).toBe(100) | ||
expect(box.height).toBe(56.25) // 此处有bug, 高度最小应该为 100, 实际最小为56.25 | ||
expect(box.width).toBe(199.99996948242188) | ||
expect(box.height).toBe(112.5) // 此处有bug, 高度最小应该为 100, 实际最小为56.25 | ||
Comment on lines
+24
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification The test expectations are incorrect based on the component's configuration The test expectations don't align with the actual component configuration:
🔗 Analysis chainReview and fix the minimum height constraint.
Let's verify the minimum height constraint in the component: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Search for minCropBoxHeight property in the component
rg -A 5 "minCropBoxHeight|min-crop-box-height" --type vue
Length of output: 87 Script: #!/bin/bash
# Search for minCropBoxHeight property in all files
rg -A 5 "minCropBoxHeight|min-crop-box-height"
# Also search for crop box height related configurations
rg -A 5 "cropBoxHeight|crop.*height"
# Look for the test file content to understand the context better
cat "examples/sites/demos/pc/app/crop/min-crop-box-width-height.spec.ts"
Length of output: 13030 |
||
|
||
// 判断container 大小为 800*200 | ||
box = await container.boundingBox() | ||
|
||
expect(box.width).toBe(800) | ||
expect(box.height).toBe(200) | ||
expect(box.width).toBe(650) | ||
expect(box.height).toBe(300) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,10 @@ | |
:cropvisible="visible" | ||
@update:cropvisible="visible = $event" | ||
:src="imgUrl" | ||
:min-crop-box-width="100" | ||
:min-crop-box-height="100" | ||
:min-container-height="200" | ||
:min-container-width="800" | ||
:min-crop-box-width="200" | ||
:min-crop-box-height="350" | ||
:min-container-height="300" | ||
:min-container-width="650" | ||
Comment on lines
+8
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Disproportionate dimensions in min-crop-box demo The current dimensions (200x350) create an unusually tall and narrow crop box that doesn't align with common use cases, as evidenced by:
Consider adjusting to more practical dimensions that better demonstrate the component's typical usage, such as:
🔗 Analysis chainReview the crop box and container dimensions The current dimension settings raise a few concerns:
Please confirm if these dimensions align with the intended use case. Consider:
🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Search for other crop demos to compare dimension settings
rg -l "tiny-crop" examples/sites/demos/pc/app/crop/
Length of output: 2470 Script: #!/bin/bash
# Let's check the content of min-crop-box-width-height.vue and min-crop-box-width-height-composition-api.vue
# to see if these dimensions are consistent across both implementations
cat examples/sites/demos/pc/app/crop/min-crop-box-width-height.vue
cat examples/sites/demos/pc/app/crop/min-crop-box-width-height-composition-api.vue
# Also check basic usage and aspect ratio demos for reference dimensions
cat examples/sites/demos/pc/app/crop/basic-usage.vue
cat examples/sites/demos/pc/app/crop/aspect-ratio.vue
Length of output: 2919 |
||
></tiny-crop> | ||
</div> | ||
</template> | ||
|
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.
💡 Codebase verification
Crop box height constraint issue confirmed
The test file reveals that there's already a known bug with height constraints in the crop component. The test comment explicitly states: "此处有bug, 高度最小应该为 100, 实际最小为56.25" (translation: "There's a bug here, minimum height should be 100, but actual minimum is 56.25").
Given this context, setting min-crop-box-height (350px) larger than min-container-height (300px) is problematic because:
Please adjust the constraints to ensure min-crop-box-height ≤ min-container-height:
🔗 Analysis chain
Verify crop box and container dimension constraints.
There appears to be a conflict in the minimum height constraints:
This configuration might cause issues since the crop box cannot be larger than its container. Please verify if this is intentional or if the constraints need to be adjusted to ensure the crop box can fit within the container.
Consider one of these solutions:
Let's verify the component's behavior with these dimensions:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 171
Script:
Length of output: 3223