Commit Graph

193 Commits (ae8e7aca1653e2c63fc96963d5e8b4e0ffc883c9)

Author SHA1 Message Date
Christopher Chedeau 4ff88ae03d
Fix caret for real! (#653)
Turns out the root cause was the outline. For some reason, doing "transparent" doesn't work but doing "1px solid transparent" does. Don't know why but I'll take it!
5 years ago
Christopher Chedeau 9a76556bea
Fixed wysiwyg carret disappearing on Chrome (#652)
There's a bug where the carret doesn't show up when the text is first focused on Chrome with the previous combination of CSS. I tweaked it and now it seems to work (don't ask me why!).

Unfortunately on Safari, ever since we moved to contentEditable on #274, the carret disappeared the first time. I unsuccessfully tried to repro in a smaller codebase ( https://jsfiddle.net/u2mjs90y/1/ ) but it does work in Safari...

I'm not exactly sure what's going on, there are bunch of issues opened against this bug when googling against all the browsers...
5 years ago
Christopher Chedeau 70db792549
Allow copy pasting inside of wysiwyg element (#651)
We did some hackery to prevent copy pasting when we didn't support multilines. But we do now so we can remove it.

Interestingly, newlines are actually <br /> elements. So we need to tweak the isInputLike logic a bit
5 years ago
Christopher Chedeau e50dc5dbed
Fix wysiwyg text overflow (#650)
By using position: fixed like the rest of the UI components, it will no longer make the body change size and have bad side effects like scrolling.

Fixes #365
5 years ago
David Luzar 3d2e59bfed
Revert "Feature: Multi Point Arrows (#338)" (#634)
This reverts commit 16263e942b.
5 years ago
Gasim Gasimzada 16263e942b
Feature: Multi Point Arrows (#338)
* Add points to arrow on double click

* Use line generator instead of path to generate line segments

* Switch color of the circle when it is on an existing point in the segment

* Check point against both ends of the line segment to find collinearity

* Keep drawing the arrow based on mouse position until shape is changed

* Always select the arrow when in multi element mode

* Use curves instead of lines when drawing arrow points

* Add basic collision detection with some debug points

* Use roughjs shape when performing hit testing

* Draw proper handler rectangles for arrows

* Add argument to renderScene in export

* Globally resize all points on the arrow when bounds are resized

* Hide handler rectangles if an arrow has no size

- Allow continuing adding arrows when selected element is deleted

* Add dragging functionality to arrows

* Add SHIFT functionality to two point arrows

- Fix arrow positions when scrolling
- Revert the element back to selection when not in multi select mode

* Clean app state for export (JSON)

* Set curve options manually instead of using global options

- For some reason, this fixed the flickering issue in all shapes when arrows are rendered

* Set proper options for the arrow

* Increaase accuracy of hit testing arrows

- Additionally, skip testing if point is outside the domain of arrow and each curve

* Calculate bounding box of arrow based on roughjs curves

- Remove domain check per curve

* Change bounding box threshold to 10 and remove unnecessary code

* Fix handler rectangles for 2 and multi point arrows

- Fix margins of handler rectangles when using arrows
- Show handler rectangles in endpoints of 2-point arrows

* Remove unnecessary values from app state for export

* Use `resetTransform` instead of "retranslating" canvas space after each element rendering

* Allow resizing 2-point arrows

- Fix position of one of the handler rectangles

* refactor variable initialization

* Refactored to extract out mult-point generation to the abstracted function

* prevent dragging on arrow creation if under threshold

* Finalize selection during multi element mode when ENTER or ESC is clicked

* Set dragging element to null when finalizing

* Remove pathSegmentCircle from code

* Check if element is any "non-value" instead of NULL

* Show two points on any two point arrow and fix visibility of arrows during scroll

* Resume recording when done with drawing

- When deleting a multi select element, revert back to selection element type

* Resize arrow starting points perfectly

* Fix direction of arrow resize based for NW

* Resume recording history when there is more than one arrow

* Set dragging element to NULL when element is not locked

* Blur active element when finalizing

* Disable undo/redo for multielement, editingelement, and resizing element

- Allow undoing parts of the arrow

* Disable element visibility for arrow

* Use points array for arrow bounds when bezier curve shape is not available

Co-authored-by: David Luzar <luzar.david@gmail.com>
Co-authored-by: Preet <833927+pshihn@users.noreply.github.com>
5 years ago
David Luzar 7b842fc330 simplify distance helper and factor out common bounds helper (#581)
* simplify distance helper

* factor out common bounds helper
5 years ago
lissitz 1bae203a78 changing new shape property sets it as default (#520)
* changing new shape property sets it as default

* set correct opacity while editing new test

Co-authored-by: Christopher Chedeau <vjeuxx@gmail.com>
5 years ago
Loris 413c387c7c Add onCancel callback to textWysiwyg for cleanup (#555) 5 years ago
David Luzar afb1d6725f
Normalize dimensions (#527)
* normalize dimensions of non-linear elements

* fix element type check regression
5 years ago
Jilles Soeters d65e90209c Allow multiline text (#535)
* Allow multiline text

* Figure out offset correctly

* Run prettier
5 years ago
Lipis ee68af0fd3
Set Trailing Cmma to (#525) 5 years ago
Günay Mert Karadoğan 926b4f24e6 Draw horizontal/vertical lines/arrows when shift pressed (#430)
* Draw horizontal/vertical lines/arrows when shift pressed

* Refactor resizing with delta

* Resize arrows/lines perfectly when shift pressed
5 years ago
Dvir Azulay a856ce06e9 Allow dragging transparent elements when selected (#508)
* Allow dragging transparent elements when selected

Addresses #339

* Update package.json
5 years ago
David Luzar 2340dddaad Sync panel props to editing element (#470)
* ensure panel props are sync to editing elem

* ensure we don't create empty-text elements (fixes #468)

* remove dead code

Co-authored-by: Christopher Chedeau <vjeuxx@gmail.com>
5 years ago
Günay Mert Karadoğan d505c6615d Fix reversed cursor issues on resize with bi-directional cursors (#451) 5 years ago
Faustino Kialungila 86cb228df4 Trim wysiwyg text to avoid misalignment on Firefox (#454) 5 years ago
Sosuke Suzuki 5563dd30d7 Modify to ignore enter-key in IME composing (#446) 5 years ago
Günay Mert Karadoğan 8bc049a0b9 Remove resized element if it is invisibly small (#405) 5 years ago
Bakhtiiar Muzakparov 8db8827c6f feat: add line shape (#371)
* feat: add line shape

* fix: align line tool

* fix: hitbox bug sw to ne

* fix: add stroke width n sloppiness  for line

* fix: center line inside a panel box

* fix: use color as a unique key
5 years ago
Timur Khazamov 79aee53ff6 Redesign idea (#343)
* Redisign idea

* Code cleanup

* Fixed to right container

* Reoredered layout

* Reordering panels

* Export dialog

* Removed redunant code

* Fixed not removing temp canvas

* Fixed preview not using only selected elements

* Returned file name on export

* Toggle export selected/all elements

* Hide copy to clipboard button if no support of clipboard

* Added border to swatches

* Fixed modal flickering
5 years ago
Preet 8dbd1b80df Update to rough.js 4.0.1 (#363)
* upgrade to latest rough.js

* remove random.ts because roughjs now supports seeding.
5 years ago
David Luzar 5887be6eda select filled elements by clicking inside (#340) 5 years ago
Christopher Chedeau 407f00bbd5
Fix alt-duplicate (#326)
We need to unselect all the previous elements and select all the new ones. Also made sure that the shape is regenerated when the element is duplicated
5 years ago
Gasim Gasimzada 74764b06eb Regenerate roughjs shape only when the item is updated (#316)
* Regenerate roughjs shape only when the item is updated

* Remove shape object during export and history undo/redo

* Remove shape element during copying

* Fix shape generation during creation
5 years ago
dwelle 81f23a8ccb fix text shape contenteditable & paste handling (fixes #293) 5 years ago
Gasim Gasimzada f2346275ef
Extract Side Panel from App component (#295)
* Extract Side Panel from App component

* Refactor SidePanel component

- Remove unnecessary props (we are already passing appState as a prop)
- Remove unnecessary allback (we are already passing setState)
5 years ago
Gasim Gasimzada 862231da4f Make all operations on elements array immutable (#283)
* Make scene functions return array instead of mutate array

- Not all functions were changes; so the given argument was a new array to some

* Make data restoration functions immutable

- Make mutations in App component

* Make history actions immutable

* Fix an issue in change property that was causing elements to be removed

* mark elements params as readonly & remove unnecessary copying

* Make `clearSelection` return a new array

* Perform Id comparisons instead of reference comparisons in onDoubleClick

* Allow deselecting items with SHIFT key

- Refactor hit detection code

* Fix a bug in element selection and revert drag functionality

Co-authored-by: David Luzar <luzar.david@gmail.com>
5 years ago
Guillermo Peralta Scura 4a044d3ace Show move and resize cursors on hover (#280)
* Change to move cursor on hover

* Show resize handlers on hover
5 years ago
Gasim Gasimzada 299e7e9099
Extract app and keys (#276)
* Extract app component from entrypoint (index)

- Use refs to refer to canvas and rough context
- Remove ReactDOM double rendering

* Extract keys and key related utils into their own module

* Move everything back to entrypoint
5 years ago
Timur Khazamov e38f65dea7
Contenteditable wysiwyg (#274)
* Contenteditable wysiwyg

* Added comment about pasting multiline text
5 years ago
Timur Khazamov 37934c0f8b
Fixes text jumping on creation (#266)
* Fixes text jumping on creation

* Do not remove node on ESC

* Fixed typo
5 years ago
David Luzar 2122a9cf9f
fix for duplicating elements (#261) 5 years ago
dwelle 08b804ac63 ensure only selected elems can be resized (fixes #256) 5 years ago
dwelle 009412a093 improve typing for handlerRectangles 5 years ago
Gasim Gasimzada 4b7eb2f04a
Add IDs to elements (#236)
* Add IDs to elements

- Move round rect function within the renderer

* Generate IDs using nanoid

* If element ID does not exist, add the ID during restoration
5 years ago
Faustino Kialungila 846f427732 adding comments about diamond dimensions (#241) 5 years ago
Timur Khazamov 10955f8bb0 Wysiwyg text 2.0 (#238)
* Fixed cleaning handlers after cleanup

* Double click to edit text

* Preserve text styles on change
5 years ago
Gasim Gasimzada 829a65b8cb
Refactor Element Functions (#233)
* Remove `generatedraw` from element object

- Create a function that renders a single element
- Refactor rendering selected elements

* Replace getElementAbsoluteXY with getElementAbsoluteCoords
5 years ago
Christopher Chedeau f2665408fc
Revert "Wysiwyg text (#200)" (#225)
This reverts commit abbc04df0e.
5 years ago
Timur Khazamov abbc04df0e Wysiwyg text (#200) 5 years ago
Timur Khazamov 7bf0184499
Fixed ellipse hit test if sizes are negative (#205) 5 years ago
Gasim Gasimzada 01805f734d
Extract element functions into modules (#207) 5 years ago