Horizontal scrolling with large images
Opened this issue · 2 comments
adthibaut commented
Hello !
I am not entirely familiar with the process of opening issues or contributing to packages, so please excuse me if I am not handling it correctly.
I had this use case where I needed to scroll horinzontally in a really large image while still being able to clic and collect the position of the pixels. I ended up finding this solution adding the following chunks of code directly in the lib files :
style.css
#image-container {
overflow-x: scroll;
width: 100%;
max-width: 100%;
}
#image {
display: block;
height: auto;
width: auto;
}
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>streamlit-image-coordinates</title>
<script src="./streamlit-component-lib.js"></script>
<script src="./main.js"></script>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<div id="image-container">
<img id="image" />
</div>
</body>
</html>
Would this be a good idea to make it a permanent feature of the component ?
Cheers
the6thsense commented
Thanks that's so helpful. Can you also add a pointer/marker on click.
spacewalk012 commented
@adthibaut it's not working when I tried these changes in my code. Could you please help me resolve this? is anything missing from your suggestions.