mirror of
https://github.com/penpot/penpot.git
synced 2026-06-09 08:52:05 +00:00
📚 Fix several typos on code comments and messages (#9946)
Signed-off-by: John E <jeis4wpi@outlook.com>
This commit is contained in:
parent
d7c155ac4f
commit
c156559f2c
@ -17,7 +17,7 @@
|
||||
|
||||
(defmacro select-keys
|
||||
"A macro version of `select-keys`. Useful when keys vector is known
|
||||
at compile time (aprox 600% performance boost).
|
||||
at compile time (approx 600% performance boost).
|
||||
|
||||
It is not 100% equivalent, this macro does not removes not existing
|
||||
keys in contrast to clojure.core/select-keys"
|
||||
|
||||
@ -1194,7 +1194,7 @@
|
||||
;; frames. Return the ids of the frames affected
|
||||
|
||||
(defn- parents-frames
|
||||
"Go trough the parents and get all of them that are a frame."
|
||||
"Go through the parents and get all of them that are a frame."
|
||||
[id objects]
|
||||
(->> (cfh/get-parents-with-self objects id)
|
||||
(filter cfh/frame-shape?)))
|
||||
|
||||
@ -591,7 +591,7 @@
|
||||
-it should be a main component
|
||||
-its parent should be a variant-container
|
||||
-its variant-name is derived from the properties
|
||||
-its name should be tha same as its parent's
|
||||
-its name should be the same as its parent's
|
||||
"
|
||||
[shape file page]
|
||||
(let [parent (ctst/get-shape page (:parent-id shape))
|
||||
@ -707,7 +707,7 @@
|
||||
|
||||
(if (#{:main-top :main-nested :main-any} context)
|
||||
(report-error :not-component-not-allowed
|
||||
"Not compoments are not allowed inside a main"
|
||||
"Not components are not allowed inside a main"
|
||||
shape file page)
|
||||
(check-shape-not-component shape file page libraries)))))))))
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
[app.common.types.variant :as ctv]))
|
||||
|
||||
(defn find-variant-components
|
||||
"Find a list of the components thet belongs to this variant-id"
|
||||
"Find a list of the components that belongs to this variant-id"
|
||||
([data variant-id]
|
||||
(let [page-id (->> data
|
||||
:components
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
;; modif-tree))))
|
||||
|
||||
(defn- set-children-modifiers
|
||||
"Propagates the modifiers from a parent too its children applying constraints if necesary"
|
||||
"Propagates the modifiers from a parent too its children applying constraints if necessary"
|
||||
[modif-tree children objects bounds parent transformed-parent-bounds ignore-constraints]
|
||||
(let [modifiers (dm/get-in modif-tree [(:id parent) :modifiers])]
|
||||
;; Move modifiers don't need to calculate constraints
|
||||
|
||||
@ -264,7 +264,7 @@
|
||||
:scale)))
|
||||
|
||||
(defn normalize-modifiers
|
||||
"Before aplying constraints we need to remove the deformation caused by the resizing of the parent"
|
||||
"Before applying constraints we need to remove the deformation caused by the resizing of the parent"
|
||||
[constraints-h constraints-v modifiers
|
||||
child-bounds transformed-child-bounds parent-bounds transformed-parent-bounds]
|
||||
|
||||
|
||||
@ -369,7 +369,7 @@
|
||||
|
||||
|
||||
(defn line-line-intersect
|
||||
"Calculates the interesection point for two lines given by the points a-b and b-c"
|
||||
"Calculates the intersection point for two lines given by the points a-b and b-c"
|
||||
[a b c d]
|
||||
|
||||
(let [;; Line equation representation: ax + by + c = 0
|
||||
|
||||
@ -31,21 +31,21 @@
|
||||
(gpt/scale val)))
|
||||
|
||||
(defn end-hv
|
||||
"Horizontal vector from the oposite to the origin in the x axis with a magnitude `val`"
|
||||
"Horizontal vector from the opposite to the origin in the x axis with a magnitude `val`"
|
||||
[[p0 p1 _ _] val]
|
||||
(-> (gpt/to-vec p1 p0)
|
||||
(gpt/unit)
|
||||
(gpt/scale val)))
|
||||
|
||||
(defn start-vv
|
||||
"Vertical vector from the oposite to the origin in the x axis with a magnitude `val`"
|
||||
"Vertical vector from the opposite to the origin in the x axis with a magnitude `val`"
|
||||
[[p0 _ _ p3] val]
|
||||
(-> (gpt/to-vec p0 p3)
|
||||
(gpt/unit)
|
||||
(gpt/scale val)))
|
||||
|
||||
(defn end-vv
|
||||
"Vertical vector from the oposite to the origin in the x axis with a magnitude `val`"
|
||||
"Vertical vector from the opposite to the origin in the x axis with a magnitude `val`"
|
||||
[[p0 _ _ p3] val]
|
||||
(-> (gpt/to-vec p3 p0)
|
||||
(gpt/unit)
|
||||
|
||||
@ -283,7 +283,7 @@
|
||||
[selrect transform (when (some? transform) (gmt/inverse transform))]))
|
||||
|
||||
(defn- adjust-shape-flips
|
||||
"After some tranformations the flip-x/flip-y flags can change we need
|
||||
"After some transformations the flip-x/flip-y flags can change we need
|
||||
to check this before adjusting the selrect"
|
||||
[shape points]
|
||||
(let [points' (dm/get-prop shape :points)
|
||||
|
||||
@ -90,7 +90,7 @@
|
||||
child-seq)))
|
||||
|
||||
(defn resolve-subtree
|
||||
"Resolves the subtree but only partialy from-to the parameters"
|
||||
"Resolves the subtree but only partially from-to the parameters"
|
||||
[from-id to-id objects]
|
||||
(concat
|
||||
(->> (get-children-seq from-id objects)
|
||||
|
||||
@ -159,7 +159,7 @@
|
||||
group)))
|
||||
|
||||
(defn component-attr?
|
||||
"Check if some attribute is one that is involved in component syncrhonization.
|
||||
"Check if some attribute is one that is involved in component synchronization.
|
||||
Note that design tokens also are involved, although they go by an alternate
|
||||
route and thus they are not part of :sync-attrs.
|
||||
Also when detaching a nested copy it also needs to trigger a synchronization,
|
||||
|
||||
@ -405,7 +405,7 @@
|
||||
(map remap-ids new-shapes)])))
|
||||
|
||||
(defn get-first-valid-parent
|
||||
"Go trough the parents until we find a shape that is not a copy of a component nor
|
||||
"Go through the parents until we find a shape that is not a copy of a component nor
|
||||
a variant container."
|
||||
[objects id]
|
||||
(let [shape (get objects id)]
|
||||
@ -517,7 +517,7 @@
|
||||
:any-main-descendant any-main-descendant}))
|
||||
|
||||
(defn find-valid-parent-and-frame-ids
|
||||
"Navigate trough the ancestors until find one that is valid. Returns [ parent-id frame-id ]"
|
||||
"Navigate through the ancestors until find one that is valid. Returns [ parent-id frame-id ]"
|
||||
([parent-id objects children]
|
||||
(find-valid-parent-and-frame-ids parent-id objects children false nil nil))
|
||||
([parent-id objects children pasting? libraries]
|
||||
|
||||
@ -8,10 +8,10 @@
|
||||
"Implements a specialized map-like data structure for store an UUID =>
|
||||
OBJECT mappings. The main purpose of this data structure is be able
|
||||
to serialize it on fressian as byte-array and have the ability to
|
||||
decode each field separatelly without the need to decode the whole
|
||||
decode each field separately without the need to decode the whole
|
||||
map from the byte-array.
|
||||
|
||||
It works transparently, so no aditional dynamic vars are needed. It
|
||||
It works transparently, so no additional dynamic vars are needed. It
|
||||
only works by reference equality and the hash-code is calculated
|
||||
properly from each value."
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
This NS allows separate context-less/dependency-less helpers from
|
||||
other path related namespaces and make proper domain-specific
|
||||
namespaces without incurrying on circular depedency cycles."
|
||||
namespaces without incurrying on circular dependency cycles."
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.data.macros :as dm]
|
||||
@ -192,7 +192,7 @@
|
||||
(defn solve-roots*
|
||||
"Solvers a quadratic or cubic equation given by the parameters a b c d.
|
||||
|
||||
Implemented as reduction algorithm (this helps implemement
|
||||
Implemented as reduction algorithm (this helps implement
|
||||
derivative algorithms that does not require intermediate results
|
||||
thanks to transducers."
|
||||
[result conj a b c d]
|
||||
@ -794,5 +794,3 @@
|
||||
#_:else false))]
|
||||
|
||||
(some inside-border? content)))
|
||||
|
||||
|
||||
|
||||
@ -729,7 +729,7 @@
|
||||
(cond-> (ctsl/any-layout? shape) (extract-layout-attrs shape))))))
|
||||
|
||||
(defn patch-props
|
||||
"Given the object of `extract-props` applies it to a shape. Adapt the shape if necesary"
|
||||
"Given the object of `extract-props` applies it to a shape. Adapt the shape if necessary"
|
||||
[shape props objects]
|
||||
|
||||
(letfn [(patch-text-props [shape props]
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defn- schema-keys
|
||||
"Converts registed map schema into set of keys."
|
||||
"Converts registered map schema into set of keys."
|
||||
[schema]
|
||||
(->> schema
|
||||
(sm/schema)
|
||||
@ -42,7 +42,7 @@
|
||||
|
||||
(defn token-value-self-reference?
|
||||
"Check if the token is self referencing with its `token-name` in `token-value`.
|
||||
Simple 1 level check, doesn't account for circular self refernces across multiple tokens."
|
||||
Simple 1 level check, doesn't account for circular self references across multiple tokens."
|
||||
[token-name token-value]
|
||||
(let [token-references (find-token-value-references token-value)
|
||||
self-reference? (get token-references token-name)]
|
||||
|
||||
@ -1435,7 +1435,7 @@ Will return a value that matches this schema:
|
||||
(d/oassoc data hidden-theme-name (make-hidden-theme))))))
|
||||
|
||||
(defn map->tokens-lib
|
||||
"Make a new instance of TokensLib from a map, but skiping all
|
||||
"Make a new instance of TokensLib from a map, but skipping all
|
||||
validation; it is used for create new instances from trusted
|
||||
sources"
|
||||
[& {:keys [sets themes active-themes]}]
|
||||
@ -1552,7 +1552,7 @@ Will return a value that matches this schema:
|
||||
current-path: the path of the group being renamed, e.g. \"foo.bar\"
|
||||
current-name: the current name of the group being renamed, e.g. \"bar\"
|
||||
new-name: the new name for the group being renamed, e.g. \"baz\"
|
||||
|
||||
|
||||
Returns a sequence of [name token] for each renamed token."
|
||||
|
||||
[active-tokens current-path current-name new-name]
|
||||
@ -2222,7 +2222,7 @@ Will return a value that matches this schema:
|
||||
(get-themes tokens-lib)))
|
||||
|
||||
(defn fix-duplicate-token-set-ids
|
||||
"Given an instance of TokensLib fixes it internal sets data sturcture
|
||||
"Given an instance of TokensLib fixes it internal sets data structure
|
||||
for ensure each set has unique id;
|
||||
|
||||
Specific function for file data migrations"
|
||||
|
||||
@ -5,7 +5,7 @@ test.beforeEach(async ({ page }) => {
|
||||
await DashboardPage.init(page);
|
||||
});
|
||||
|
||||
test("Dashboad page has title ", async ({ page }) => {
|
||||
test("Dashboard page has title ", async ({ page }) => {
|
||||
const dashboardPage = new DashboardPage(page);
|
||||
|
||||
await dashboardPage.goToDashboard();
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
(defn is-plugin-error?
|
||||
"This is a placeholder that always return false. It will be
|
||||
overwritten when plugin system is initialized. This works this way
|
||||
because we can't import plugins here because plugins requries full
|
||||
because we can't import plugins here because plugins requires full
|
||||
DOM.
|
||||
|
||||
This placeholder is set on app.plugins/initialize event"
|
||||
@ -553,4 +553,3 @@
|
||||
(fn []
|
||||
(.removeEventListener g/window "error" on-unhandled-error)
|
||||
(.removeEventListener g/window "unhandledrejection" on-unhandled-rejection))))
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@
|
||||
;; DEPRECATED and all new code should not use it and old code should
|
||||
;; be gradually migrated to more efficient approach
|
||||
(def libraries
|
||||
"A derived state that contanins the currently loaded shared
|
||||
"A derived state that contains the currently loaded shared
|
||||
libraries with all its content; including the current file"
|
||||
(l/derived (fn [state]
|
||||
(let [files (get state :files)
|
||||
|
||||
@ -405,7 +405,7 @@
|
||||
(= k :type))))))
|
||||
|
||||
(defn create-shape
|
||||
"Instanciate a shape from a map"
|
||||
"Instantiate a shape from a map"
|
||||
[attrs]
|
||||
(ShapeProxy. (:id attrs)
|
||||
(:type attrs)
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
(from-data-transfer cdata options))))
|
||||
|
||||
(defn from-synthetic-clipboard-event
|
||||
"Get clipboard stream from syntetic clipboard event"
|
||||
"Get clipboard stream from synthetic clipboard event"
|
||||
([event options]
|
||||
(let [target
|
||||
(dom/get-target event)
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
"rectangle")
|
||||
:circle (if (cts/has-images? shape)
|
||||
"img"
|
||||
"elipse")
|
||||
"ellipse")
|
||||
:path (if (cts/has-images? shape)
|
||||
"img"
|
||||
"path")
|
||||
@ -85,4 +85,3 @@
|
||||
:mask "mask"
|
||||
:group "group"
|
||||
nil)))
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
:stops [{:color "#b400ff" :opacity 1 :offset 0}
|
||||
{:color "#0c3fd5" :opacity 1 :offset 1}]}]
|
||||
|
||||
(t/testing "Basic shape properites"
|
||||
(t/testing "Basic shape properties"
|
||||
(t/testing " - name"
|
||||
(set! (.-name shape) "TEST")
|
||||
(t/is (= (.-name shape) "TEST"))
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
(let [result (sm/expr-eval "*10" 20)]
|
||||
(t/is (= result 200))))
|
||||
|
||||
(t/testing "Evaluate a negative number (not relative substraction)"
|
||||
(t/testing "Evaluate a negative number (not relative subtraction)"
|
||||
(let [result (sm/expr-eval "-10" 20)]
|
||||
(t/is (= result -10))))
|
||||
|
||||
@ -107,4 +107,3 @@
|
||||
(t/testing "Partial invalid expression should return nil"
|
||||
(let [result (sm/expr-eval "10 + abc" 100)]
|
||||
(t/is (= result nil)))))
|
||||
|
||||
|
||||
@ -181,7 +181,7 @@ describe("Paragraph", () => {
|
||||
expect(isParagraphEnd(paragraph.firstElementChild.firstChild, 13)).toBeTruthy();
|
||||
});
|
||||
|
||||
test("isParagraphEnd should return false on a paragrah where the focus offset is inside", () => {
|
||||
test("isParagraphEnd should return false on a paragraph where the focus offset is inside", () => {
|
||||
const paragraph = createParagraph([
|
||||
createTextSpan(new Text("Lorem ipsum sit")),
|
||||
createTextSpan(new Text("amet")),
|
||||
|
||||
@ -111,7 +111,7 @@ describe("TextSpan", () => {
|
||||
expect(getTextSpanLength(emptyTextSpan)).toBe(0);
|
||||
});
|
||||
|
||||
test("splitTextSpan returns a new textSpan from the splitted textSpan", () => {
|
||||
test("splitTextSpan returns a new textSpan from the split textSpan", () => {
|
||||
const textSpan = createTextSpan(new Text("Hello, World!"));
|
||||
const newTextSpan = splitTextSpan(textSpan, 5);
|
||||
expect(newTextSpan).toBeInstanceOf(HTMLSpanElement);
|
||||
|
||||
@ -953,7 +953,7 @@ describe("SelectionController", () => {
|
||||
);
|
||||
});
|
||||
|
||||
test("`replaceTextSpans` should replace the selected text in multiple text spans (2 completelly selected)", () => {
|
||||
test("`replaceTextSpans` should replace the selected text in multiple text spans (2 completely selected)", () => {
|
||||
const textEditorMock = TextEditorMock.createTextEditorMockWith([[
|
||||
"Hello, ",
|
||||
"World!",
|
||||
@ -1040,7 +1040,7 @@ describe("SelectionController", () => {
|
||||
);
|
||||
});
|
||||
|
||||
test("`replaceTextSpans` should replace the selected text in multiple text spans (1 partially selected, 1 completelly selected)", () => {
|
||||
test("`replaceTextSpans` should replace the selected text in multiple text spans (1 partially selected, 1 completely selected)", () => {
|
||||
const textEditorMock = TextEditorMock.createTextEditorMockWith([[
|
||||
"Hello, ",
|
||||
"World!",
|
||||
@ -1082,7 +1082,7 @@ describe("SelectionController", () => {
|
||||
|
||||
// FIXME: I don't know why but this test blocks all the tests.
|
||||
/*
|
||||
test.skip("`replaceTextSpans` should replace the selected text in multiple text spans (1 completelly selected, 1 partially selected)", () => {
|
||||
test.skip("`replaceTextSpans` should replace the selected text in multiple text spans (1 completely selected, 1 partially selected)", () => {
|
||||
const textEditorMock = TextEditorMock.createTextEditorMockWithParagraph([
|
||||
createTextSpan(new Text("Hello, ")),
|
||||
createTextSpan(new Text("World!")),
|
||||
|
||||
@ -149,7 +149,7 @@ Stroke caps are serialized as `u8`:
|
||||
| 7 | Square |
|
||||
| \_ | None |
|
||||
|
||||
## Stroke Sytles
|
||||
## Stroke Styles
|
||||
|
||||
Stroke styles are serialized as `u8`:
|
||||
|
||||
|
||||
@ -82,14 +82,14 @@ Once the tiles are determined, we sort them starting from the center of the view
|
||||
2. The `TileViewbox` is updated based on the new `Viewbox` (visible area plus margins of interest).
|
||||
3. The system identifies tiles that are currently visible (`visible_rect`) and tiles just outside the viewport for preloading (`interest_rect`).
|
||||
4. For each visible tile:
|
||||
- **If cached**:
|
||||
- **If cached**:
|
||||
- Draw the cached rendered tile directly from `TileTextureCache` to `Surface::Target`.
|
||||
- **If not cached**:
|
||||
- Fetch intersecting shapes using `TileHashMap`.
|
||||
- Render shape layers onto temporary surfaces:
|
||||
- **Fills** → Shape fills
|
||||
- **Strokes** → Outlines
|
||||
- **Shadows** → Visual effects like drop or inner shadows to shapes
|
||||
- Render shape layers onto temporary surfaces:
|
||||
- **Fills** → Shape fills
|
||||
- **Strokes** → Outlines
|
||||
- **Shadows** → Visual effects like drop or inner shadows to shapes
|
||||
- **Current** → Composite tile layer (the final rendered tile before caching)
|
||||
- **Target** → Final canvas image where the composed tile is drawn; this is the surface ultimately displayed on screen after composing the tile layers.
|
||||
- Compose and cache the result using `cache_current_tile_texture(tile, image)`.
|
||||
@ -132,7 +132,7 @@ When zooming or panning:
|
||||
> 💡 `visible_rect` stores the current set of tiles that intersect with the viewbox — that is, the exact area visible on screen, without any margin of interest.
|
||||
|
||||
- These tiles are either:
|
||||
- Pulled from the cache, or
|
||||
- Pulled from the cache, or
|
||||
- Rendered from scratch if not already available.
|
||||
|
||||
### Handling Zoom and Scale
|
||||
@ -181,28 +181,28 @@ Each rendering frame begins with the following inputs:
|
||||
- `Viewbox`: Defines the current viewport — the visible portion of the canvas, including zoom level and position.
|
||||
- `timestamp`: A time marker used for animations and time-based updates.
|
||||
|
||||
2. **Compute `TileViewbox`**
|
||||
2. **Compute `TileViewbox`**
|
||||
- From `Viewbox`, generate visible + interest regions.
|
||||
|
||||
3. **Determine tiles to render**
|
||||
3. **Determine tiles to render**
|
||||
- Compare tiles to be rendered vs cached ones.
|
||||
- Detect cache hits and misses.
|
||||
- Invalidate stale tiles if the viewport changed significantly.
|
||||
|
||||
4. **Render cached tiles**
|
||||
4. **Render cached tiles**
|
||||
- Fetch image from `TileTextureCache`.
|
||||
- Blit to `Surface::Target`.
|
||||
|
||||
5. **Render uncached tiles from scratch**
|
||||
5. **Render uncached tiles from scratch**
|
||||
- Find the shapes intersecting with this tile (`TileHashMap`).
|
||||
- Render the tile layers on their `skia::Surface` instances, using blending, opacity, masking, etc. when needed.
|
||||
- Each layer is rendered on a `skia::Surface`.
|
||||
- Use blending, opacity, masking, etc.
|
||||
- Store the resulting texture in the cache:
|
||||
- Store the resulting texture in the cache:
|
||||
`cache_current_tile_texture(tile, image)`
|
||||
- Draw the tile to `Surface::Target`.
|
||||
|
||||
6. **Handle user interactions**
|
||||
6. **Handle user interactions**
|
||||
- When shapes are modified:
|
||||
1. Determine affected tiles.
|
||||
2. Invalidate those tiles in the cache.
|
||||
@ -217,7 +217,7 @@ Each rendering frame begins with the following inputs:
|
||||
- **Avoid unnecessary re-renders**: A cache is used to avoid re-rendering when nothing has changed.
|
||||
- **Progressive**: Only visible/nearby tiles are drawn.
|
||||
- **Efficient**: Selective invalidation of cached tiles minimizes GPU/CPU usage on large documents.
|
||||
- **Scalable with screen siz**: Works well for both small and large canvases due to tile granularity and smart caching.
|
||||
- **Scalable with screen size**: Works well for both small and large canvases due to tile granularity and smart caching.
|
||||
|
||||
## References
|
||||
|
||||
@ -225,4 +225,4 @@ Each rendering frame begins with the following inputs:
|
||||
- [WebGL Best Practices](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices)
|
||||
- [When Optimisations Work, But for the Wrong Reasons](https://www.youtube.com/watch?v=hf27qsQPRLQ&ab_channel=SimonDev)
|
||||
- [Life of a Triangle](https://pixeljetstream.blogspot.com/2015/02/life-of-triangle-nvidias-logical.html)
|
||||
- [A Trip Through the Graphics Pipeline 2011](https://fgiesen.wordpress.com/2011/07/09/a-trip-through-the-graphics-pipeline-2011-index/)
|
||||
- [A Trip Through the Graphics Pipeline 2011](https://fgiesen.wordpress.com/2011/07/09/a-trip-through-the-graphics-pipeline-2011-index/)
|
||||
|
||||
@ -94,7 +94,7 @@ fn gpu_init() {
|
||||
fn render_init(width: i32, height: i32) {
|
||||
unsafe {
|
||||
let render_state =
|
||||
RenderState::try_new(width, height).expect("Cannot intialize RenderState");
|
||||
RenderState::try_new(width, height).expect("Cannot initialize RenderState");
|
||||
RENDER_STATE = Box::into_raw(Box::new(render_state));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user