Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions models/Fill/Fill.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

const Color = require('../Color');
const Gradient = require('../Gradient');
const GraphicsContextSettings = require('../GraphicsContextSettings');

/**
*
Expand All @@ -26,6 +27,7 @@ class Fill {
* @property {integer} noiseIntensity
* @property {integer} patternFillType
* @property {integer} patternTileScale
* @property {GraphicsContextSettings.Model} contextSettings
*/
static get Model() {
return {
Expand All @@ -38,13 +40,15 @@ class Fill {
patternFillType: 0,
patternTileScale: 1,
gradient: Gradient.Model,
contextSettings: GraphicsContextSettings.Model,
};
}

/**
*
* @param {Object} args
* @param {String|Object} args.color Passed to {@link Color} constructor
* @param {float|Object} args.opacity Passed to {@link GraphicsContextSettings} constructor
* @param {Fill.Model} json
*/
constructor(args = {}, json) {
Expand All @@ -69,6 +73,7 @@ class Fill {
patternFillType: args.patternFillType || 0,
patternTileScale: args.patternTileScale || 1,
gradient: args.gradient ? new Gradient(args.gradient) : undefined,
contextSettings: new GraphicsContextSettings({ opacity: args.opacity }),
});
}
return this;
Expand Down
2 changes: 2 additions & 0 deletions models/Fill/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Color from '../Color';
import Gradient from '../Gradient';
import GraphicsContextSettings from '../GraphicsContextSettings';

declare const enum FillType {
Color = 0,
Expand All @@ -20,6 +21,7 @@ declare class Fill {
patternFillType: number;
patternTileScale: number;
gradient: Gradient;
contextSettings: GraphicsContextSettings;

constructor(args?: any, json?: any);
}
Expand Down
1 change: 1 addition & 0 deletions models/GraphicsContextSettings/GraphicsContextSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class GraphicsContextSettings {
} else {
Object.assign(this, GraphicsContextSettings.Model, args, {
blendMode: blendModeMap[args.blendMode || 'normal'],
opacity: args.opacity || 1,
});
}
return this;
Expand Down