Code Monkey home page Code Monkey logo

tldraw's Introduction

tldraw

Welcome to the public monorepo for tldraw. tldraw is a library for creating infinite canvas experiences in React. It's the software behind the digital whiteboard tldraw.com.

Installation

npm i tldraw

Usage

import { Tldraw } from 'tldraw'
import 'tldraw/tldraw.css'

export default function App() {
	return (
		<div style={{ position: 'fixed', inset: 0 }}>
			<Tldraw />
		</div>
	)
}

Learn more at tldraw.dev.

Local development

The local development server will run our examples app. The basic example will show any changes you've made to the codebase.

To run the local development server, first clone this repo.

Install dependencies:

yarn

Start the local development server:

yarn dev

Open the example project at localhost:5420.

License

tldraw's source code and distributed packages are provided under the non-commercial tldraw license.

This license does not permit commercial use. If you wish to use tldraw in a commercial product or enterprise, you will need to purchase a commercial license. To obtain a commercial license, please contact us at [email protected].

To learn more, see our license page.

Trademarks

The tldraw name and logo are trademarks of tldraw. Please see our trademark guidelines for info on acceptable usage.

Community

Have questions, comments or feedback? Join our discord or start a discussion.

Contribution

Please see our contributing guide. Found a bug? Please submit an issue.

Contributors

Star History

Star History Chart

Contact

Find us on Twitter at @tldraw or email [email protected]. You can also join our discord for quick help and support.

tldraw's People

Contributors

alex-kim-dev avatar ali-alhaidary avatar brianhung avatar dependabot[bot] avatar ds300 avatar farazzshaikh avatar gabrielchl avatar ggallon avatar hiroshisuga avatar huppy-bot[bot] avatar jamesbvaughan avatar judicaelandria avatar leone25 avatar marcusstenbeck avatar milo- avatar mimecuvalo avatar mitjabezensek avatar orangemug avatar pengx17 avatar proful avatar proke03 avatar seflless avatar si14 avatar somehats avatar soyn avatar steveruizok avatar taha-hassan-git avatar taismassaro avatar todepond avatar with-heart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tldraw's Issues

Missing arrow body in exported png/svg

I have a drawing on beta.tldraw.com that I'm trying to export as PNG, but in the exported file, the arrow bodies are missing:

CleanShot.2022-12-21.at.15.37.03.mp4

This happens every time with these particular arrows, but I can't reproduce it with newly-drawn arrows on the same canvas. If I duplicate one of the "bad" arrows, the new arrow also doesn't export properly.

As a workaround, I can just delete and recreate the arrows. But let me know if there's any other info I can give you to help debug this.

[feature] Toast

Create a toast that displays when background events complete, such as copying to SVG.

[feature] VSCode Extension

We should should a VSCode extension that allows .tldr files to be read and edited from within VSCode.

Font Color for Shape Text?

In the previous version, when a line or shape included text, the text color would match the shape color. I'm seeing a different behavior in the beta. Will there be different functionality in the future where a user can color the text separately from the shape?

Old tl;draw

The text in this screenshot comes from double-clicking the shape and typing in the provided text area. This is not free-form text added separately. The color changes with the color selected for the shape in the color palette.
image

Beta tl;draw

I created the text in the same way for this screenshot (apart from lines not supporting text any more). The color of the text is always black, regardless of what color I select from the color palette.
image

[feature] Multiplayer

On the tldraw.com site, users will be able to visit rooms ("/room/some-room-id") in order to collaborate on a project.

I'm in touch with the team at liveblocks to provide the backend for this: there's already some initial architecture for the room that uses their API for presence.

To make it work, we'll need to sync both presence (i.e. who is in the room) and storage (the document).

File system

The new tldraw beta doesn't have the File > Open button to reopen a file I saved to my computer as .tldraw. Where did that go?

Text Alignment does not seem to do anything

The text is always centered regardless of its setting

