Image primitive properties
This primitive goals to draw an image.
Caution
Image primitive will always display the image in its original size. If width or height set to the image is smaller than the original image size, image won’t be scaled down but will be cropped. If width of height is bigger than the original image size, image won’t be scaled up but filled up with blank.
Properties
url
position
preload
clip
clearBeforeLoad
Properties specifications
url
Type | Default value | Supported value |
---|---|---|
string | null | Not applicable |
Describes path to the image source.
Formats supported across all renderers are PNG and JPEG. Other formats could require specific work.
position
Type | Default value | Supported value |
---|---|---|
string | `$ImagePrimitive.POSITION_TOP_LEFT | see statics of $ImagePrimitive |
Describes position of the image inside its container. Allowed key words are available in statics of $ImagePrimitive (POSITION_CENTER
, POSITION_BOTTOM_RIGHT
…).
preload
Type | Default value | Supported value |
---|---|---|
boolean | false | true, false |
Describes strategy for image preload. If true, load image even if image isn’t visible.
clip
Type | Default value | Supported value |
---|---|---|
object | null | Not applicable |
Describes a visible proportion of the image. Clip means to cut the primitive without modifying primitive size
To work, the 4 properties following properties should be defined :
x
- The x position in pixels in the image to start clipy
- The y position in pixels in the image to start clipwidth
- The width in pixels of the clipheight
- The height in pixels of the clip
clearBeforeLoad
Type | Default value | Supported value |
---|---|---|
boolean | false | Not applicable |
Limitations
This flag is not applicable to CSS renderer. Default behaviour on CSS will clear image until new one is completely loaded and cannot be changed.
Flag cannot be updated it can be set at primitive creation, that’s all.
When flag is true, image drawing will be clear while loading image.
When flag is false, image will stay visible while loading the new one
Known issues
- Border on image with no url or on errored image will not be shown on Lightning renderer
- Position property on Lightning renderer is not applicable on ImagePrimitive. It is only working on ContainImagePrimitive and CoverImagePrimitive.