Don't persist Grid sizes
A) there are potentially a lot of Grids, using up a lot of space (and therefore serialization time). B) if the code changes, the grid should also change, and not remember old sizes
This commit is contained in:
parent
558891c146
commit
f789159a4a
1 changed files with 5 additions and 3 deletions
|
@ -1,7 +1,6 @@
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, PartialEq)]
|
#[derive(Clone, Debug, Default, PartialEq)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
|
||||||
pub(crate) struct State {
|
pub(crate) struct State {
|
||||||
col_widths: Vec<f32>,
|
col_widths: Vec<f32>,
|
||||||
row_heights: Vec<f32>,
|
row_heights: Vec<f32>,
|
||||||
|
@ -9,11 +8,14 @@ pub(crate) struct State {
|
||||||
|
|
||||||
impl State {
|
impl State {
|
||||||
pub fn load(ctx: &Context, id: Id) -> Option<Self> {
|
pub fn load(ctx: &Context, id: Id) -> Option<Self> {
|
||||||
ctx.data().get_persisted(id)
|
ctx.data().get_temp(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn store(self, ctx: &Context, id: Id) {
|
pub fn store(self, ctx: &Context, id: Id) {
|
||||||
ctx.data().insert_persisted(id, self);
|
// We don't persist Grids, because
|
||||||
|
// A) there are potentially a lot of them, using up a lot of space (and therefore serialization time)
|
||||||
|
// B) if the code changes, the grid _should_ change, and not remember old sizes
|
||||||
|
ctx.data().insert_temp(id, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_min_col_width(&mut self, col: usize, width: f32) {
|
fn set_min_col_width(&mut self, col: usize, width: f32) {
|
||||||
|
|
Loading…
Reference in a new issue