Only define *existing* methods, when converting the OPS format to method-names on the CanvasGraphics.prototype

There's no good reason, as far as I can tell, to explicitly define a bunch of methods to be `undefined`, which the current unconditional "copying" of methods will do.
Note that of the `OPS` ~23 percent don't, for various reasons, have an associated method on the `CanvasGraphics.prototype`.
This commit is contained in:
Jonas Jenwald 2021-07-25 13:18:24 +02:00
parent fbaafdc4e8
commit e1fa845293

View File

@ -2804,7 +2804,9 @@ class CanvasGraphics {
}
for (const op in OPS) {
CanvasGraphics.prototype[OPS[op]] = CanvasGraphics.prototype[op];
if (CanvasGraphics.prototype[op] !== undefined) {
CanvasGraphics.prototype[OPS[op]] = CanvasGraphics.prototype[op];
}
}
export { CanvasGraphics };