MCPcopy
hub / github.com/fabricjs/fabric.js / toObject

Method toObject

src/Shadow.ts:226–240  ·  view source on GitHub ↗

* Returns object representation of a shadow * @return {Object} Object representation of a shadow instance

()

Source from the content-addressed store, hash-verified

224 * @return {Object} Object representation of a shadow instance
225 */
226 toObject() {
227 const data: SerializedShadowOptions = {
228 color: this.color,
229 blur: this.blur,
230 offsetX: this.offsetX,
231 offsetY: this.offsetY,
232 affectStroke: this.affectStroke,
233 nonScaling: this.nonScaling,
234 type: (this.constructor as typeof Shadow).type,
235 };
236 const defaults = Shadow.ownDefaults as SerializedShadowOptions;
237 return !this.includeDefaultValues
238 ? pickBy(data, (value, key) => value !== defaults[key])
239 : data;
240 }
241
242 static async fromObject(options: Partial<TClassProperties<Shadow>>) {
243 return new this(options);

Callers 15

toMatchObjectSnapshotFunction · 0.45
line.jsFile · 0.45
canvas.jsFile · 0.45
rect.jsFile · 0.45
pattern.jsFile · 0.45
polyline.jsFile · 0.45
image.jsFile · 0.45
object.jsFile · 0.45
testFractionDigitsFunction · 0.45
image_filters.jsFile · 0.45
group.jsFile · 0.45
path.jsFile · 0.45

Calls 1

pickByFunction · 0.90

Tested by

no test coverage detected