<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
On 4/11/2023 5:56 AM, Hilaire Fernandes via Cuis-dev wrote:
<blockquote cite="mid:aac627ea-b08c-9c06-8fbe-a66d864d49e1@free.fr"
type="cite">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<p><font size="4">Hi, <br>
</font></p>
<p>How will you implement a viewport?</p>
<p>Let's say I have a PaperMorph with some written texts. Its halo
shows the top left corner (0;0). Is there a way to adjust the
PaperMorph so it shows (50,0) at the top left corner and its
texts are translated of 50 pixels in the left direction?<br>
</p>
<p>Thanks</p>
<p>Hilaire<br>
</p>
<pre class="moz-signature" cols="72">--
GNU Dr. Geo
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://drgeo.eu">http://drgeo.eu</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://blog.drgeo.eu">http://blog.drgeo.eu</a></pre>
</blockquote>
<br>
Hi Hilaire,<br>
<br>
Sample07Clipping is an example on how to clip submorphs, to an
arbitrary shape:<br>
Sample07Clipping new openInWorld.<br>
<br>
If the clipping will be to a simple rectanlge, it may be better to:<br>
Create a new class, like BoxedMorph subclass: #ClippingBoxMorph<br>
Add this method:<br>
clipsSubmorphs<br>
^true<br>
Then do something like:<br>
star := Sample01Star new.<br>
container := ClippingBoxMorph new.<br>
container addMorph: star.<br>
container openInWorld.<br>
star morphPosition: 10@60. "or whatever" <br>
<br>
If you also want automatically handled scrollbars, it is already in
the image, and used by most of the UI. You can simply do:<br>
p := PluggableScrollPane new.<br>
p scroller: Sample01Star new.<br>
p openInWorld.<br>
Note that in this case, you can't position the submorph at will. The
ScrollPane will position the "scroller" in such a way that its
topLeft is visible when scrollbars ar at the top and left.<br>
<br>
Hope this helps.<br>
<br>
Cheers!<br>
<pre class="moz-signature" cols="72">--
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich</pre>
</body>
</html>