0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 06:58:58 -05:00

Merge branch 'staging' into develop

This commit is contained in:
Andrey Antukh 2022-01-24 16:21:01 +01:00
commit 69daee4137
11 changed files with 106 additions and 104 deletions

78
.gitignore vendored
View file

@ -1,51 +1,51 @@
figwheel_server.log
*jar
*-init.clj
*.jar
*.penpot
.calva
.clj-kondo
.cpcache
.lein-deps-sum
.lein-failures
.lein-repl-history
.lein-plugins/
.repl
.lein-repl-history
.lsp
.nrepl-port
.cpcache
.rebel_readline_history
.nyc_output
/vendor/**/target
/cd.md
node_modules
/backend/target/
/backend/resources/public/media
/backend/resources/public/assets
.rebel_readline_history
.repl
/.clj-kondo/.cache
/_dump
/backend/-
/backend/assets/
/backend/dist/
/backend/logs/
/backend/-
/telemetry/
/frontend/npm-debug.log
/frontend/target/
/frontend/dist/
/frontend/out/
/frontend/.shadow-cljs
/frontend/resources/public/*
/frontend/resources/fonts/experiments
/exporter/target
/exporter/.shadow-cljs
/docker/images/bundle*
/common/.shadow-cljs
/common/target
/common/coverage
/.clj-kondo/.cache
clj-profiler/
/backend/resources/public/assets
/backend/resources/public/media
/backend/target/
/bundle*
/media
/cd.md
/clj-profiler/
/common/.shadow-cljs
/common/coverage
/common/target
/deploy
/web
/_dump
/vendor/svgclean/bundle*.js
.calva
.clj-kondo
.lsp
/docker/images/bundle*
/exporter/.shadow-cljs
/exporter/target
/frontend/.shadow-cljs
/frontend/cypress/videos/*/
/frontend/cypress/fixtures/validuser.json
/frontend/cypress/videos/*/
/frontend/dist/
/frontend/npm-debug.log
/frontend/out/
/frontend/resources/fonts/experiments
/frontend/resources/public/*
/frontend/target/
/media
/telemetry/
/vendor/**/target
/vendor/svgclean/bundle*.js
/web
clj-profiler/
figwheel_server.log
node_modules

View file

