How to set the text size of a LabelView in SproutCore - layout

This may be obvious, but I can't find how to enlarge the font size of an SC.LabelView. What I have now is
title: SC.LabelView.design({
layout: { centerX: 0, centerY: 0, height: 36, width: 200 },
tagName: "h1",
value: "Contacts"
})
Although it is an h1, it stays 'normal' text, but it is a title, as suggested by the property name.

SproutCore includes a CSS reset so that you can style your page and make it look the same across all browsers.
The best way to edit your styles is to add some CSS to my_app/resources/main_page.css using the font-size property.
$theme h1 {
font-size: 30px;
}
There are some comments and links to additional resources in the main_page.css file, but you can learn more from the Chance guide.

Related

Making Sencha architect aware of an xtype

I am using Architect 4.3.2.19, CMD 7.6.0.87 Modern framework.
I have a couple of xtypes for things like Ext.Panel - example:
Ext.define('Ext.PanelSection', {
extend: 'Ext.Panel',
xtype: 'panelsection',
alias: 'widget.panelsection',
config: {
shadow: true,
ui: 'panel-section-title',
layout: 'vbox',
header: {
height: 18,
minHeight: 18,
maxHeight: 18,
style: 'text-decoration:underline'
}
}
});
The source for the xtype is held in a common.js file that is in the resource section of the Architect project inspector.
So in the architect I add an Ext.Panel to the canvas and then I then add a process config
config.xtype = 'panelsection';
return config;
It works beautifully but the architect will still show the panel header full height which makes laying out the panel a bit tricky. Is there a way of creating an xtype so that the architect is aware of it's config.
There was something I just now thought about in reading your question. It could be the Theme's .css is overriding your settings, possibly.
Two things you can try:
Once you place your PanelSection you could go down the Theme Config panel and change the default height to 18px.
You could you add another resource file containing .css, I did this, and allow it to override the panel header height. I did it for my Tabs in a TabPanel, it worked like a charm. But you'd need to find out what css class to override. In searching the .arch-internal-preview.css file, I found references to:
x-panel.x-header-position-top > .x-max-height-el {
flex-direction: column
}
You could try to add a height variable of 18px under the flex-direction and see if that changes the height of the header.
Anyway below is what I've done to change my Tabs in a separate resouce file.
Ex:
.x-tabpanel {
font-size: 28px;
}
.x-tab{
width: 250px;
}

Sublime 3 font size of definition hover

Is there a way to manage the font size of the function definition hover on ST3?
Here's what I see:
I've tried adding font.size to the theme for this element which is popup_control html_popup according to docs but it doesn't appear to accept this.
Update: I found that pasting this CSS in my color theme plist addresses the list/links but not the title. I have tried to use a plugin like ScopeHunter to find the context of the 'definitions' title but it doesn't work for popups.
<key>popupCss</key>
<string><![CDATA[
html {
background-color: #404238;
color: #F8F8F2;
}
a {
color: #66D9EF;
}
.error, .deleted {
color: #F92672;
}
.success, .inserted {
color: #A6E22E;
}
.warning, .modified {
color: #FD971F;
}
]]></string>
The best thing to do is look at the HTML that is used in the popup, to help decide what CSS selectors to use in the color scheme's popupCss to change the appearance of the popup.
In this case, the code is in Packages/Default/symbol.py, which you can view using https://packagecontrol.io/packages/PackageResourceViewer:
<body id=show-definitions>
<h1>Definition%s:</h1>
<p>
...
</p>
</body>
So you can use the following CSS in your popupCSS to target it and change the color of the "Definitions" text, for example - to prove the selector is working (the official recommendation is to use the id from the body tag):
#show-definitions h1 {
color: #b3bc20;
}
however, specifying the font-size seems to have no effect, at least in build 3154, so I think there is a bug in ST.

Kendo Angular 2 Grid Height

