Skip to content
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

Add support for custom ProgressiveImage equivalents #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Ortham
Copy link
Contributor

@Ortham Ortham commented Jun 9, 2018

As it is, pig.js doesn't give you any control over what is rendered on the grid, beyond specifying a filename and aspect ratio for each image. This adds the ability to specify an alternative implementation of ProgressiveImage to display images with.

Implementations must still provide the same interface as ProgressiveImage, which according to what Pig uses is (in TypeScript):

interface PigImage {
    aspectRatio: number;
    style: PigImageStyle;

    load(): void;
    hide(): void;
}

// All numbers have units pixels.
interface PigImageStyle {
    width: number;
    height: number;
    translateX: number;
    translateY: number;
    transition: string;
}

The imageType option can be set to another prototype that provides the
same API as ProgressiveImage, which can be expressed in TypeScript as

```
interface ProgressiveImage {
    aspectRatio: number;
    style: ProgressiveImageStyle;

    load(): void;
    hide(): void;
}

interface ProgressiveImageStyle {
    width: number;
    height: number;
    translateX: number;
    translateY: number;
    transition: string;
}
```
They're <img /> elements for ProgressiveImage, but might not be for
custom alternatives.
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.

1 participant