@ -73,6 +73,10 @@
- Show correctly group types label in handoff [Taiga #2482](https://tree.taiga.io/project/penpot/issue/2482)
- Display view mode buttons always centered in viewer [#Taiga 2466](https://tree.taiga.io/project/penpot/issue/2466)
- Fix default profile image generation issue [Taiga #2601](https://tree.taiga.io/project/penpot/issue/2601)
- Fix edit blur attributes for multiselection [Taiga #2625](https://tree.taiga.io/project/penpot/issue/2625)
- Fix auto hide header in viewer full screen [Taiga #2632](https://tree.taiga.io/project/penpot/issue/2632)
- Fix zoom in/out after fit or fill [Taiga #2630](https://tree.taiga.io/project/penpot/issue/2630)
- Normalize zoom levels in workspace and viewer [Taiga #2631](https://tree.taiga.io/project/penpot/issue/2631)
### :arrow_up: Deps updates

View file

@ -89,9 +89,9 @@
data (some-> params :file :tempfile fs/slurp-bytes blob/decode)]
(if (and data project-id)
(do
(let [fname (str "imported-file-" (dt/now))]
(m.files/create-file pool {:id (uuid/next)
:name "imported-file"
:name fname
:project-id project-id
:profile-id profile-id
:data data})

View file

@ -2,9 +2,10 @@
"A main namespace for server repl."
#_:clj-kondo/ignore
(:require
[app.common.data :as d]
[app.common.pages :as cp]
[app.common.uuid :as uuid]
[app.common.pages.migrations :as pmg]
[app.common.uuid :as uuid]
[app.config :as cfg]
[app.db :as db]
[app.db.sql :as sql]
@ -12,12 +13,12 @@
[app.rpc.queries.profile :as prof]
[app.srepl.dev :as dev]
[app.util.blob :as blob]
[cuerdas.core :as str]
[clojure.pprint :refer [pprint]]))
[clojure.pprint :refer [pprint]]
[cuerdas.core :as str]))
(defn update-file
([id f] (update-file id f false))
([id f save?]
([system id f] (update-file system id f false))
([system id f save?]
(db/with-atomic [conn (:app.db/pool system)]
(let [file (db/get-by-id conn :file id {:for-update true})
file (-> file

View file

@ -15,7 +15,7 @@
}
}
.fullscreen .viewer-layout:not(.force-visible) {
.fullscreen.viewer-layout:not(.force-visible) {
& .viewer-header {
width: 100%;
position: fixed;

View file

@ -23,10 +23,3 @@
:grid-alignment true
:background "var(--color-white)"})
(def zoom-levels
[0.01 0.03 0.05 0.07 0.09 0.10 0.11 0.13 0.15 0.18
0.20 0.21 0.22 0.23 0.24 0.25 0.27 0.28 0.30 0.32 0.34
0.36 0.38 0.40 0.42 0.44 0.46 0.48 0.50 0.54 0.57 0.60
0.63 0.66 0.69 0.73 0.77 0.81 0.85 0.90 0.95 1.00 1.05
1.10 1.15 1.21 1.27 1.33 1.40 1.47 1.54 1.62 1.70 1.78
1.87 1.96 2.00 2.16 2.27 2.38 2.50 2.62 2.75 2.88 3.00])

View file

@ -11,7 +11,6 @@
[app.common.spec :as us]
[app.common.types.interactions :as cti]
[app.common.uuid :as uuid]
[app.main.constants :as c]
[app.main.data.comments :as dcm]
[app.main.data.fonts :as df]
[app.main.repo :as rp]
@ -190,18 +189,14 @@
(ptk/reify ::increase-zoom
ptk/UpdateEvent
(update [_ state]
(let [increase #(nth c/zoom-levels
(+ (d/index-of c/zoom-levels %) 1)
(last c/zoom-levels))]
(let [increase #(min (* % 1.3) 200)]
(update-in state [:viewer-local :zoom] (fnil increase 1))))))
(def decrease-zoom
(ptk/reify ::decrease-zoom
ptk/UpdateEvent
(update [_ state]
(let [decrease #(nth c/zoom-levels
(- (d/index-of c/zoom-levels %) 1)
(first c/zoom-levels))]
(let [decrease #(max (/ % 1.3) 0.01)]
(update-in state [:viewer-local :zoom] (fnil decrease 1))))))
(def reset-zoom

View file

@ -413,6 +413,43 @@
;; Workspace State Manipulation
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; --- Toggle layout flag
(defn toggle-layout-flags
[& flags]
(ptk/reify ::toggle-layout-flags
ptk/UpdateEvent
(update [_ state]
(update state :workspace-layout
(fn [stored]
(reduce (fn [flags flag]
(if (contains? flags flag)
(disj flags flag)
(conj flags flag)))
stored
(d/concat-set flags)))))))
;; --- Set element options mode
(defn set-options-mode
[mode]
(us/assert ::options-mode mode)
(ptk/reify ::set-options-mode
ptk/UpdateEvent
(update [_ state]
(assoc-in state [:workspace-local :options-mode] mode))))
;; --- Tooltip
(defn assign-cursor-tooltip
[content]
(ptk/reify ::assign-cursor-tooltip
ptk/UpdateEvent
(update [_ state]
(if (string? content)
(assoc-in state [:workspace-local :tooltip] content)
(assoc-in state [:workspace-local :tooltip] nil)))))
;; --- Viewport Sizing
(declare increase-zoom)
@ -552,44 +589,6 @@
(-> state
(update :workspace-local dissoc :zooming)))))
;; --- Toggle layout flag
(defn toggle-layout-flags
[& flags]
(ptk/reify ::toggle-layout-flags
ptk/UpdateEvent
(update [_ state]
(update state :workspace-layout
(fn [stored]
(reduce (fn [flags flag]
(if (contains? flags flag)
(disj flags flag)
(conj flags flag)))
stored
(d/concat-set flags)))))))
;; --- Set element options mode
(defn set-options-mode
[mode]
(us/assert ::options-mode mode)
(ptk/reify ::set-options-mode
ptk/UpdateEvent
(update [_ state]
(assoc-in state [:workspace-local :options-mode] mode))))
;; --- Tooltip
(defn assign-cursor-tooltip
[content]
(ptk/reify ::assign-cursor-tooltip
ptk/UpdateEvent
(update [_ state]
(if (string? content)
(assoc-in state [:workspace-local :tooltip] content)
(assoc-in state [:workspace-local :tooltip] nil)))))
;; --- Zoom Management
(defn- impl-update-zoom

View file

@ -6,6 +6,7 @@
(ns app.main.ui.shapes.path
(:require
[app.common.logging :as log]
[app.main.ui.shapes.attrs :as attrs]
[app.main.ui.shapes.custom-stroke :refer [shape-custom-stroke]]
[app.util.object :as obj]
@ -20,10 +21,17 @@
(let [shape (unchecked-get props "shape")
content (:content shape)
pdata (mf/with-memo [content]
(upf/format-path content))
(try
(upf/format-path content)
(catch :default e
(log/error :hint "unexpected error on formating path"
:shape-name (:name shape)
:shape-id (:id shape)
:cause e)
"")))
props (-> (attrs/extract-style-attrs shape)
(obj/set! "d" pdata))]
[:& shape-custom-stroke {:shape shape}
[:> :path props]]))

View file

@ -222,7 +222,6 @@
blur-ids blur-values
stroke-ids stroke-values
text-ids text-values]
(mf/use-memo
(mf/deps objects-no-measures)
(fn []
@ -233,7 +232,7 @@
(get-attrs shapes objects-no-measures :constraint)
(get-attrs shapes objects-no-measures :fill)
(get-attrs shapes objects-no-measures :shadow)
(get-attrs shapes objects-no-measures :shadow)
(get-attrs shapes objects-no-measures :blur)
(get-attrs shapes objects-no-measures :stroke)
(get-attrs shapes objects-no-measures :text)])))]

View file

@ -6,6 +6,7 @@
(ns app.main.ui.workspace.viewport.outline
(:require
[app.common.exceptions :as ex]
[app.common.geom.shapes :as gsh]
[app.common.pages :as cp]
[app.main.refs :as refs]
@ -27,7 +28,9 @@
path-data
(mf/use-memo
(mf/deps shape)
#(when path? (upf/format-path (:content shape))))
#(when path?
(or (ex/ignoring (upf/format-path (:content shape)))
"")))
{:keys [x y width height selrect]} shape