Skip to content

Commit ff4f4fa

Browse files
committed
add styles and transforms to viewport info
1 parent f45efcb commit ff4f4fa

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

lib/scenic/view_port.ex

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,15 +356,19 @@ defmodule Scenic.ViewPort do
356356
root_config: root_config,
357357
root_scene_pid: root_scene_pid,
358358
root_graph_key: root_graph_key,
359-
size: size
359+
size: size,
360+
master_styles: styles,
361+
master_transforms: transforms
360362
} = state
361363
) do
362364
status = %ViewPort.Status{
363365
root_scene_pid: root_scene_pid,
364366
root_config: root_config,
365367
root_graph: root_graph_key,
366368
drivers: driver_registry,
367-
size: size
369+
size: size,
370+
styles: styles,
371+
transforms: transforms
368372
}
369373

370374
{:reply, {:ok, status}, state}
@@ -434,6 +438,7 @@ defmodule Scenic.ViewPort do
434438
max_depth: config.max_depth,
435439
on_close: on_close,
436440
master_styles: styles,
441+
master_transforms: transforms,
437442
master_graph: master_graph,
438443
master_graph_key: master_graph_key
439444
}

lib/scenic/view_port/status.ex

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,21 @@ defmodule Scenic.ViewPort.Status do
1010
alias Scenic.ViewPort.Status
1111
alias Scenic.Math
1212

13-
defstruct drivers: nil, root_config: nil, root_graph: nil, root_scene_pid: nil, size: nil
13+
defstruct drivers: nil,
14+
root_config: nil,
15+
root_graph: nil,
16+
root_scene_pid: nil,
17+
size: nil,
18+
styles: %{},
19+
transforms: %{}
1420

1521
@type t :: %Status{
1622
drivers: map,
1723
root_config: {scene_module :: atom, args :: any} | (scene_name :: atom),
1824
root_graph: {:graph, reference, any},
1925
root_scene_pid: pid,
20-
size: Math.point()
26+
size: Math.point(),
27+
styles: map,
28+
transforms: map
2129
}
2230
end

test/scenic/view_port_test.exs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,9 @@ defmodule Scenic.ViewPortTest do
234234
root_config: :root_config,
235235
root_scene_pid: :root_scene_pid,
236236
root_graph_key: :root_graph_key,
237-
size: :size
237+
size: :size,
238+
master_styles: %{},
239+
master_transforms: %{}
238240
}
239241
)
240242

@@ -243,6 +245,8 @@ defmodule Scenic.ViewPortTest do
243245
assert info.root_scene_pid == :root_scene_pid
244246
assert info.root_config == :root_config
245247
assert info.size == :size
248+
assert info.styles == %{}
249+
assert info.transforms == %{}
246250
end
247251

248252
# ============================================================================

0 commit comments

Comments
 (0)