Does anyone know where there might be documentation on these View methods over and above the docstrings with the methods?
def viewport_position(self) -> Vector:
""" :returns: The offset of the viewport in layout coordinates. """
return sublime_api.view_viewport_position(self.view_id)
def set_viewport_position(self, xy: Vector, animate=True):
""" Scrolls the viewport to the given layout position. """
sublime_api.view_set_viewport_position(self.view_id, xy, animate)
def viewport_extent(self) -> Vector:
""" :returns: The width and height of the viewport. """
return sublime_api.view_viewport_extents(self.view_id)
def layout_extent(self) -> Vector:
""" :returns: The width and height of the layout. """
return sublime_api.view_layout_extents(self.view_id)
def text_to_layout(self, tp: Point) -> Vector:
""" Convert a text point to a layout position. """
return sublime_api.view_text_to_layout(self.view_id, tp)
def text_to_window(self, tp: Point) -> Vector:
""" Convert a text point to a window position. """
return self.layout_to_window(self.text_to_layout(tp))
def layout_to_text(self, xy: Vector) -> Point:
""" Convert a layout position to a text point. """
return sublime_api.view_layout_to_text(self.view_id, xy)
def layout_to_window(self, xy: Vector) -> Vector:
""" Convert a layout position to a window position. """
return sublime_api.view_layout_to_window(self.view_id, xy)
def window_to_layout(self, xy: Vector) -> Vector:
""" Convert a window position to a layout position. """
return sublime_api.view_window_to_layout(self.view_id, xy)
def window_to_text(self, xy: Vector) -> Point:
""" Convert a window position to a text point. """
return self.layout_to_text(self.window_to_layout(xy))
Does it follow a viewport model (such as CSS) that I can go dig into and learn how to use these functions? (About 20 years ago, I remember doing something similar in C in WIN32, so I’m not a complete beginner, but my memory of it is rusty.) While I have (I think) the correct meanings of DIP, I need Sublime Text definitions for:
- Viewport (I think it might be the editing area between left and right gutters, below tabs and above the lower scroll bar)
- Position ?
- Extent ? Dimensions in DPI?
- Layout (that
layout_extent()gets the width and height of) ? - Text pt vs Layout pt
- Text pt vs Window pt
- etc.
Kind regards,
Vic