I want my grid to have a dynamic height. Before with angular 1 and kendo i would do like this.
<kendo-grid id="grid" options="entityGrid.gridOptions"></kendo-grid>
With the following CSS:
#grid {
height: calc(100% - 1em);
}
But with Kendo grid for angular2 when i try this it wont work.
<kendo-grid id="grid"
[data]="entityGrid?.view | async"
[scrollable]="'virtual'">
</kendo-grid>
When using scrolling (and static headers), the grid content area needs to have a height, too. Computing it dynamically based on the page is not supported at this time, and is not going to work with angular-universal. You can log this as a feature request on the kendo-angular2 repo, so that it is considered for implementation.
That said, you can use the following hack to make it work:
encapsulation: ViewEncapsulation.None,
styles: [
`kendo-grid {
height: calc(100% - 3em);
margin-top: 3em;
}
kendo-grid .k-grid-content {
height: calc(100% - 46px);
}`
],
This will pass the styles in the component itself. The value 46px is the size of the header, and 3em is your desired offset.
See this plunkr example for a working demo.
I was able to set dynamic height with following configuration
<kendo-grid class="grid"
[kendoGridGroupBinding]="data"
[ngStyle]="gridHeight"
</kendo-grid>
In TS file
public gridHeight = {
height: 'calc(100vh - 140px)'
};
You can set height as per your requirement from TS

Calculate text width in pixels server-side

I'm trying to use the following code on my server to estimate the length of some text fields and potentially trim them before sending them by email...
String.prototype.visualLength = function()
{
var element = document.createElement("span");
element.css({
"visibility": "hidden",
"white-space": "nowrap",
"font-weight": "normal",
"font-size": "18px",
"line-height": "40px",
"font-family": "Helvetica, Arial, sans-serif",
"text-decoration": "none"
});
document.body.appendChild(element);
element.innerHTML = this;
return element.offsetWidth;
};
String.prototype.trimToPx = function(length)
{
var tmp = this;
var trimmed = this;
if (tmp.visualLength() > length)
{
trimmed += "...";
while (trimmed.visualLength() > length)
{
tmp = tmp.substring(0, tmp.length-1);
trimmed = tmp + "...";
}
};
return trimmed;
};
Obviously I'm getting an error because "document" is not defined server-side. I added the Meteor packages htmljs and domutils hoping they might solve this, but in vain. And I can't add the Node.js package jsdom because apparently it won't work in deployed Meteor apps.
Any idea how to achieve what I'm trying to do?
You cannot truly rely what will happen on client-side. Even Ubuntu and Windows shows the fonts different because of different hinting, antialiasing and they may have an effect on the displayed sizes.
If you modify your span's css as following, when it has a text larger than the desired space, no matter what, the remaining will be displayed as ...
max-width: 10%;
border: 1px #000 solid; // JUST TO SEE the effect clearly
width: 10%;
overflow: hidden;
height: 20px;
text-overflow: ellipsis;
display: block;
white-space: nowrap;
** Please note that you need a proper height value, other wise the text will go to bottom and what you want will not be achieved.
Try on http://jsfiddle.net/sG6H2/
I don't think this is possible. Server-side code running in node.js does not run in the context of a web browser's rendering environment and so can't access the browser's DOM and available fonts and display configuration. Even if you were to successfully run your code and compute a number, that computation has no relationship to my device when I receive your email. The fonts, the display size and resolution (could be a desktop, could be a mobile device), my own configuration (for example I set a minimum font size in Firefox on my desktop), etc. Instead try defining your size in em units instead of pixels.

How can I enable the handle on layout manager?

Given the following javascript code :
var layoutFull = new YAHOO.widget.Layout({
units: [
{
position: 'left',
header: 'Right',
width: 300,
resize: true,
collapse: true,
scroll: true,
body: 'right1',
animate: true
},
{
position: 'center',
body: 'Da center...'
}
]
});
layoutFull.render();
I can have a full layout with a collapsible left pane. But there is a fine line between left and center parts. I would like to be able to drag this line for resizing both left and center part as in this example : http://developer.yahoo.com/yui/examples/layout/page_layout_source.html.
Which property should I enable in the layout configuration ? Looking at sample or the API doc didn't give me any luck.
I'm wondering if the following two libraries need to be included ...
<script type="text/javascript" src="../../build/dragdrop/dragdrop-min.js"></script>
<script type="text/javascript" src="../../build/resize/resize-min.js"></script>
Without 'seeing' the html, its rather hard to guess. Some 'magic' might occur by adding these two. Just a hunch. :)

Resources