FontAwesome icon with fabricJS - font-awesome

I am trying to use FontAwesome icon on FabricJs text object but can't get it to render the icon. It works with regular canvas on the same page.
My code:
const text = new fabric.IText('\uf0c2',{
left: this.centerX, //Take the block's position
top: this.centerY,
fill: 'white',
originX: 'center', originY: 'center',
fontSize:60,
fontFamily:'FontAwesome',
selectable: false
});
The result is a white rectangle (should be a cloud icon).
Is there a way to use FontAwesome icons with fabricJS?

Related

How to get rid of small circle graphic appearing at center of HTML-coded text in a customized Google Map?

I'm an HTML novice, but here goes...
When zoomed way in, this is what I see at the center of various text line insertions:
You can see this live here: https://becketbroadband.org/fsa-map%2Fstatus
The apparently-responsible code looks like this:
addOverlay(Map, FSA05_Border, '49d834', 0.3, 'FSA-05', { lat: 42.305200, lng: -73.058500}, 'Service Available Now');
Ideas? Thanks!
I see this in the code for addOverlay, at fsa-map/status on your site:
new google.maps.Marker({
position: labelPoint,
map: BecketMap,
icon: {
path: google.maps.SymbolPath.CIRCLE, // anything, required
fillOpacity: 0, // hide the symbol leaving just the label
},
label: {
text: FSAlabel,
color: '#000000', // black
fontSize: '20px',
fontWeight: 'bold',
},
});
What happens if you don't supply an icon property at all?
The guy who wrote the original code came up with the answer. (He didn't have any ideas till I pointed out the icon property details addressed in this thread.)
The "fillOpacity" value addresses the inside of the circle. This new line of code addresses and hides the circle itself:
"strokeOpacity: 0,"
Thank you, AakashM, for getting me on the path to a solution! :) You da man!

Add a label to a stencil shape of type basic.Image in jointjs-Rappid

