mirror of https://github.com/logseq/logseq
Graph dot size increases when there're more linked references
parent
687cb46383
commit
6d9f4cb803
|
@ -275,10 +275,10 @@
|
|||
[repo :block/block block-id])))
|
||||
[config id]
|
||||
(let [blocks (db/get-block-and-children (state/get-current-repo) id)]
|
||||
[:div.embed-block.py-2.my-2.px-3.bg-base-2 {:style {:z-index 2}}
|
||||
[:p
|
||||
[:code "Embed block:"]]
|
||||
(blocks-container blocks (assoc config :embed? true))]))
|
||||
[:div.embed-block.bg-base-2 {:style {:z-index 2}}
|
||||
[:code "Embed block:"]
|
||||
[:div.px-2
|
||||
(blocks-container blocks (assoc config :embed? true))]]))
|
||||
|
||||
(rum/defc page-embed < rum/reactive
|
||||
(db-mixins/clear-query-cache
|
||||
|
@ -295,7 +295,7 @@
|
|||
[:p
|
||||
[:code "Embed page:"]
|
||||
[:a.ml-2 {:href (str "/page/" (util/encode-str page-name))}
|
||||
page-original-name]]
|
||||
(or page-original-name page-name)]]
|
||||
(blocks-container blocks (assoc config :embed? true))]))
|
||||
|
||||
(defn- get-label-text
|
||||
|
@ -310,6 +310,13 @@
|
|||
(when-let [label-text (get-label-text label)]
|
||||
(db/entity [:page/name (string/lower-case label-text)])))
|
||||
|
||||
(defn- macro->text
|
||||
[name arguments]
|
||||
(if (and (seq arguments)
|
||||
(not= arguments ["null"]))
|
||||
(util/format "{{{%s %s}}}" name (string/join ", " arguments))
|
||||
(util/format "{{{%s}}}" name)))
|
||||
|
||||
(defn inline
|
||||
[{:keys [html-export?] :as config} item]
|
||||
(match item
|
||||
|
@ -567,10 +574,10 @@
|
|||
(or
|
||||
macro-content
|
||||
[:span.warning {:title (str "Unsupported macro name: " name)}
|
||||
(util/format "{{{%s %s}}}" name (string/join ", " arguments))]))])
|
||||
(macro->text name arguments)]))])
|
||||
|
||||
[:span
|
||||
(util/format "{{{%s %s}}}" name (string/join ", " arguments))])))
|
||||
(macro->text name arguments)])))
|
||||
|
||||
:else
|
||||
""))
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
(defn- dot-mode
|
||||
[node ctx global-scale dark?]
|
||||
(let [label (gobj/get node "id")
|
||||
val (gobj/get node "val")
|
||||
font-size (/ 15 global-scale)
|
||||
arc-radius (/ 3 global-scale)
|
||||
x (gobj/get node "x")
|
||||
|
@ -83,13 +84,16 @@
|
|||
color (gobj/get node "color")]
|
||||
(set! (.-fillStyle ctx) color)
|
||||
(.beginPath ctx)
|
||||
(.arc ctx x y arc-radius 0 (* 2 js/Math.PI) false)
|
||||
(.arc ctx x y (if (zero? val)
|
||||
arc-radius
|
||||
(* arc-radius (js/Math.sqrt (js/Math.sqrt val)))) 0 (* 2 js/Math.PI) false)
|
||||
(set! (.-fillStyle ctx) (if dark? "#aaa" "#222"))
|
||||
(.fill ctx)))
|
||||
|
||||
(defn- dot-text-mode
|
||||
[node ctx global-scale dark?]
|
||||
(let [label (gobj/get node "id")
|
||||
val (gobj/get node "val")
|
||||
font-size (/ 15 global-scale)
|
||||
arc-radius (/ 3 global-scale)
|
||||
_ (set! (.-font ctx)
|
||||
|
@ -102,10 +106,14 @@
|
|||
(set! (.-filltextAlign ctx) "center")
|
||||
(set! (.-textBaseLine ctx) "middle")
|
||||
(set! (.-fillStyle ctx) color)
|
||||
(.fillText ctx label (- x (/ text-width 2)) (- y (/ 9 global-scale)))
|
||||
(.fillText ctx label
|
||||
(- x (/ text-width 2))
|
||||
(- y (/ 9 global-scale)))
|
||||
|
||||
(.beginPath ctx)
|
||||
(.arc ctx x y arc-radius 0 (* 2 js/Math.PI) false)
|
||||
(.arc ctx x y (if (zero? val)
|
||||
arc-radius
|
||||
(* arc-radius (js/Math.sqrt (js/Math.sqrt val)))) 0 (* 2 js/Math.PI) false)
|
||||
(set! (.-fillStyle ctx)
|
||||
(if (= (gobj/get node "id") @hover-node)
|
||||
(if dark? "#A3BFFA" "#4C51BF")
|
||||
|
@ -175,10 +183,10 @@
|
|||
{:page page}))
|
||||
(route-handler/redirect! {:to :page
|
||||
:path-params {:name (util/url-encode page-name)}})))))
|
||||
:cooldownTicks 100
|
||||
:onEngineStop (fn []
|
||||
(when-let [ref (:ref-atom option)]
|
||||
(.zoomToFit @ref 400)))
|
||||
;; :cooldownTicks 100
|
||||
;; :onEngineStop (fn []
|
||||
;; (when-let [ref (:ref-atom option)]
|
||||
;; (.zoomToFit @ref 400)))
|
||||
:nodeCanvasObject
|
||||
(fn [node ^CanvasRenderingContext2D ctx global-scale]
|
||||
(case @graph-mode
|
||||
|
|
|
@ -33,4 +33,5 @@
|
|||
error-files (atom #{})]
|
||||
(index-files! repo files error-files)
|
||||
(when (seq @error-files)
|
||||
(index-files! repo @error-files (atom nil))))))
|
||||
(index-files! repo @error-files (atom nil)))
|
||||
(notification/show! "Importing finished!" :success))))
|
||||
|
|
Loading…
Reference in New Issue