Skip to content

Commit

Permalink
fleshed out the window
Browse files Browse the repository at this point in the history
  • Loading branch information
spennydl committed Jun 9, 2019
1 parent 7c144ae commit ed2c76f
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 71 deletions.
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,7 @@ features = [
'MouseEvent',
'Node',
'Window',
'console'
'console',
'CssStyleDeclaration',
'DomRect',
]
7 changes: 2 additions & 5 deletions src/platform/websys.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
extern crate wasm_bindgen;
extern crate web_sys;

use platform_impl::Window as CanvasWindow;
use platform_impl::window::ElementSelection;
use window::{Window, WindowBuilder};
use platform::websys::wasm_bindgen::prelude::*;
use platform::websys::wasm_bindgen::JsCast;

pub trait WebsysWindowExt {
fn get_canvas<'a>(&'a self) -> &'a web_sys::HtmlCanvasElement;
Expand All @@ -18,9 +15,9 @@ impl WebsysWindowExt for Window {
}

pub trait WebsysWindowBuilderExt {
fn with_canvas_id(mut self, canvas_id: &str) -> WindowBuilder;
fn with_canvas_id(self, canvas_id: &str) -> WindowBuilder;

fn with_container_id(mut self, container_id: &str) -> WindowBuilder;
fn with_container_id(self, container_id: &str) -> WindowBuilder;
}

impl WebsysWindowBuilderExt for WindowBuilder {
Expand Down
1 change: 0 additions & 1 deletion src/platform_impl/websys/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use ::event::WindowEvent as WindowEvent;
use ::event::DeviceId as WDeviceId;
use ::event::{ElementState, MouseButton};

use ::wasm_bindgen::prelude::*;
use ::web_sys::MouseEvent;
use super::window::DeviceId;

Expand Down
4 changes: 2 additions & 2 deletions src/platform_impl/websys/event_loop.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ::event_loop::{ControlFlow, EventLoopClosed};
use ::event_loop::EventLoopWindowTarget as WinitELT;
use ::event::{Event, StartCause};
use super::window::{MonitorHandle, Window, WindowId, WindowInternal};
use super::window::{MonitorHandle, WindowId};
#[macro_use]
use platform_impl::platform::wasm_util as util;

Expand All @@ -11,7 +11,7 @@ use std::cell::{Cell, RefCell};

use ::wasm_bindgen::prelude::*;
use ::wasm_bindgen::JsCast;
use ::web_sys::{Element, HtmlCanvasElement};
use ::web_sys::{HtmlCanvasElement};

#[derive(Clone, Copy, Eq, PartialEq)]
enum EventLoopState {
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/websys/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub use self::event_loop::{EventLoop, EventLoopProxy, EventLoopWindowTarget};
pub use self::window::{DeviceId, MonitorHandle, Window, WindowId, PlatformSpecificWindowBuilderAttributes};

use std::fmt::{Display, Debug, Error, Formatter};
use std::fmt::{Display, Error, Formatter};

#[macro_use]
mod wasm_util;
Expand Down
4 changes: 1 addition & 3 deletions src/platform_impl/websys/wasm_util.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use wasm_bindgen::prelude::*;

#[macro_use]
use ::error::OsError as WOsError;

use super::OsError;
Expand All @@ -21,4 +19,4 @@ impl From<wasm_bindgen::JsValue> for WOsError {
fn from(error: wasm_bindgen::JsValue) -> Self {
os_error!(OsError{})
}
}
}
Loading

0 comments on commit ed2c76f

Please sign in to comment.