mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(item): align stacked and floating items start (#18379)
fixes #16375
This commit is contained in:
@@ -30,6 +30,10 @@
|
||||
<ion-label position="stacked">Stacked: input value</ion-label>
|
||||
<ion-input value="value"></ion-input>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label position="stacked">Stacked: div</ion-label>
|
||||
<div>A div</div>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label position="floating">Floating: textarea</ion-label>
|
||||
<ion-textarea></ion-textarea>
|
||||
|
||||
@@ -8,14 +8,36 @@ export async function openItemSliding(id: string, page: any, rtl = false) {
|
||||
const centerX = parseFloat(boundingBox.x + boundingBox.width / 2);
|
||||
const centerY = parseFloat(boundingBox.y + boundingBox.height / 2);
|
||||
|
||||
// In LTR start the drag at the center, move halfway in between the
|
||||
// center and 0, then end at 0
|
||||
//
|
||||
// 0 boundingBox.width
|
||||
// |---------|---------|---------|---------|
|
||||
// endX halfX centerX
|
||||
|
||||
let halfX = centerX / 2;
|
||||
let endX = 0;
|
||||
|
||||
// In RTL start at the center, move halfway in between the center and
|
||||
// the total width, then end at the total width
|
||||
//
|
||||
// 0 boundingBox.width
|
||||
// |---------|---------|---------|---------|
|
||||
// centerX halfX endX
|
||||
|
||||
if (rtl) {
|
||||
halfX = centerX + (centerX / 2);
|
||||
endX = boundingBox.width;
|
||||
}
|
||||
|
||||
// Start in the center of the item
|
||||
await page.mouse.move(centerX, centerY);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(centerX / 2, centerY);
|
||||
|
||||
// Move halfway first
|
||||
await page.mouse.move(halfX, centerY);
|
||||
|
||||
// Move all of the way to the end
|
||||
await page.mouse.move(endX, centerY);
|
||||
await page.mouse.up();
|
||||
|
||||
|
||||
@@ -255,6 +255,11 @@ button, a {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
:host(.item-label-stacked) .item-native,
|
||||
:host(.item-label-floating) .item-native {
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
:host(.item-label-stacked) .input-wrapper,
|
||||
:host(.item-label-floating) .input-wrapper {
|
||||
flex: 1;
|
||||
|
||||
Reference in New Issue
Block a user