Skip to content

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;
}

Ortham added 2 commits June 7, 2018 18:35
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