Example file
{
    "shapes": [
        {
            "x": 0.29491460125234426,
            "y": -345.5603412935589,
            "rotation": 0,
            "id": "shape:YvhcYRPOxzC6DG39RZSty",
            "index": "a1",
            "type": "geo",
            "props": {
                "w": 259.70508539874766,
                "h": 95.5603412935589,
                "geo": "rectangle",
                "color": "red",
                "fill": "semi",
                "dash": "solid",
                "size": "s",
                "opacity": "1",
                "font": "draw",
                "text": "Left",
                "align": "start",
                "growY": 0
            },
            "parentId": "page:Y71oOJhEZGD4_0Qqi06ZJ",
            "typeName": "shape"
        },
        {
            "x": 270,
            "y": -345.5603412935589,
            "rotation": 0,
            "id": "shape:iePSorBBbMNMN0kL6XRMW",
            "index": "a2",
            "type": "geo",
            "props": {
                "w": 259.70508539874766,
                "h": 95.5603412935589,
                "geo": "rectangle",
                "color": "red",
                "fill": "semi",
                "dash": "solid",
                "size": "s",
                "opacity": "1",
                "font": "draw",
                "text": "Center",
                "align": "end",
                "growY": 0
            },
            "parentId": "page:Y71oOJhEZGD4_0Qqi06ZJ",
            "typeName": "shape"
        },
        {
            "x": 539.7050853987477,
            "y": -345.5603412935589,
            "rotation": 0,
            "id": "shape:ME7x85WpuTidScOtmhoYz",
            "index": "a3",
            "type": "geo",
            "props": {
                "w": 259.70508539874766,
                "h": 95.5603412935589,
                "geo": "rectangle",
                "color": "red",
                "fill": "semi",
                "dash": "solid",
                "size": "s",
                "opacity": "1",
                "font": "draw",
                "text": "Right",
                "align": "end",
                "growY": 0
            },
            "parentId": "page:Y71oOJhEZGD4_0Qqi06ZJ",
            "typeName": "shape"
        }
    ],
    "rootShapeIds": [
        "shape:YvhcYRPOxzC6DG39RZSty",
        "shape:iePSorBBbMNMN0kL6XRMW",
        "shape:ME7x85WpuTidScOtmhoYz"
    ]
}
  

Example image:
image

[Bug] Pointer events do not fire when control clicking

Seems like a regression happened with control (Mac) clicking, at least on Firefox.

With debug mode enabled, it looks like a pointer down event isn't firing when pointers are released with control button pressed:

Screen.Recording.2023-01-11.at.2.34.47.PM.mov

Return to SelectTool after tool usage?

I've started using the beta a bit more and the main difference in UX that I've noticed is the persistence of tooling after a session or interaction has occurred.

In V1, the select tool is always resorted back to after a session completes (ie. drawing a shape!). In V2, said shape tool will instead persist to let more shapes be created. This may be a desired behaviour in V2, but I figured it is worth calling out as I think it is a major UX difference and requires some unlearning.

[bug] Selection criteria for Selection tool

The criteria for selection is "if the selection area touches even one pixel of the object it gets selected", and it is inconsistent with some other apps like Inkscape which there it is "if the selection area include all the pixels of the object"

Can we have an option at least that we can specify which selection rule the app would work with?

To me, the latter seems to have a lot of usecases for overlapping objects.

On a separate note, Selection tool keyboard shortcut is set to "V", is there any reason why it is not "S"? (similar to other tools which is basically the first letter?)

Thanks

Pick a different font

The original tldraw allows you to pick 1 of 4 fonts. The beta version does not (yet) allow this.

I saw this comment by @TodePond that a font update is incoming.

Will that also introduce that feature?

Thanks for this awesome tool, btw! tldraw ftw

All text has max width and can't be resized

I ran into an odd issue with a new board this morning. For a while, I was able to create text as usual.

Then, for some reason, my text will only go to a certain width and can't be any wider.

Additionally, text that was originally created gets shrunk when it is duplicated.

tldraw

This is happening across multiple boards on my machine this morning.

[bug]: Please consider an alternative to LiveBlocks due to security/privacy

Please see this comment on the "Self Hosting" thread (which apparently no-one has really figured out how to run this thing yet?! 😳) -- I thought I'd sit down tonight and try, but then going back over the thread I realised one stickling point.

This is essentially a 3rd-party external (yet another) Cloud / SaaS service that tldraw depends on for some (quite useful) feature(s) IMO -- Namely real-time collaboration/viewing of a drawing.

There's a couple of problems with this however:

  • This is no longer a "tiny drawing app" as you immediately depend on one or more 3rd-party Cloud/SaaS services. I believe even AWS S3 is required somewhere?
  • This is security and privacy concern and basically makes the app unsuitable for self-hosting (at all).

