ElyTable: the sheet's size follows every scale change; its end stays reachable after a zoom (T-05)
This commit is contained in:
15 files changed
+294
-25
No files matched your search
@@ -98,6 +98,15 @@ impl Doc {
|
||||
Ok((unpack.i64()?, unpack.i64()?))
|
||||
}
|
||||
|
||||
/// The size and the client zoom it was measured at.
|
||||
pub fn size_at(&self, worker: &mut Worker) -> io::Result<((i64, i64), (i32, i32))> {
|
||||
let payload = worker.request(tag::DOC_SIZE, &Pack::new().u64(worker.doc_id(self)?).bytes())?;
|
||||
let mut unpack = Unpack::new(&payload);
|
||||
let size = (unpack.i64()?, unpack.i64()?);
|
||||
let number = |value: i64| i32::try_from(value).map_err(io::Error::other);
|
||||
Ok((size, (number(unpack.i64()?)?, number(unpack.i64()?)?)))
|
||||
}
|
||||
|
||||
/// Page rectangles in twips; empty without pages.
|
||||
pub fn pages(&self, worker: &mut Worker) -> io::Result<Vec<Rect>> {
|
||||
let payload = worker.request(tag::PAGES, &Pack::new().u64(worker.doc_id(self)?).bytes())?;
|
||||
|
||||
@@ -113,6 +113,8 @@ struct Slot {
|
||||
result: Option<(String, bool)>,
|
||||
/// The seq last pushed to the client.
|
||||
pushed: u64,
|
||||
/// The client zoom last set: tile pixels, tile twips.
|
||||
zoom: (i32, i32),
|
||||
}
|
||||
|
||||
impl Slot {
|
||||
@@ -447,6 +449,23 @@ pub fn wait_cropping(id: u64, timeout: Duration) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
/// The client zoom last set on `id`, in tile units.
|
||||
pub fn zoom(id: u64) -> (i32, i32) {
|
||||
slots().lock().expect("the events lock").get(&id).map_or((0, 0), |slot| slot.zoom)
|
||||
}
|
||||
|
||||
/// A new client zoom resizes the document unannounced (Calc).
|
||||
pub fn rescaled(id: u64, zoom: (i32, i32)) {
|
||||
if let Some(slot) = slots().lock().expect("the events lock").get_mut(&id)
|
||||
&& slot.zoom != zoom
|
||||
{
|
||||
slot.zoom = zoom;
|
||||
slot.batch.resized += 1;
|
||||
slot.batch.seq += 1;
|
||||
}
|
||||
signal().notify_all();
|
||||
}
|
||||
|
||||
/// Seeds the a11y text from the kernel's snapshot (§7 tail).
|
||||
pub fn seed_a11y(id: u64, paragraph: &str) {
|
||||
if let Some(slot) = slots().lock().expect("the events lock").get_mut(&id) {
|
||||
|
||||
@@ -18,11 +18,16 @@ pub use client::{
|
||||
};
|
||||
#[cfg(feature = "view")]
|
||||
pub use view::{
|
||||
CONTEXT, Copy, Cut, Geom, Layout, LokError, LokView, Paste, Reported, TILE_TWIPS, ZOOM_STEPS,
|
||||
CONTEXT, Copy, Cut, Geom, Layout, LokError, LokView, Paste, Reported, ZOOM_STEPS,
|
||||
Zoomed, init, layout, paper, read_off, scheme,
|
||||
};
|
||||
#[cfg(feature = "view")]
|
||||
mod view;
|
||||
|
||||
/// One tile edge in twips.
|
||||
pub const TILE_TWIPS: i32 = 3840;
|
||||
/// Twips per pixel at zoom 1.0 and DPI 1.0.
|
||||
pub(crate) const TWIPS_PER_PIXEL: f32 = 15.0;
|
||||
pub use ipc::STALE;
|
||||
pub use ipc::file_url_of as file_url;
|
||||
pub use ipc::path_of_file_url as file_path;
|
||||
|
||||
@@ -33,10 +33,7 @@ pub use input::{CONTEXT, Copy, Cut, Paste, init};
|
||||
pub use off::read_off;
|
||||
pub use render::scheme;
|
||||
|
||||
/// One tile edge in twips.
|
||||
pub const TILE_TWIPS: i32 = 3840;
|
||||
/// Twips per pixel at zoom 1.0 and DPI 1.0.
|
||||
pub(crate) const TWIPS_PER_PIXEL: f32 = 15.0;
|
||||
pub(crate) use crate::{TILE_TWIPS, TWIPS_PER_PIXEL};
|
||||
|
||||
/// Document/view conversion under one zoom and DPI (LOK-04).
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
@@ -147,7 +144,7 @@ pub struct LokView {
|
||||
/// A document's size and page frames, in twips.
|
||||
pub type Layout = ((i64, i64), Vec<Rect>);
|
||||
|
||||
type Measured = io::Result<Layout>;
|
||||
use sheet::{Measured, measure};
|
||||
|
||||
/// A page's colour; the kernel's Ely schemes share it.
|
||||
pub fn paper(cx: &gpui::App) -> gpui::Hsla {
|
||||
@@ -165,10 +162,6 @@ pub fn layout(worker: &mut Worker, doc: &Doc) -> io::Result<Layout> {
|
||||
Ok((doc.size(worker)?, doc.pages(worker)?))
|
||||
}
|
||||
|
||||
/// Reads the layout under the worker lock.
|
||||
fn measure(worker: &Mutex<Worker>, doc: &Doc) -> Measured {
|
||||
layout(&mut worker.lock().expect("the worker lock"), doc)
|
||||
}
|
||||
|
||||
impl EventEmitter<LokError> for LokView {}
|
||||
|
||||
@@ -362,8 +355,8 @@ impl LokView {
|
||||
// What the view shows is the document at this revision.
|
||||
self.seen_revision(batch.revision);
|
||||
match measured {
|
||||
Some(Ok(((width, height), pages))) => {
|
||||
self.doc_size = (width as i32, height as i32);
|
||||
Some(Ok((((width, height), pages), zoom))) => {
|
||||
self.doc_size = self.at_scale((width as i32, height as i32), zoom);
|
||||
if pages.len() != self.pages.len() {
|
||||
log::info!("lok: {} pages", pages.len());
|
||||
}
|
||||
|
||||
@@ -111,10 +111,9 @@ impl LokView {
|
||||
if self.fit {
|
||||
return self.doc_size;
|
||||
}
|
||||
self.tile_of((
|
||||
self.doc_size.0.max(self.reach.0),
|
||||
self.doc_size.1.max(self.reach.1),
|
||||
))
|
||||
// The kernel sizes a sheet in tile twips already.
|
||||
let reach = self.tile_of(self.reach);
|
||||
(self.doc_size.0.max(reach.0), self.doc_size.1.max(reach.1))
|
||||
}
|
||||
|
||||
/// The print-twips document point under a view position (LOK-04).
|
||||
|
||||
@@ -1,9 +1,21 @@
|
||||
//! Calc reports print twips; tiles and clicks take tile twips.
|
||||
|
||||
use std::{io, sync::Mutex};
|
||||
|
||||
use gpui::Context;
|
||||
|
||||
use super::{LokView, TILE_TWIPS};
|
||||
use crate::{Rect, sheet::Geometry};
|
||||
use super::{Layout, LokView, TILE_TWIPS};
|
||||
use crate::{Doc, Rect, Worker, sheet::Geometry};
|
||||
|
||||
/// A layout and the client zoom it was measured at.
|
||||
pub(super) type Measured = io::Result<(Layout, (i32, i32))>;
|
||||
|
||||
/// Reads the layout under the worker lock.
|
||||
pub(super) fn measure(worker: &Mutex<Worker>, doc: &Doc) -> Measured {
|
||||
let mut worker = worker.lock().expect("the worker lock");
|
||||
let (size, zoom) = doc.size_at(&mut worker)?;
|
||||
Ok(((size, doc.pages(&mut worker)?), zoom))
|
||||
}
|
||||
|
||||
impl LokView {
|
||||
/// Lays the sheet out the kernel's way.
|
||||
@@ -51,11 +63,29 @@ impl LokView {
|
||||
/// Rescales, keeping the scrolling pane's start in place.
|
||||
pub(super) fn keep_scroll(&mut self, change: impl FnOnce(&mut Self)) {
|
||||
let start = self.scrolled_start();
|
||||
change(self);
|
||||
self.carry_size(change);
|
||||
let ((x, y), (fx, fy)) = (self.tile_of(start), self.frozen_tiles());
|
||||
self.scroll = (x - fx, y - fy);
|
||||
}
|
||||
|
||||
/// Rescales; the measured size moves to the new scale too.
|
||||
pub(super) fn carry_size(&mut self, change: impl FnOnce(&mut Self)) {
|
||||
// Until measured again, scrolls clamp against this.
|
||||
let print = self.print_of(self.doc_size);
|
||||
change(self);
|
||||
self.doc_size = self.tile_of(print);
|
||||
}
|
||||
|
||||
/// A sheet size the kernel measured at `zoom`, at ours.
|
||||
pub(super) fn at_scale(&self, size: (i32, i32), (pixels, twips): (i32, i32)) -> (i32, i32) {
|
||||
let Some(sheet) = self.sheet.as_ref().filter(|_| pixels > 0 && twips > 0) else {
|
||||
return size;
|
||||
};
|
||||
let theirs = f64::from(pixels) / f64::from(twips);
|
||||
let print = (sheet.columns.print(size.0, theirs), sheet.rows.print(size.1, theirs));
|
||||
self.tile_of(print)
|
||||
}
|
||||
|
||||
/// Where the scrolling pane starts, in print twips.
|
||||
pub fn scrolled_start(&self) -> (i32, i32) {
|
||||
let (fx, fy) = self.frozen_tiles();
|
||||
|
||||
@@ -82,14 +82,22 @@ fn far_down(cx: &mut gpui::TestAppContext, install: &std::path::Path) -> (Entity
|
||||
});
|
||||
let geometry = crate::sheet::geometry(&json).expect("parsed");
|
||||
let row = cell(&geometry, 1, 4997);
|
||||
let bounds = Bounds { origin: point(px(0.0), px(0.0)), size: size(px(800.0), px(600.0)) };
|
||||
cx.update(|app| {
|
||||
view.update(app, |view, cx| {
|
||||
view.geom.dpi = 2.0;
|
||||
view.set_geometry(geometry.clone(), cx);
|
||||
view.prepare(Bounds { origin: point(px(0.0), px(0.0)), size: size(px(800.0), px(600.0)) });
|
||||
view.show(row, cx);
|
||||
view.prepare(bounds);
|
||||
})
|
||||
});
|
||||
// The first scale's report and size land before the move.
|
||||
for _ in 0..100 {
|
||||
cx.executor().tick();
|
||||
}
|
||||
cx.update(|app| view.update(app, |view, cx| {
|
||||
view.show(row, cx);
|
||||
view.prepare(bounds);
|
||||
}));
|
||||
(view, geometry)
|
||||
}
|
||||
|
||||
@@ -192,6 +200,10 @@ fn a_sheet_brings_far_cut_and_frozen_cells_into_view() {
|
||||
view.set_geometry(crate::sheet::geometry(&json).expect("parsed"), cx);
|
||||
view.prepare(wide);
|
||||
assert_eq!(view.spare, (0.0, 0.0), "and stays left after it");
|
||||
let size = view.doc_size;
|
||||
view.doc_size = view.tile_of((view.print_of(size).0 + 20 * 1280, size.1));
|
||||
assert_eq!(view.extent(), view.doc_size, "the kernel's size is the extent, uncut");
|
||||
view.doc_size = size;
|
||||
view.viewport = (800.0, 200.0);
|
||||
let (width, height) = (view.geom.twips_of(view.viewport.0), view.geom.twips_of(view.viewport.1));
|
||||
let shows = |view: &LokView, rect: crate::Rect| {
|
||||
@@ -254,3 +266,177 @@ fn a_newly_selected_object_comes_into_view_a_moved_one_stays() {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/// Data out to the last cell sets the size.
|
||||
const FULL_SHEET: &str = r#"<?xml version="1.0" encoding="UTF-8"?>
|
||||
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
|
||||
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
|
||||
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
|
||||
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.spreadsheet">
|
||||
<office:automatic-styles><style:style style:name="co1" style:family="table-column"><style:table-column-properties style:column-width="0.4cm"/></style:style><style:style style:name="ro1" style:family="table-row"><style:table-row-properties style:row-height="0.5cm" style:use-optimal-row-height="false"/></style:style></office:automatic-styles>
|
||||
<office:body><office:spreadsheet><table:table table:name="S">
|
||||
<table:table-column table:style-name="co1" table:number-columns-repeated="2048"/>
|
||||
<table:table-row table:style-name="ro1" table:number-rows-repeated="5999"><table:table-cell table:number-columns-repeated="2048"/></table:table-row>
|
||||
<table:table-row table:style-name="ro1"><table:table-cell table:number-columns-repeated="2047"/><table:table-cell office:value-type="float" office:value="1"><text:p>1</text:p></table:table-cell></table:table-row>
|
||||
</table:table></office:spreadsheet></office:body>
|
||||
</office:document>"#;
|
||||
|
||||
#[test]
|
||||
fn a_zoom_measures_the_sheet_again() {
|
||||
let Some(install) = crate::client::tests::install() else {
|
||||
eprintln!("SKIP: no pinned LOK build");
|
||||
return;
|
||||
};
|
||||
let mut cx = gpui::TestAppContext::single();
|
||||
let (view, _) = cx.update(|app| live_view_of(app, &install, "full.fods", FULL_SHEET));
|
||||
let bounds = Bounds { origin: point(px(0.0), px(0.0)), size: size(px(400.0), px(200.0)) };
|
||||
cx.update(|app| view.update(app, |view, _| view.prepare(bounds)));
|
||||
for _ in 0..100 {
|
||||
cx.executor().tick();
|
||||
}
|
||||
let before = cx.update(|app| view.read(app).doc_size);
|
||||
cx.update(|app| view.update(app, |view, cx| {
|
||||
view.set_zoom(1.25, cx);
|
||||
view.prepare(bounds);
|
||||
}));
|
||||
// The kernel's size at the new zoom, read fresh.
|
||||
let kernel = |cx: &mut gpui::TestAppContext| {
|
||||
cx.update(|app| {
|
||||
let read = view.read(app);
|
||||
let (w, h) = read.doc.size(&mut read.worker.lock().expect("the worker lock")).expect("a size");
|
||||
(w as i32, h as i32)
|
||||
})
|
||||
};
|
||||
// The kernel takes the zoom, then the view its size.
|
||||
let (mut seen, mut now) = (before, before);
|
||||
for _ in 0..2000 {
|
||||
cx.executor().tick();
|
||||
(seen, now) = (cx.update(|app| view.read(app).doc_size), kernel(&mut cx));
|
||||
if now != before && seen == now {
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert_ne!(now, before, "the zoom changes the kernel's size here");
|
||||
assert_eq!(seen, now, "the view takes the size the kernel has at the new zoom");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_zoom_at_the_end_of_a_sheet_keeps_the_row_in_the_middle() {
|
||||
let Some(install) = crate::client::tests::install() else {
|
||||
eprintln!("SKIP: no pinned LOK build");
|
||||
return;
|
||||
};
|
||||
let mut cx = gpui::TestAppContext::single();
|
||||
let (view, worker) = cx.update(|app| live_view_of(app, &install, "full.fods", FULL_SHEET));
|
||||
let json = cx.update(|app| worker.lock().expect("the worker lock").values(&view.read(app).doc, crate::sheet::GEOMETRY).expect("geometry"));
|
||||
let geometry = crate::sheet::geometry(&json).expect("parsed");
|
||||
let bounds = Bounds { origin: point(px(0.0), px(0.0)), size: size(px(400.0), px(200.0)) };
|
||||
cx.update(|app| view.update(app, |view, cx| {
|
||||
view.set_geometry(geometry.clone(), cx);
|
||||
view.prepare(bounds);
|
||||
}));
|
||||
for _ in 0..100 {
|
||||
cx.executor().tick();
|
||||
}
|
||||
// Scrolled to the end, as by the wheel.
|
||||
cx.update(|app| view.update(app, |view, cx| {
|
||||
view.scroll_by(0.0, -1.0e7, cx);
|
||||
view.prepare(bounds);
|
||||
}));
|
||||
for _ in 0..100 {
|
||||
cx.executor().tick();
|
||||
}
|
||||
let middle = |cx: &mut gpui::TestAppContext| {
|
||||
cx.update(|app| {
|
||||
let read = view.read(app);
|
||||
let at = read.origin() + point(px(200.0), px(100.0));
|
||||
geometry.rows.at(read.doc_point(at).1)
|
||||
})
|
||||
};
|
||||
let before = middle(&mut cx);
|
||||
cx.update(|app| view.update(app, |view, cx| {
|
||||
view.set_zoom(1.25, cx);
|
||||
view.prepare(bounds);
|
||||
}));
|
||||
let right_after = middle(&mut cx);
|
||||
for _ in 0..400 {
|
||||
cx.executor().tick();
|
||||
}
|
||||
let measured = middle(&mut cx);
|
||||
assert!(before.abs_diff(right_after) <= 1, "row {before} became {right_after} at the zoom");
|
||||
assert!(before.abs_diff(measured) <= 1, "row {before} became {measured} once measured");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_late_size_from_the_last_zoom_keeps_the_row() {
|
||||
let Some(install) = crate::client::tests::install() else {
|
||||
eprintln!("SKIP: no pinned LOK build");
|
||||
return;
|
||||
};
|
||||
let mut cx = gpui::TestAppContext::single();
|
||||
let (view, worker) = cx.update(|app| live_view_of(app, &install, "full.fods", FULL_SHEET));
|
||||
let json = cx.update(|app| worker.lock().expect("the worker lock").values(&view.read(app).doc, crate::sheet::GEOMETRY).expect("geometry"));
|
||||
let geometry = crate::sheet::geometry(&json).expect("parsed");
|
||||
let bounds = Bounds { origin: point(px(0.0), px(0.0)), size: size(px(400.0), px(200.0)) };
|
||||
let settle = |cx: &mut gpui::TestAppContext| {
|
||||
for _ in 0..200 {
|
||||
cx.executor().tick();
|
||||
}
|
||||
};
|
||||
cx.update(|app| view.update(app, |view, cx| {
|
||||
view.set_geometry(geometry.clone(), cx);
|
||||
view.set_zoom(1.25, cx);
|
||||
view.prepare(bounds);
|
||||
}));
|
||||
settle(&mut cx);
|
||||
cx.update(|app| view.update(app, |view, cx| {
|
||||
view.scroll_by(0.0, -1.0e7, cx);
|
||||
view.prepare(bounds);
|
||||
}));
|
||||
settle(&mut cx);
|
||||
// Measured at 125%, landing after the zoom to 150%.
|
||||
let late = cx.update(|app| super::super::measure(&view.read(app).worker, &view.read(app).doc));
|
||||
let middle = |cx: &mut gpui::TestAppContext| {
|
||||
cx.update(|app| {
|
||||
let read = view.read(app);
|
||||
geometry.rows.at(read.doc_point(read.origin() + point(px(200.0), px(100.0))).1)
|
||||
})
|
||||
};
|
||||
cx.update(|app| view.update(app, |view, cx| view.set_zoom(1.5, cx)));
|
||||
let before = middle(&mut cx);
|
||||
cx.update(|app| view.update(app, |view, cx| view.apply_batch(crate::Events::default(), Some(late), cx)));
|
||||
let after = middle(&mut cx);
|
||||
assert!(before.abs_diff(after) <= 1, "row {before} became {after} when the old size landed");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_first_size_has_a_scale_and_keeps_the_row() {
|
||||
let Some(install) = crate::client::tests::install() else {
|
||||
eprintln!("SKIP: no pinned LOK build");
|
||||
return;
|
||||
};
|
||||
let mut cx = gpui::TestAppContext::single();
|
||||
let (view, worker) = cx.update(|app| live_view_of(app, &install, "full.fods", FULL_SHEET));
|
||||
// Read before any visible area: the load set a scale.
|
||||
let first = cx.update(|app| super::super::measure(&view.read(app).worker, &view.read(app).doc));
|
||||
assert_eq!(first.as_ref().map(|(_, zoom)| *zoom).ok(), Some((256, 3840)), "a known scale");
|
||||
let json = cx.update(|app| worker.lock().expect("the worker lock").values(&view.read(app).doc, crate::sheet::GEOMETRY).expect("geometry"));
|
||||
let geometry = crate::sheet::geometry(&json).expect("parsed");
|
||||
let bounds = Bounds { origin: point(px(0.0), px(0.0)), size: size(px(400.0), px(200.0)) };
|
||||
cx.update(|app| view.update(app, |view, cx| {
|
||||
view.set_geometry(geometry.clone(), cx);
|
||||
view.prepare(bounds);
|
||||
view.scroll_by(0.0, -1.0e7, cx);
|
||||
}));
|
||||
let middle = |cx: &mut gpui::TestAppContext| {
|
||||
cx.update(|app| {
|
||||
let read = view.read(app);
|
||||
geometry.rows.at(read.doc_point(read.origin() + point(px(200.0), px(100.0))).1)
|
||||
})
|
||||
};
|
||||
cx.update(|app| view.update(app, |view, cx| view.set_zoom(1.25, cx)));
|
||||
let before = middle(&mut cx);
|
||||
cx.update(|app| view.update(app, |view, cx| view.apply_batch(crate::Events::default(), Some(first), cx)));
|
||||
let after = middle(&mut cx);
|
||||
assert!(before.abs_diff(after) <= 1, "row {before} became {after} when the first size landed");
|
||||
}
|
||||
@@ -54,7 +54,7 @@ impl LokView {
|
||||
let under = self.print_of((self.scroll.0 + self.geom.twips_of(sx), self.scroll.1 + self.geom.twips_of(sy)));
|
||||
self.fit = false;
|
||||
if (zoom - self.geom.zoom).abs() > 0.0001 {
|
||||
self.geom.zoom = zoom;
|
||||
self.carry_size(|view| view.geom.zoom = zoom);
|
||||
self.retire_tiles();
|
||||
self.failed.clear();
|
||||
}
|
||||
|
||||
@@ -192,8 +192,12 @@ fn answer(lok: &Lok, tag: u8, id: u64, payload: &[u8]) {
|
||||
tag::EXPORT_TEXT => text::export(unpack).map(|()| Vec::new()),
|
||||
tag::DOC_SIZE => unpack
|
||||
.u64()
|
||||
.and_then(|id| with_doc(id, |doc| doc.size()))
|
||||
.map(|(width, height)| Pack::new().i64(width).i64(height).bytes()),
|
||||
.and_then(|id| Ok((with_doc(id, |doc| doc.size())?, crate::events::zoom(id))))
|
||||
.map(|((width, height), (pixels, twips))| {
|
||||
// The scale the kernel measured at; 0 if never set.
|
||||
let pack = Pack::new().i64(width).i64(height);
|
||||
pack.i64(i64::from(pixels)).i64(i64::from(twips)).bytes()
|
||||
}),
|
||||
tag::SAVE_AS => save(unpack).map(|()| Vec::new()),
|
||||
tag::EXPORT_PDF => export_pdf(unpack).map(|()| Vec::new()),
|
||||
tag::CLOSE_DOC => unpack.u64().map(|id| {
|
||||
@@ -255,6 +259,7 @@ fn answer(lok: &Lok, tag: u8, id: u64, payload: &[u8]) {
|
||||
doc.set_client_zoom(pixels, twips);
|
||||
doc.set_visible_area(x, y, w, h)
|
||||
})
|
||||
.inspect(|_| crate::events::rescaled(id, (pixels, twips)))
|
||||
})
|
||||
.map(|()| Vec::new()),
|
||||
tag::SELECTION_TEXT => unpack
|
||||
@@ -331,6 +336,12 @@ fn load(lok: &Lok, url: &str, password: String, filter: &str) -> io::Result<u64>
|
||||
crate::events::seed_a11y(id, &doc.a11y_paragraph()?);
|
||||
// Settle the initial layout now; later paints see it (LOK-03).
|
||||
doc.post_uno(".uno:Repaginate", None)?;
|
||||
// A sheet's size has a known scale from the start.
|
||||
if doc.kind() == 1 {
|
||||
let zoom = (crate::TILE_TWIPS / crate::TWIPS_PER_PIXEL as i32, crate::TILE_TWIPS);
|
||||
doc.set_client_zoom(zoom.0, zoom.1);
|
||||
crate::events::rescaled(id, zoom);
|
||||
}
|
||||
let mut docs = docs().lock().expect("the docs lock");
|
||||
docs.insert(id, doc);
|
||||
log::info!("lok-worker: {} documents open", docs.len());
|
||||
|
||||
Reference in new issue
Block a user