Adding Text to Objects During Zooming - fabricjs2

I am evaluating fabricjs and wondering if you can dynamically add text to shapes while you are zooming. So for example while zoomed out, the shapes are too small to show the text but as you zoom and they get to a certain size, the text can be shown. Or is this part of the base control? In other words if I add text to an object but it cannot be shown because it is too small it automatically hides?

Related

How to make a tooltip for a chart in d3?

We need to make it move like here.example The code is complex there, I can't figure it out.
I wrote the code my code, but I don’t understand how to make the tooltip move horizontally not behind the mouse, but near the nearest horizontal mark (as in the example)
It is not yet clear where the text above the bold text in the tooltip comes from. How to remove it so that it looks like in the picture?
How do I make the title of the tooltip match the label on the X-axis?
There are many ways to accomplish this. The way I typically do this is to create a series of SVG elements -- such as circles or rects -- using the same scale and data as the paths.
You can make these objects visible or invisible. Either way, you can attach mouseenter, mouseleave events to each to render and populate the tooltip.

Add cell formatting at run-time

I'm following the formatting example shown here:
http://6pac.github.io/SlickGrid/examples/example2-formatters.html
As per the example, the statusFormatter can return addClasses, removeClasses, text and tooltip. However, in my case, the user defines the conditions, and the formatting. For example, through a settings page, the user could specify:
The condition (i.e. ">3"),
The formatting associated with the condition (i.e. blue background with white text)
Hence, I don't have the ability to create the css file at design time. I have the conditions working. So then my colorFormatter returns
returnValue = `<div style="${css}">${value}</div>`
this then creates a cell, which looks like this (with a white border around it)
Ideally, I would like to pass in the dynamically generated css style back to the grid cell, so the white border doesn't show between the cell border and the formatting which I would like in the cell.

how to tie powerpoint bullet to related image for purposes of animation?

I'm building a set of slides with bullets. I want to use "appearance" animations so I can step through the bullets with the space bar. On several slides, I have a screenshot image that I've positioned right after the bullet I want the image to be associated with. However, when I add appearance animations, the slide just displays all the screenshot images immediately, before any of the bullets appear. It seems like PowerPoint treats the images as "floating", and not associated with the bullets.
What can I do here?
The fact that the screenshot image is near the bullet doesn't make it part of the bullet or associated text, so it's behaving as expected.
Instead, try using a custom picture bullet for the text or using individual lines of text, each grouped with the screenshot image and each animated individually.

Canvas with text supporting native ctrl+f in browser

Is it possible to somehow make "find" (ctrl+f) work if you are writing text inside a Canvas?
I checked out the basic examples at https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Drawing_text and when searching for "hello world" in chrome the canvas text is not hilighted.
Is there anyway of doing this?
If there isn't, has anyone seen an implementation of a "box-and-lines" chart (like UML) only using the DOM? (since then native find text would be supported)
Html5 Canvas paints text on its canvas -- the text you see is an inaccessible set of pixels arranged in the shape of letters, so Ctrl-f will not find the text. If you want searchable text you can use CSS to place html divs over the canvas and set their content to your desired text. Then Ctrl-f will find it. You can set pointer-events: none on the div so it doesn't catch events you intend for the canvas.
One wild (and not recommended) workaround is to put an element off-screen containing all your text. When Ctrl-f finds something in that element, you can fetch the selected text and calculate where you painted that same selected text on the canvas. Then you can redraw the selected text on the canvas as white-on-blue text to indicate that it was "found". This wild workaround is totally not recommended, but it would probably work

font size bug with CGContextShowTextAtPoint

I have some rather simple code drawing some text into a CGContext. Here is an excerpt (slightly edited).
CGContextSelectFont(context, "Helvetica", 1.5, kCGEncodingMacRoman);
CGContextShowTextAtPoint(context, xpos, ypos, "Hello", 5);
The text renders ok. For some unknown reason, however, the font changes to a smaller size after I click in the view containing the context. Also when I resize the window containing the view the font returns to original size. What is the reason for this?
1.5 points is mighty tiny to begin with. Assuming no other scaling is in effect, that will be one whole pixel and a blurry pixel above it on the screen.
You're probably seeing a bug that I ran into myself: On entry into drawRect:, the current context's text matrix was not the identity matrix. In my case, I saw it contain a scale by 13 on both axes, plus a translation. (Possibly left over from drawing the title bar.) I filed this in Radar as #10585106, in case you want to file your own and cite it.
The solution is to set the text matrix back to the identity transform before trying to draw text.
Once you do that, you'll find that your text will be exactly as tiny as you asked for it to be. You should change your font size to something more reasonable; Core Text contains a function to get the system fonts (from which you can get their sizes), and AppKit's NSFont class contains methods for the same purpose.

Resources