Skip to content

Commit

Permalink
Fixed performance optimization always enabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
Developer-Mike committed May 30, 2024
1 parent e1efb32 commit d197040
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import AdvancedCanvasPlugin from "src/main"
import SettingsManager, { AdvancedCanvasPluginSettings } from "src/settings"

const EXPOSED_SETTINGS: (keyof AdvancedCanvasPluginSettings)[] = [
'performanceOptimizationEnabled',
'collapsibleGroupsFeatureEnabled',
'collapsedGroupPreviewOnDrag'
]
Expand Down
15 changes: 13 additions & 2 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export interface AdvancedCanvasPluginSettings {
defaultFileNodeWidth: number
defaultFileNodeHeight: number

performanceOptimizationEnabled: boolean

nodeStylingFeatureEnabled: boolean
shapesFeatureEnabled: boolean
borderStyleFeatureEnabled: boolean
Expand Down Expand Up @@ -59,7 +61,11 @@ export const DEFAULT_SETTINGS: Partial<AdvancedCanvasPluginSettings> = {
defaultFileNodeWidth: 400,
defaultFileNodeHeight: 400,

performanceOptimizationEnabled: false,

shapesFeatureEnabled: true,
nodeStylingFeatureEnabled: true,
borderStyleFeatureEnabled: true,

edgesStylingFeatureEnabled: true,
edgeStylePathfinderGridResolution: 10,
Expand All @@ -79,9 +85,7 @@ export const DEFAULT_SETTINGS: Partial<AdvancedCanvasPluginSettings> = {
collapsibleGroupsFeatureEnabled: true,
collapsedGroupPreviewOnDrag: true,

nodeStylingFeatureEnabled: true,
stickersFeatureEnabled: true,
borderStyleFeatureEnabled: true,

presentationFeatureEnabled: true,
defaultSlideSize: '1200x675',
Expand Down Expand Up @@ -196,6 +200,13 @@ export class AdvancedCanvasPluginSettingTab extends PluginSettingTab {
.onChange(async (value) => await this.settingsManager.setSetting({ defaultFileNodeHeight: Math.max(1, parseInt(value)) }))
)

this.createFeatureHeading(
containerEl,
"Performance optimization",
"Optimize the performance of the canvas (Side effect is some amount of blurriness).",
'performanceOptimizationEnabled'
)

this.createFeatureHeading(
containerEl,
"Node styling",
Expand Down
4 changes: 2 additions & 2 deletions src/styles/performance.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Source (Slightly modified): https://forum.obsidian.md/t/performance-issue-with-built-in-canvas-plugin/68609/2

.view-content:has(> .canvas-wrapper) {
.view-content:has(> .canvas-wrapper[data-performance-optimization-enabled='true']) {
overflow: hidden;
}

.canvas-wrapper {
.canvas-wrapper[data-performance-optimization-enabled='true'] {
width: 1000%;
height: 1000%;

Expand Down

0 comments on commit d197040

Please sign in to comment.