Skip to content
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

text element option #43

Open
matititam opened this issue Jan 8, 2021 · 18 comments
Open

text element option #43

matititam opened this issue Jan 8, 2021 · 18 comments
Assignees
Labels
enhancement New feature or request open for vote Vote at https://wokwi.com/features

Comments

@matititam
Copy link

sometimes picture needs some text to save time

a label kind of feature which can be placed so that,

  1. I can tell how to give a long press
  2. I can tell what the buttons are for
  3. I can tell, what does the extreme ends of the potentiometer to
  4. etc
@urish urish self-assigned this Jan 8, 2021
@urish urish added the enhancement New feature or request label Jan 8, 2021
@stevesigma
Copy link

stevesigma commented Jan 22, 2021

Maybe it would be used for global label assigned to any element, for example when sharing scheme.
Something like:

 <id="resistor1" type="wokwi-resistor" label="R1"...
 <id="btn1" type="wokwi-pressbutton" label="Change color"...

@urish
Copy link
Contributor

urish commented Jan 23, 2021

That's an interesting thought. So there are two alternatives:

  1. Adding some kind of text/label primitive, which you can place in the diagram anywhere you like
  2. Adding a new attribute to parts which will let you specify additional information. I'm not sure if I'd call it label, perhaps comment or description make more sense?

@stevesigma
Copy link

  1. would need fixed position, z-index, colors... that would make sometimes small problems. (when zooming?) Less code for You.
  2. the position should be calculated on the fly while zooming. Labels could be connected with object by thin line/arrow. Style has to be autmatically. Should have some opaque background, could dissapear. More code for You.
    name of attribute was just an example.

@alto777
Copy link

alto777 commented Aug 31, 2021

I found this searching for a feature.

+1 on some kind of document annotation mechanism, not terribly important really, but once there are more than a few switches and LEDs it gets a bit of work to figure out which are which. Especially for others if you are sharing.

alto777

@rcwilcox
Copy link

rcwilcox commented Sep 9, 2021

That's an interesting thought. So there are two alternatives:

  1. Adding some kind of text/label primitive, which you can place in the diagram anywhere you like
  2. Adding a new attribute to parts which will let you specify additional information. I'm not sure if I'd call it label, perhaps comment or description make more sense?

I like (1)

If attached, they would move if the part moved, which would be nice. Also be nice to be able to to be attached (Relative Attribute) to a NET (e.g. Arduino Pin 11 - MOSI), should also be able to rotate and perhaps offset from attached object. Visually connect to part as suggested by @stevesigma. Should also allow an absolute position (Fixed Attribute) test box for Diagram notes, usage etc.

@matititam
Copy link
Author

random thought - just wanted to pin it here

How about making the text note a mouse hover display (or when we click on the part (when the simulation is not running)

@rcwilcox
Copy link

random thought - just wanted to pin it here

How about making the text note a mouse hover display (or when we click on the part (when the simulation is not running)

That would help declutter (if you had lots of text labels), downside would be that any screen shots would not have the text visible. My 'too much of anything is just enough' and 'retched excess' gene says - Have both with a persistence attribute of static or dynamic. Of course, Fixed text objects (notes, tables, etc.) should be static.

@urish urish added the open for vote Vote at https://wokwi.com/features label Sep 16, 2021
@M-square
Copy link

Of all the options above, I think a simple, independent (new) object that is just the text.

How it is handled in zoom is up to the implementation (scales or remains fixed size) whatever is simpler.

Text can have lots and lots of options (size, font, colour, alignment ...) - use the KISS principle.

@marvinschwartz
Copy link

When you have lots of similar components on a screen you need some way to know what they are. eg. multiple stepper motors, multiple leds, multiple switches and buttons etc. This would make the diagrams far more useful and much better when sharing. Just a simple text element would be a significant improvement.

@urish
Copy link
Contributor

urish commented Aug 26, 2022

Update: we have a proof-of-concept implementation of a wokwi-text element:

https://wokwi.com/projects/341085054102930004

The details (element name, attrs, default behavior, etc) are subject to change - looking to get some feedback so we can ship this soon.

@urish
Copy link
Contributor

urish commented Sep 21, 2022

Apparently, the current implementation breaks the text differently depending on the screen sizes (e.g. desktop v.s. mobile), so we need some deterministic method of defining the size of the text element.

@janoc
Copy link

janoc commented Sep 25, 2022

Having the option 2 from #43 (comment) would be really useful if those labels could be actually attached to wires - and exported as part of the logic analyzer files too. It would make the analyzer a lot more useful when debugging multiple signals at once.

@urish
Copy link
Contributor

urish commented Sep 25, 2022

Thanks for the input @janoc, that's a good point! I'm curious - what have you been building/debugging with Wokwi?

@janoc
Copy link

janoc commented Sep 25, 2022

Trying some RP2040 PIO code. It seems Wokwi is the only thing around that has a sensible simulator available.

@drf5n
Copy link

drf5n commented Mar 3, 2023

Update: we have a proof-of-concept implementation of a wokwi-text element:

https://wokwi.com/projects/341085054102930004

The details (element name, attrs, default behavior, etc) are subject to change - looking to get some feedback so we can ship this soon.

For folks who ended up here while looking for documentation, the block of json in the diagram is:

{
  "type": "wokwi-text",
  "id": "led1",
  "top": -40.7,
  "left": 67.67,
  "attrs": { "text": "This is an example of\nText Labels for Wokwi." }
}

With commas for easy pasting, a label that won't clash with led1, and a comment for documentation:

,
{
  "docUrl":"https://github.com/wokwi/wokwi-features/issues/43#issuecomment-1453481794",
  "type": "wokwi-text",
  "id": "title1",
  "top": -40.7,
  "left": 67.67,
  "attrs": { "text": "This is an example of\nText Labels for Wokwi." }
}
,

You can use un-recognised attributes, such as "docUrl" in the above code, in JSON for comments.

@drf5n
Copy link

drf5n commented Mar 16, 2023

Does the element have extra attributes like:

"size": "10"   // canvas units? Font points?  
"justification": ""    // "", "left",  "center", "right" 
"font": ""                  // css type?

@Knelfy
Copy link

Knelfy commented May 24, 2023

Would there be a possible way to change the text colour, or maybe the background colour would be more in keeping with it being a part (and thus not impacted by dark mode). I have it in dark mode hence the ask because the black text isn't very clear on the dark background. PS tried color attribute but no luck.

@shaos
Copy link

shaos commented Jun 11, 2023

Why attribute for proposed wokwi-text is called "text"?
There is a perfect attribute that is doing similar thing for other parts - "label" 🙂
So technically object wokwi-text could be an empty part with a label 😉
From other side label is always 1-line text and wokwi-text could be multi-line (with \n separating lines) so this is a perfect time to make label multi-line to cover both use cases ;)
UPDATE: Apparently label attribute works only for pushbuttons and LEDs :)
Even though it looks like gates have space below for 1-line label, but label doesn't appear there...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request open for vote Vote at https://wokwi.com/features
Projects
None yet
Development

No branches or pull requests