mirror of
https://github.com/psychopy/psychojs.git
synced 2025-05-11 16:18:10 +00:00
Merge pull request #338 from thewhodidthis/bf#334--font
visual/Form/Slider: clean up font family handling
This commit is contained in:
commit
f9b9620dca
@ -43,6 +43,7 @@ import {Slider} from './Slider';
|
||||
* @param {number[]} [options.items= []] - the array of labels
|
||||
* @param {number} [options.itemPadding= 0.05] - the granularity
|
||||
*
|
||||
* @param {string} [options.font= 'Arial'] - the text font
|
||||
* @param {string} [options.fontFamily= 'Helvetica'] - the text font
|
||||
* @param {boolean} [options.bold= true] - whether or not the font of the labels is bold
|
||||
* @param {boolean} [options.italic= false] - whether or not the font of the labels is italic
|
||||
@ -56,7 +57,7 @@ import {Slider} from './Slider';
|
||||
*/
|
||||
export class Form extends util.mix(VisualStim).with(ColorMixin)
|
||||
{
|
||||
constructor({name, win, pos, size, units, borderColor, fillColor, itemColor, markerColor, responseColor, color, contrast, opacity, depth, items, randomize, itemPadding, fontFamily, bold, italic, fontSize, clipMask, autoDraw, autoLog} = {})
|
||||
constructor({name, win, pos, size, units, borderColor, fillColor, itemColor, markerColor, responseColor, color, contrast, opacity, depth, items, randomize, itemPadding, font, fontFamily, bold, italic, fontSize, clipMask, autoDraw, autoLog} = {})
|
||||
{
|
||||
super({name, win, units, opacity, depth, pos, size, clipMask, autoDraw, autoLog});
|
||||
|
||||
@ -119,6 +120,13 @@ export class Form extends util.mix(VisualStim).with(ColorMixin)
|
||||
);
|
||||
|
||||
// fonts:
|
||||
this._addAttribute(
|
||||
'font',
|
||||
font,
|
||||
'Arial',
|
||||
this._onChange(true, true)
|
||||
);
|
||||
// Not in use at present
|
||||
this._addAttribute(
|
||||
'fontFamily',
|
||||
fontFamily,
|
||||
@ -726,7 +734,7 @@ export class Form extends util.mix(VisualStim).with(ColorMixin)
|
||||
const textStimOption = {
|
||||
win: this._win,
|
||||
name: 'item text',
|
||||
font: 'Arial',
|
||||
font: this.font,
|
||||
units: this._units,
|
||||
alignHoriz: 'left',
|
||||
alignVert: 'top',
|
||||
@ -742,7 +750,10 @@ export class Form extends util.mix(VisualStim).with(ColorMixin)
|
||||
name: 'choice response',
|
||||
units: this._units,
|
||||
flip: false,
|
||||
fontFamily: 'Arial',
|
||||
// Not part of Slider options as things stand
|
||||
fontFamily: this.fontFamily,
|
||||
// As found in Slider options
|
||||
font: this.font,
|
||||
bold: false,
|
||||
italic: false,
|
||||
fontSize: this._fontSize * this._responseTextHeightRatio,
|
||||
@ -761,7 +772,7 @@ export class Form extends util.mix(VisualStim).with(ColorMixin)
|
||||
flip: false,
|
||||
opacity: 1,
|
||||
depth: this._depth + 1,
|
||||
font: 'Arial',
|
||||
font: this.font,
|
||||
letterHeight: this._fontSize * this._responseTextHeightRatio,
|
||||
bold: false,
|
||||
italic: false,
|
||||
|
@ -45,7 +45,7 @@ import {PsychoJS} from "../core/PsychoJS";
|
||||
* and labels with respect to the central bar
|
||||
* @param {boolean} [options.readOnly= false] - whether or not the slider is read only
|
||||
*
|
||||
* @param {string} [options.fontFamily= 'Helvetica'] - the text font
|
||||
* @param {string} [options.font= 'Arial'] - the text font
|
||||
* @param {boolean} [options.bold= true] - whether or not the font of the labels is bold
|
||||
* @param {boolean} [options.italic= false] - whether or not the font of the labels is italic
|
||||
* @param {number} [options.fontSize] - the font size of the labels (in pixels), the default fontSize depends on the
|
||||
@ -131,7 +131,7 @@ export class Slider extends util.mix(VisualStim).with(ColorMixin, WindowMixin)
|
||||
this._addAttribute(
|
||||
'font',
|
||||
font,
|
||||
'Helvetica',
|
||||
'Arial',
|
||||
this._onChange(true, true)
|
||||
);
|
||||
this._addAttribute(
|
||||
|
Loading…
Reference in New Issue
Block a user