Compare commits
No commits in common. "d4dc6ab11f346e8dc4a6e4d95a9694341b9c9e19" and "03fa4b823c4ccbd99f79462ef2a2b33bf7cfe269" have entirely different histories.
d4dc6ab11f
...
03fa4b823c
3 changed files with 13 additions and 67 deletions
|
@ -1,4 +0,0 @@
|
||||||
port module Clipboard exposing (copyToClipboard)
|
|
||||||
|
|
||||||
|
|
||||||
port copyToClipboard : String -> Cmd msg
|
|
65
src/Main.elm
65
src/Main.elm
|
@ -5,14 +5,11 @@ import Array
|
||||||
import Browser
|
import Browser
|
||||||
import Browser.Events as Events
|
import Browser.Events as Events
|
||||||
import Camera3d
|
import Camera3d
|
||||||
import Clipboard exposing (copyToClipboard)
|
|
||||||
import Color
|
import Color
|
||||||
import Direction3d
|
import Direction3d
|
||||||
import Element exposing (..)
|
import Element exposing (..)
|
||||||
import Element.Background as Background
|
import Element.Background as Background
|
||||||
import Element.Border as Border
|
|
||||||
import Element.Font as Font
|
import Element.Font as Font
|
||||||
import Element.Input exposing (button)
|
|
||||||
import Html exposing (Html)
|
import Html exposing (Html)
|
||||||
import Http
|
import Http
|
||||||
import Length
|
import Length
|
||||||
|
@ -86,6 +83,17 @@ init flags =
|
||||||
( { w = width, h = height, mesh = Nothing, textures = Nothing, angle = 0 }, Cmd.batch [ getMesh, getTexture ] )
|
( { w = width, h = height, mesh = Nothing, textures = Nothing, angle = 0 }, Cmd.batch [ getMesh, getTexture ] )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- type alias Object3d =
|
||||||
|
-- TriangularMesh
|
||||||
|
-- { position : Point3d Length.Meters Obj.Decode.ObjCoordinates
|
||||||
|
-- , normal : Vector3d Quantity.Unitless Obj.Decode.ObjCoordinates
|
||||||
|
-- , uv : ( Float, Float )
|
||||||
|
-- }
|
||||||
|
-- type alias Object3d =
|
||||||
|
-- TriangularMesh (Point3d Length.Meters Obj.Decode.ObjCoordinates)
|
||||||
|
|
||||||
|
|
||||||
type alias Object3d =
|
type alias Object3d =
|
||||||
TriangularMesh { position : Point3d Length.Meters Obj.Decode.ObjCoordinates, uv : ( Float, Float ) }
|
TriangularMesh { position : Point3d Length.Meters Obj.Decode.ObjCoordinates, uv : ( Float, Float ) }
|
||||||
|
|
||||||
|
@ -95,7 +103,6 @@ type Msg
|
||||||
| GotMesh (Result Http.Error Object3d)
|
| GotMesh (Result Http.Error Object3d)
|
||||||
| GotTexture (Result WebGL.Texture.Error (Material.Texture Color.Color))
|
| GotTexture (Result WebGL.Texture.Error (Material.Texture Color.Color))
|
||||||
| Rotate Time.Posix
|
| Rotate Time.Posix
|
||||||
| Copy String
|
|
||||||
|
|
||||||
|
|
||||||
update : Msg -> Model -> ( Model, Cmd Msg )
|
update : Msg -> Model -> ( Model, Cmd Msg )
|
||||||
|
@ -136,9 +143,6 @@ update msg model =
|
||||||
Rotate time ->
|
Rotate time ->
|
||||||
wrap { model | angle = model.angle + 2 * (2 + sin (toFloat (Time.posixToMillis time) / 1000)) }
|
wrap { model | angle = model.angle + 2 * (2 + sin (toFloat (Time.posixToMillis time) / 1000)) }
|
||||||
|
|
||||||
Copy text ->
|
|
||||||
( model, copyToClipboard text )
|
|
||||||
|
|
||||||
|
|
||||||
subscribe : Model -> Sub Msg
|
subscribe : Model -> Sub Msg
|
||||||
subscribe _ =
|
subscribe _ =
|
||||||
|
@ -163,39 +167,6 @@ vh model percent =
|
||||||
Basics.toFloat model.h * percent / 100
|
Basics.toFloat model.h * percent / 100
|
||||||
|
|
||||||
|
|
||||||
white : Color
|
|
||||||
white =
|
|
||||||
rgb 255 255 255
|
|
||||||
|
|
||||||
|
|
||||||
black : Color
|
|
||||||
black =
|
|
||||||
rgb 0 0 0
|
|
||||||
|
|
||||||
|
|
||||||
btnStyle : List (Attribute msg)
|
|
||||||
btnStyle =
|
|
||||||
[ padding 10
|
|
||||||
, Font.color (rgb255 255 255 255)
|
|
||||||
, Font.family [ Font.typeface "Rubik" ]
|
|
||||||
, Font.semiBold
|
|
||||||
, Font.size 20
|
|
||||||
, Border.width 2
|
|
||||||
, Border.color white
|
|
||||||
, mouseOver [ Background.color white, Font.color black ]
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
linkBtn : String -> String -> Element msg
|
|
||||||
linkBtn disp addr =
|
|
||||||
newTabLink btnStyle { url = addr, label = text (String.toUpper disp) }
|
|
||||||
|
|
||||||
|
|
||||||
btn : String -> Msg -> Element Msg
|
|
||||||
btn disp act =
|
|
||||||
button btnStyle { onPress = Just act, label = text (String.toUpper disp) }
|
|
||||||
|
|
||||||
|
|
||||||
view : Model -> Browser.Document Msg
|
view : Model -> Browser.Document Msg
|
||||||
view model =
|
view model =
|
||||||
{ title = "MacGregor House"
|
{ title = "MacGregor House"
|
||||||
|
@ -239,19 +210,7 @@ view model =
|
||||||
, Font.family [ Font.typeface "Imbue" ]
|
, Font.family [ Font.typeface "Imbue" ]
|
||||||
, Font.size 96
|
, Font.size 96
|
||||||
]
|
]
|
||||||
(column
|
(text "MacGregor House")
|
||||||
[ spacing 20
|
|
||||||
]
|
|
||||||
[ text "MacGregor House"
|
|
||||||
, row
|
|
||||||
[ spacing 20
|
|
||||||
]
|
|
||||||
[ linkBtn "Events" "https://calendar.google.com/calendar/embed?src=c_c9fb13003264d5becb74cf9ba42a087d8a4a180d927441994458a07ac146eb88%40group.calendar.google.com&ctz=America%2FNew_York"
|
|
||||||
, linkBtn "Space" "https://forms.gle/KxFAG65TQuPxdYak8"
|
|
||||||
, btn "iCal" (Copy "https://calendar.google.com/calendar/ical/c_c9fb13003264d5becb74cf9ba42a087d8a4a180d927441994458a07ac146eb88%40group.calendar.google.com/public/basic.ics")
|
|
||||||
]
|
|
||||||
]
|
|
||||||
)
|
|
||||||
, el
|
, el
|
||||||
[ alignRight
|
[ alignRight
|
||||||
, alignTop
|
, alignTop
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
<link
|
<link
|
||||||
href="https://fonts.googleapis.com/css2?family=Imbue:opsz,wght@10..100,100..900&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Rubik:ital,wght@0,300..900;1,300..900&display=swap"
|
href="https://fonts.googleapis.com/css2?family=Imbue:opsz,wght@10..100,100..900&display=swap"
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
/>
|
/>
|
||||||
</head>
|
</head>
|
||||||
|
@ -18,15 +18,6 @@
|
||||||
node: document.getElementById("app"),
|
node: document.getElementById("app"),
|
||||||
flags: [window.innerWidth, window.innerHeight],
|
flags: [window.innerWidth, window.innerHeight],
|
||||||
});
|
});
|
||||||
|
|
||||||
app.ports.copyToClipboard.subscribe((text) => {
|
|
||||||
var textArea = document.createElement("textarea");
|
|
||||||
textArea.value = text;
|
|
||||||
document.body.appendChild(textArea);
|
|
||||||
textArea.select();
|
|
||||||
document.execCommand("copy");
|
|
||||||
document.body.removeChild(textArea);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue