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

TypeDefault valueSupported value
stringnullNot applicable

Describes path to the image source.

Formats supported across all renderers are PNG and JPEG. Other formats could require specific work.

position

TypeDefault valueSupported value
string`$ImagePrimitive.POSITION_TOP_LEFTsee 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

TypeDefault valueSupported value
booleanfalsetrue, false

Describes strategy for image preload. If true, load image even if image isn’t visible.

clip

TypeDefault valueSupported value
objectnullNot 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 clip
  • y - The y position in pixels in the image to start clip
  • width - The width in pixels of the clip
  • height - The height in pixels of the clip

clearBeforeLoad

TypeDefault valueSupported value
booleanfalseNot 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.