Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions apps/demo/nativescript.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ export default {
markingMode: 'none',
discardUncaughtJsExceptions: false,
},
// Light like the Android app theme (Theme.AppCompat.Light), whatever the desktop uses
linux: {
appearance: 'light',
},
appPath: 'src',
ios: {
discardUncaughtJsExceptions: false,
Expand Down
34 changes: 34 additions & 0 deletions apps/demo/src/app.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
@import 'nativescript-theme-core/scss/light';
@import 'nativescript-theme-core/scss/index';

// Follow the system theme: core sets .ns-dark on the root view (theme-core's dark skin colors).
.ns-dark {
.page {
background-color: #303030;
color: #fff;
}

.action-bar {
background-color: #303030;
color: #fff;
}
}

// canvas-html: the card drawn into the canvas.
.drawable-card {
background-color: #fff;
border-radius: 16;
padding: 20;
}

.drawable-card-note {
color: #666;
}

.ns-dark {
.drawable-card {
background-color: #2b2b2b;
}

.drawable-card-note {
color: #b3b3b3;
}
}

.gameover {
font-weight: bold;
text-transform: uppercase;
Expand Down
4 changes: 2 additions & 2 deletions apps/demo/src/plugin-demos/canvas-html.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
</Page.actionBar>
<GridLayout rows="*, auto">
<canvas:Canvas row="0" id="canvas" content="drawable" loaded="{{ canvasLoaded }}" unloaded="{{ canvasUnloaded }}" style="width:100%;height:100%">
<StackLayout id="form" drawable="true" width="280" padding="20" backgroundColor="white" borderRadius="16">
<StackLayout id="form" drawable="true" width="280" class="drawable-card">
<Label text="A form inside a canvas" fontSize="20" fontWeight="bold" />
<Label text="Drawn by drawElementImage, rotated, still interactive." textWrap="true" color="#666" marginBottom="8" />
<Label text="Drawn by drawElementImage, rotated, still interactive." textWrap="true" class="drawable-card-note" marginBottom="8" />
<TextField hint="Type here" text="{{ name }}" />
<Label text="{{ 'Hello ' + (name || '…') }}" marginTop="4" />
<Slider value="{{ tilt }}" minValue="-30" maxValue="30" marginTop="8" />
Expand Down
4 changes: 4 additions & 0 deletions crates/canvas-napi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ log.workspace = true
canvas-core = { workspace = true, features = ["2d", "gl", "d3d"] }
canvas-c = { workspace = true, features = ["2d", "webgl", "gl", "d3d"] }
windows-core = "0.62"
# The WinUI 3 members drawable children use (host/windows/xaml.rs) build on these.
windows = { workspace = true, features = ["Foundation", "Storage_Streams", "Win32_Foundation", "Win32_Graphics_Gdi", "Win32_System_Threading", "Win32_System_WinRT", "Win32_UI_WindowsAndMessaging"] }
windows-collections = "0.3"
windows-future = "0.3"

# Linux shows frames in a GTK 4 (>= 4.6) widget, shared with GDK's GL context as EGLImages.
[target.'cfg(target_os = "linux")'.dependencies]
Expand Down
4 changes: 4 additions & 0 deletions crates/canvas-napi/src/host/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ use napi::{Env, Error, Result};
use napi_derive::napi;
use windows_core::{IUnknown, Interface};

mod drawable;
mod picking;
mod xaml;

/// `CanvasModule.__simulateD3DDeviceRemoval()`: removes the thread's Direct3D 12 device (2D
/// canvases), as a driver reset would, to exercise context loss. `false` where unsupported.
#[napi(js_name = "__simulateD3DDeviceRemoval")]
Expand Down
Loading
Loading