Skip to content

Latest commit

 

History

History
60 lines (42 loc) · 2.47 KB

readmode.md

File metadata and controls

60 lines (42 loc) · 2.47 KB

Read Mode

Translations: 简体中文

For long text images, their height is usually very large, if the initial state shows the full image, then the text content in the image is not clear, the user must double-click to zoom in and slide to the start position to start reading

For such images, ZoomImage provides a reading mode to fill the screen at the initial state of the image and locate it to the beginning position, similar to ContentScale .Crop plus Alignment.TopStart, so that users can directly start reading the content of the long text image

Enabled Read Mode

val state: ZoomState by rememberZoomState()

LaunchEffect(Unit) {
    state.zoomable.readmode = ReadMode.Default
}

SketchZoomAsyncImage(
    imageUri = "http://sample.com/sample.jpg",
    contentDescription = "view image",
    modifier = Modifier.fillMaxSize(),
    state = state,
)

ReadMode

The ReadMode class is used to control the read mode, and it has two parameters:

  • sizeType: Int = ReadMode.SIZE_TYPE_HORIZONTAL or ReadMode.SIZE_TYPE_VERTICAL: The reading mode can be used to control which size type of image, the default is both horizontal and vertical charts, and the value is ReadMode.SIZE_TYPE_HORIZONTA or ReadMode.SIZE_TYPE_VERTICAL
  • decider: ReadMode.Decider = ReadMode.Decider.Default: decider determines whether read mode can be used based on contentSize and containerSize, and the default implementation is ReadMode.LongImageDecider, which uses read mode only for long images
  • The default configuration for ReadMode is ReadMode.Default
  • You can implement the ReadMode.Decider interface to implement your own decision rules