I have a stencil shape of type basic.Image which is showed in Stencil without a label as in the following screenshot:
Is there any way I can add a label which will be displayed at the bottom of this shape in the Stencil?
The full code is the following:
new joint.shapes.basic.Image({
attrs: {
image: { width: 50, height: 50, 'xlink:href': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABmJLR0QA/wD/AP+gvaeTAAAIj0lEQVRogd2Za2wcVxXHf3f2vXayttd52o3yJK9GcpMUNQQIfQVKW6mK1ApVqgQigEBCQghVQUKtKi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2jvzzCCtmeuekFyGggIoNVr4tOC+UXEss4fa77oFqid137+VMpRh+qIKm03ZkJU7UJimzCCvXRtkGK7dwBF5xdvDgQ118/vHH+NdInr9cW0qiFq72g9cmwErV6fkELCBZvXKc4ubdON5bWMqC5IIlmeIfEyt4bczdsbZlYaTvLLWaxeTkJM+/MQTZdhO3ZRIAoHruTZzCYlral9CSVuSV0JJQ0X9msbejyDfQRm9OkZ8k0vyZwJQjTGvFdFWYGhmEscu8fEhx4gPNi6c6oKWNJDXMN4gIAasyLQOHf62yy9dTtQXtvyIpD2YAUBk/BuLAm3xaDMAan9+8dvHOSimsZJpMNkttpkzFzvH0n/OQLUJrB6DI1gbtqQYEHGC6VM6MFlurHZXev6K0kGBhRSUzqHw7dr4dWrvQdJNvb4VUjoRlkVdTjJ9/fRT3D6VtEigBV8pHf/r7iV1P7sut2Npiz5SoVmuGQ5t4nwbPoT6dzAhEzoT3AigLqSRxKgp4HxRkMxlymQyl4QulytGfHAT6gGlz1CSwGtiBlfpYcsmWTZJoyTo3vWmzPJT6pl6WElYC5ZQq9tB7J9G1w8BbwEXANg2ngZVAN9Dp3f8vSRUYBi4DA959XR5YuP9gsw2e3WoRoAKUcb///n/IfwCA/cfu6DUO7AAAAABJRU5ErkJggg==' },
text: { text: 'image', 'font-size': 9, display: '', stroke: '#000000', 'stroke-width': 0 }
}
})
Thanks to Rappid/ jointJS support, I solved my problem by disabling a CSS rule which was responsible for hiding the label of any Stencil shape of type basic.Image this way:
.stencil .elements .element.basic.Image text
This label is now visible under this shape at Stencil and it is disappeared when adding this shape to the graph, as wanted.

Issue in IE when using Fabric.js

I used http://fabricjs.com/ library am having this problem I need to fix In Internet Explorer the text I add take place beside the selected area but in Chrome and Firefox wit work probably.
IE snapshot.
Chrome snapshot.
var text_bottom = new fabric.Text(text_bottom, {
originX: 'center',
left:270,
top: 490,
fontFamily:'AsmaaFont',
fill:"#C0C0C0",
fontSize: 50,
textAlign: 'center'
});
What should I do?
Please remove:
textAlign: 'center'
So your code will be:
var text_bottom = new fabric.Text(text_bottom, {
originX: 'center',
left:270,
top: 490,
fontFamily:'AsmaaFont',
fill:"#C0C0C0",
fontSize: 50
});

Extjs 4.2 float a button to a fixed location in the application

I am using ExtJs 4.2
My app needs to a have a button that will invoke a panel, that holds the navigation tree show once clicked.
This button needs to be visible at all times, and centered vertical to the middle and to the right of the screen.
How do I achieve this behavior? I don't want to nest the button in a panel, it should be a part of the view port...
Here is what I have tried:
Ext.define('NG.view.Viewport', {
extend: 'Ext.container.Viewport',
layout: 'border',
id: 'appviewport',
items: [{
itemId: 'app-header',
xtype: 'appheader',
region: 'north',
weight: 10,
border: false,
height: 60
}, {
itemId: 'navigation',
xtype: 'button',
region: 'west',
weight:15
}, {
xtype: 'carddeckmanager',
region: 'center',
weight:10,
border: false,
cls:'n-cardmanager-box',
items: [{
itemId: 'dashboard',
xtype: 'dashboard'
}]
}]
});
but this makes the button expand as the height of the viewport.
If you really want to float that button, there's no sense in adding it to a container or the viewport. Render it to the document body, configure it with floating: true, and give it a z-index that will ensure that it remains above any window (if that's what you want).
Then you can position it where you want with its alignTo method but, better yet, use anchorTo so that it sticks where you put it, even when the browser is resized.
All of this gives us:
var body = Ext.getBody();
// Create the button
var button = Ext.widget('button', {
text: "Yo"
,floating: true
,renderTo: body
});
// z-index
// Ext4's windows default z-index starts from 29000
button.setZIndex(40000);
// Anchor the right of the button to the right of the document body
// with a 5px horizontal offset.
button.anchorTo(body, 'r-r', [-5, 0]);
Put this code somewhere in the startup process of your application. Candidates could be the init method of your application, the initComponent method of your viewport, or a single afterrender listener on the viewport...
Now, if what you want is just that the button remains visible in the right border of the viewport but without it filling the whole region, you need to wrap it in a container with an appropriate layout. For example, add this to your viewport:
{
region: 'west',
layout: {type: 'hbox', pack: 'center', align: 'middle'},
items: [{
xtype: 'button',
text: "Viewport button"
}]
}

legend icon width changes in google line chart

I have used google chart from this location
https://developers.google.com/chart/interactive/docs/gallery/linechart#Example
Is there any possibility to change the width and height of the legend icons i.e the blue and red rectangles.
As seen in the documentation:
legend: {position: 'top', textStyle: {color: 'blue', fontSize: 16}}
legend.textStyle: {color: <string>, fontName: <string>, fontSize: <number>}
Is it what you was looking for ?