I urge the project maintainers and/or developers to reconsider alternatives. Surely a simple backend can be written using Web Sockets that achieves the same desired behaviour and features? 🤔 -- I understand (anda actively use) HedgeDoc has a similar set of features and requires no 3rd-party Cloud/SaaS services.

Thank you ! 🙏

Can't bind arrows to groups

Not sure if this is how it's expected to work or is this a bug
I have a grouped shapes, binding the arrow to the grouped shape, and automatically the arrow is grouped with the grouped shape but I just want to bind not group it, more info on the video

Screen.Recording.2022-12-14.at.8.47.02.PM.mov

[feature] add peer awareness in multiplayer (share)

It's good to see that tldraw beta has awesome multiplayer feature!
I have one feature suggestion, and that is peer awareness

Peer awareness is crucial feature in real-time collaborative applications, and tldraw beta does not seem to have that feature :(
It may look like this (original tldarw already implemented named cursor for peer awareness)

  • tldraw custom (multi) cursor

    multiplayer-cursor

  • tldraw-yorkie (which I implemented for multiplayer tldraw using CRDT store open source Yorkie, I customized tldarw core for namecd cursor)

    multiplayer-cursor-2

Copy to SVG

Allow users to copy their drawings to SVG.

  • Copy to SVG
  • Keyboard shortcuts
  • Include styling
  • Fix positions
  • Fix z ordering
  • Copy text

created broken transform that borked my page

I clicked something on the minimap and now my canvas is broken.
New project and hard reload don't seem to fix it, but incognito window did

framework-ff25748e596a3c59.js:9 Error: <g> attribute transform: Expected number, "…le(4) translate(NaN,NaN)".

[feature] NPM Package

We should publish the tldraw editor as its own NPM package, similar to how excalidraw publishes @excalidraw/excalidraw, so that it can be embedded in implementations other than tldraw.com, such as VSCode extensions.

Add custom pens toolbar

This project is awesome! adding a favorite toolbar with preferred styles would be awesome like in OneNote
image

[Feature] Double-click to add text to shape

Hi,

I just discovered tldraw and it is awesome!
Congrats on all the work.
I would like to propose a feature to make it easier to diagram things.

Scenario

  • Using tldraw as a quick diagraming tool for online meetings
  • Need to be able to quickly put up shapes, add some text to them and draw lines from shape-to-shape

Suggestion

  • When a user clicks on a shape in the sidebar, then clicks on the canvas, the shape would be created (current behaviour)
  • When the user double-clicks on an existing shape on the canvas, the user could add text to the shape (new behaviour) instead of adding more of the same shape of a default size
  • [Alternative/Add-on] Add Edit \ Add Text as a quick option alongside Duplicate when right-clicking on a shape

tldraw

  • When a user clicks & drag then the selected shape would be created at the expected user-dragged size

Hope this will be useful, and if you have any questions, let me know.

Cheers,
Alex R

Missing translations: zh-CN

I can change to any other language except Chinese-Simplified.
If there's no Chinese version of translation now , maybe I can help with the i18n work.

Tapability on iPad Safari

Small issue report:

On the toolbox it's sometimes hard to hit the left column (on Safari iPad). It will only work if I hit the right half of the button.
I see you're already anticipating something like this and buttons extend to the edge of the screen:
Screen Shot 2022-11-17 at 22 06 14

I made a small recording to show it via accessibility features on iPadOS

With that recording I wasn't able to hit the button, but IRL it will work when hitting the right half. Maybe iPadOS is doing something weird with edges (even though there are no actions on the left). 🤷‍ Just wanted to report...

https://www.dropbox.com/s/mahhm9k3yo93g61/RPReplay_Final1668719304.mov?dl=0

[Bug] Circles (shapes) with short text become large

I can't make small circles with short text inside on beta but can make them on v1.

  • When I make very small circles on beta, and write a number in there, it becomes elongatte (A).
  • When I resize it just a bit, it increases to B.

On right-side is the v1 version: small circle with text inside works.

SmallestCircle

Text node always appears at top left of visible canvas

Whenever a new text node is created -- regardless of the interaction -- it is appearing at the top left of my visible canvas. Screen recording with debug mode enabled (note the text in the top-left as I type!). This is on Firefox 106.0.5:

Screen.Recording.2022-11-10.at.12.17.03.PM.mov

Let me know if you need anything else, beta looks great!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.