-
-
Notifications
You must be signed in to change notification settings - Fork 47
Feat/editor/colored image preview #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
cab75c1
feat(react: editor preview): add preview image option - show colored β¦
Ryan-Millard 781f7a2
fix(react: editor preview): color lost on interaction bug
Ryan-Millard 8acd09d
fix(eslint errors): defined & never used
Ryan-Millard 8de4dd2
style(react: editor page): format all files
Ryan-Millard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,89 @@ | ||
| .svgContainer { | ||
| /* Viewport that handles pan/zoom (clipped) */ | ||
| .viewport { | ||
| position: relative; | ||
| width: 100%; | ||
| aspect-ratio: 1 / 1; /* or width/height ratio of your image */ | ||
| overflow: hidden; | ||
| } | ||
| .svgContainer svg { | ||
| transition: | ||
| transform 180ms ease, | ||
| box-shadow 180ms ease; | ||
| min-height: 360px; | ||
| width: 100%; | ||
| height: 100%; | ||
| max-height: 90vh; | ||
| cursor: grab; | ||
| background: transparent; | ||
| } | ||
|
|
||
| /* Default path appearance */ | ||
| .svgContainer svg path:not(#svgContainerColouredPath) { | ||
| stroke: var(--color-text); | ||
| stroke-width: 0.25; | ||
| .colorMode .viewport svg path:not(.coloredRegion) { | ||
| fill: white; | ||
| cursor: pointer; | ||
| transition: 150ms ease; | ||
| } | ||
|
|
||
| /* while dragging */ | ||
| .viewport.grabbing { | ||
| cursor: grabbing; | ||
| } | ||
|
|
||
| /* Inner wrapper where we apply transform(scale/translate) */ | ||
| .inner { | ||
| transform-origin: 0 0; | ||
| will-change: transform; | ||
| transition: transform 50ms linear; | ||
| display: inline-block; | ||
| } | ||
|
|
||
| /* Preserve the svg natural sizing β do not force fill/fit */ | ||
| .inner svg { | ||
| display: block; | ||
| } | ||
|
|
||
| /* Enable interaction on primitives */ | ||
| /* Default path appearance: keep original fills untouched by CSS (we manipulate via JS) */ | ||
| .inner svg path, | ||
| .inner svg rect, | ||
| .inner svg circle, | ||
| .inner svg polygon, | ||
| .inner svg g { | ||
| pointer-events: all; | ||
|
|
||
| stroke: #000; | ||
| stroke-width: 0.5; | ||
| cursor: pointer; | ||
| transition: | ||
| stroke 80ms ease, | ||
| stroke-width 80ms ease, | ||
| opacity 80ms ease; | ||
| opacity: 0.98; | ||
| } | ||
|
|
||
| /* hover outline only (doesn't override fills) */ | ||
| .inner svg path:hover, | ||
| .inner svg rect:hover, | ||
| .inner svg circle:hover, | ||
| .inner svg polygon:hover, | ||
| .inner svg g:hover { | ||
| stroke: var(--color-primary); | ||
| stroke-width: 0.9; | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| /* preview mode: disable interaction but keep visual state */ | ||
| .previewMode svg path, | ||
| .previewMode svg rect, | ||
| .previewMode svg circle, | ||
| .previewMode svg polygon, | ||
| .previewMode svg g { | ||
| pointer-events: none; | ||
| } | ||
|
|
||
| .hint { | ||
| margin-top: 12px; | ||
| font-size: 0.85rem; | ||
| text-align: center; | ||
| } | ||
|
|
||
| /* responsiveness */ | ||
| @media (max-width: 800px) { | ||
| .viewport { | ||
| min-height: 240px; | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.