From e0f12598aa22c91f42b3c724b5700740aed2d742 Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Tue, 21 Aug 2018 18:18:25 +0200 Subject: [PATCH] fix(content): scrollToPoint reliability fixes #15257 --- core/src/components.d.ts | 2 +- core/src/components/content/content.tsx | 14 ++++---------- core/src/components/ripple-effect/readme.md | 6 +++--- core/src/components/title/readme.md | 1 - 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/core/src/components.d.ts b/core/src/components.d.ts index 520a0b8a90..d703c442d2 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -2107,7 +2107,7 @@ declare global { * The text to display on the ok button. Default: `OK`. */ 'okText': string; - 'open': (ev?: UIEvent | undefined) => Promise | Promise | Promise; + 'open': (ev?: UIEvent | undefined) => Promise | Promise | Promise; /** * The text to display when the select is empty. */ diff --git a/core/src/components/content/content.tsx b/core/src/components/content/content.tsx index 251cb0fe55..c425b018e7 100644 --- a/core/src/components/content/content.tsx +++ b/core/src/components/content/content.tsx @@ -206,7 +206,7 @@ export class Content { } let resolve!: () => void; - let startTime: number; + let startTime = 0; const promise = new Promise(r => resolve = r); const fromY = el.scrollTop; const fromX = el.scrollLeft; @@ -216,11 +216,11 @@ export class Content { // scroll loop const step = (timeStamp: number) => { - let linearTime = Math.min(1, ((timeStamp - startTime) / duration)); - const easedT = (--linearTime) * linearTime * linearTime + 1; + const linearTime = Math.min(1, ((timeStamp - startTime) / duration)) - 1; + const easedT = Math.pow(linearTime, 3) + 1; if (deltaY !== 0) { - el.scrollTop = (easedT * deltaY) + fromY; + el.scrollTop = Math.floor((easedT * deltaY) + fromY); } if (deltaX !== 0) { el.scrollLeft = Math.floor((easedT * deltaX) + fromX); @@ -233,14 +233,9 @@ export class Content { requestAnimationFrame(step); } else { - this.isScrolling = false; resolve(); } }; - - // start scroll loop - this.isScrolling = true; - // chill out for a frame first requestAnimationFrame(ts => { startTime = ts; @@ -353,7 +348,6 @@ function updateScrollDetail( detail.startX = currentX; detail.startY = currentY; detail.velocityX = detail.velocityY = 0; - console.log('hhhhhh'); } detail.timeStamp = timestamp; detail.currentX = detail.scrollLeft = currentX; diff --git a/core/src/components/ripple-effect/readme.md b/core/src/components/ripple-effect/readme.md index 64ab3c5056..2f0d15232a 100644 --- a/core/src/components/ripple-effect/readme.md +++ b/core/src/components/ripple-effect/readme.md @@ -16,9 +16,9 @@ The ripple effect component adds the [Material Design ink ripple interaction eff ## Methods -| Method | Description | -| ----------- | ------------------------------------------- | -| `addRipple` | Adds the ripple effect to the parent elment | +| Method | Description | +| ----------- | -------------------------------------------- | +| `addRipple` | Adds the ripple effect to the parent element | ---------------------------------------------- diff --git a/core/src/components/title/readme.md b/core/src/components/title/readme.md index 5924023feb..6fe4922277 100644 --- a/core/src/components/title/readme.md +++ b/core/src/components/title/readme.md @@ -12,7 +12,6 @@ | Property | Attribute | Description | Type | | -------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | | `color` | `color` | The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics). | `Color` | -| `mode` | `mode` | The mode determines which platform styles to use. Possible values are: `"ios"` or `"md"`. | `Mode` | ----------------------------------------------