Skip to content

Commit 8f9b338

Browse files
Presentation popup menu not showing when edge is selected. Added custom colors to the readme
1 parent f44c1a1 commit 8f9b338

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ All features can be enabled/disabled in the settings.
5252
- Default
5353
- Straight
5454
- A*
55+
- [Custom colors](#custom-colors) in the color picker
5556
- [Stickers](#stickers)
5657
- Convert image nodes to stickers (transparent background and no border)
5758
- [Presentation mode](#presentation)
@@ -167,6 +168,21 @@ Set the path style of the edges (arrows) to default, straight or A*.
167168
<img src="./assets/edge-path-styles.png" alt="Edge Path Styles Example"/>
168169
</details>
169170

171+
## Custom Colors
172+
Add custom colors to the color picker. You can add them using the following css snippet:
173+
```css
174+
:root {
175+
/* Where X is the index of the color in the palette */
176+
/* The colors 1-6 are already used by Obsidian */
177+
--canvas-color-X: 0, 255, 0; /* RGB */
178+
}
179+
```
180+
181+
<details>
182+
<summary>Custom Colors In Palette</summary>
183+
<img src="./assets/custom-colors.png" alt="Custom Colors In Palette"/>
184+
</details>
185+
170186
## Stickers
171187
Convert image nodes to stickers. Stickers have a transparent background and no border.
172188

assets/custom-colors.png

15.1 KB
Loading

src/canvas-extensions/presentation-canvas-extension.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ export default class PresentationCanvasExtension {
8989

9090
onPopupMenuCreated(canvas: Canvas): void {
9191
// If the canvas is readonly or there are multiple/no nodes selected, return
92-
const selectedNodeData = canvas.getSelectionData().nodes
93-
if (canvas.readonly || selectedNodeData.length !== 1) return
92+
const selectedNodesData = canvas.getSelectionData().nodes
93+
if (canvas.readonly || selectedNodesData.length !== 1 || canvas.selection.size > 1) return
9494

95-
const selectedNode = canvas.nodes.get(selectedNodeData[0].id)
95+
const selectedNode = canvas.nodes.get(selectedNodesData[0].id)
9696
if (!selectedNode) return
9797

9898
CanvasHelper.addPopupMenuOption(

0 commit comments

Comments
 (0)