ras0q / obsidian-graph-banner

An Obsidian plugin to display a local graph view to the note header.
MIT License
34 stars 0 forks source link

[FR] Hover to expand the graph? #57

Closed Moyf closed 1 month ago

Moyf commented 1 month ago

Hey! I tried to use css to add :hover() property:


.view-content.graph-banner-content:hover {
    max-height: 300px;
    transition: all 0.2s;
}

But I found that the canvas doesn't expand: demo

Is there some way to expand the Canvas with the container (or make the canvas height bigger than 100% ?)

ras0q commented 1 month ago

Normal local graphs opened by the command are resizable. Local graphs on banner also should be able to resize, but they seem not resizable. image

I think that the following processing in app.js used for Obsidian has been dislodged when moving the Element. If you would be willing to investigate this, please?

            e.prototype.onResize = function() {
                var e = this
                  , t = e.px
                  , n = e.hanger
                  , i = e.containerEl
                  , r = e.interactiveEl
                  , o = window.devicePixelRatio
                  , a = i.clientWidth
                  , s = i.clientHeight;
                if (this.width = a,
                this.height = s,
                t) {
                    var l = Math.round(a * o)
                      , c = Math.round(s * o)
                      , u = t.renderer
                      , h = u.width
                      , p = u.height;
                    u.view.style.width = a + "px",
                    u.view.style.height = s + "px",
                    u.resize(l, c),
                    r.width = a,
                    r.height = s,
                    t.renderer.events.resolutionChange(1 / o),
                    n && this.setPan(this.panX + (l - h) / 2, this.panY + (c - p) / 2)
                }
                this.changed()
            }
Moyf commented 1 month ago

Normal local graphs opened by the command are resizable. Local graphs on banner also should be able to resize, but they seem not resizable. image

I think that the following processing in app.js used for Obsidian has been dislodged when moving the Element. If you would be willing to investigate this, please?

            e.prototype.onResize = function() {
                var e = this
                  , t = e.px
                  , n = e.hanger
                  , i = e.containerEl
                  , r = e.interactiveEl
                  , o = window.devicePixelRatio
                  , a = i.clientWidth
                  , s = i.clientHeight;
                if (this.width = a,
                this.height = s,
                t) {
                    var l = Math.round(a * o)
                      , c = Math.round(s * o)
                      , u = t.renderer
                      , h = u.width
                      , p = u.height;
                    u.view.style.width = a + "px",
                    u.view.style.height = s + "px",
                    u.resize(l, c),
                    r.width = a,
                    r.height = s,
                    t.renderer.events.resolutionChange(1 / o),
                    n && this.setPan(this.panX + (l - h) / 2, this.panY + (c - p) / 2)
                }
                this.changed()
            }

Oh hi! Thank you very much for your investigation and response.

So is this a special handling within the Obsidian app? 🤔 I think this is beyond my capabilities... and I can put this request on hold for now.

Thanks again!