Skip to content

Commit 319128f

Browse files
committed
Fix camera projection not being an object
1 parent cec735d commit 319128f

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

src/Plotly.NET/CommonAbstractions/StyleParams.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ module StyleParam =
471471
member this.Convert() = this |> ConstraintOperation.convert
472472

473473
[<RequireQualifiedAccess>]
474-
type CameraProjection =
474+
type CameraProjectionType =
475475
| Perspective
476476
| Orthographic
477477

@@ -480,9 +480,9 @@ module StyleParam =
480480
| Perspective -> "perspective"
481481
| Orthographic -> "orthographic"
482482

483-
static member convert = CameraProjection.toString >> box
484-
override this.ToString() = this |> CameraProjection.toString
485-
member this.Convert() = this |> CameraProjection.convert
483+
static member convert = CameraProjectionType.toString >> box
484+
override this.ToString() = this |> CameraProjectionType.toString
485+
member this.Convert() = this |> CameraProjectionType.convert
486486

487487
[<RequireQualifiedAccess>]
488488
type ContourType =

src/Plotly.NET/Layout/ObjectAbstractions/3D/Camera.fs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,28 @@ type CameraUp() =
8585

8686
cameraUp
8787

88+
type CameraProjection() =
89+
inherit DynamicObj()
90+
91+
static member init([<Optional; DefaultParameterValue(null)>] ?ProjectionType: StyleParam.CameraProjectionType) =
92+
CameraProjection() |> CameraProjection.style (?ProjectionType = ProjectionType)
93+
94+
static member style([<Optional; DefaultParameterValue(null)>] ?ProjectionType: StyleParam.CameraProjectionType) =
95+
96+
fun (cameraProjection: CameraProjection) ->
97+
98+
ProjectionType |> DynObj.setValueOptBy cameraProjection "type" StyleParam.CameraProjectionType.convert
99+
100+
cameraProjection
101+
88102
type Camera() =
89103
inherit DynamicObj()
90104

91105
static member init
92106
(
93107
[<Optional; DefaultParameterValue(null)>] ?Center: CameraCenter,
94108
[<Optional; DefaultParameterValue(null)>] ?Eye: CameraEye,
95-
[<Optional; DefaultParameterValue(null)>] ?Projection: StyleParam.CameraProjection,
109+
[<Optional; DefaultParameterValue(null)>] ?Projection: CameraProjection,
96110
[<Optional; DefaultParameterValue(null)>] ?Up: CameraUp
97111
) =
98112
Camera() |> Camera.style (?Center = Center, ?Eye = Eye, ?Projection = Projection, ?Up = Up)
@@ -101,15 +115,15 @@ type Camera() =
101115
(
102116
[<Optional; DefaultParameterValue(null)>] ?Center: CameraCenter,
103117
[<Optional; DefaultParameterValue(null)>] ?Eye: CameraEye,
104-
[<Optional; DefaultParameterValue(null)>] ?Projection: StyleParam.CameraProjection,
118+
[<Optional; DefaultParameterValue(null)>] ?Projection: CameraProjection,
105119
[<Optional; DefaultParameterValue(null)>] ?Up: CameraUp
106120
) =
107121

108122
fun (camera: Camera) ->
109123

110124
Center |> DynObj.setValueOpt camera "center"
111125
Eye |> DynObj.setValueOpt camera "eye"
112-
Projection |> DynObj.setValueOptBy camera "projection" StyleParam.CameraProjection.convert
126+
Projection |> DynObj.setValueOpt camera "projection"
113127
Up |> DynObj.setValueOpt camera "up"
114128

115129
camera

0 commit comments

Comments
 (0)