From 6486606670578de5ebfe4ade915187bccd512f36 Mon Sep 17 00:00:00 2001 From: anvaka Date: Tue, 14 Jan 2014 01:12:29 -0800 Subject: [PATCH] createCanvasForNode passes options to FabricCanvas Some options like renderOnAddRemove plays crucial role in canvas performance. This change allows clients to use custom options for node.js --- src/node.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/node.js b/src/node.js index 4bb44fab..e84d55d9 100644 --- a/src/node.js +++ b/src/node.js @@ -136,9 +136,10 @@ * Only available when running fabric on node.js * @param width Canvas width * @param height Canvas height + * @param {Object} options to pass to FabricCanvas. * @return {Object} wrapped canvas instance */ - fabric.createCanvasForNode = function(width, height) { + fabric.createCanvasForNode = function(width, height, options) { var canvasEl = fabric.document.createElement('canvas'), nodeCanvas = new Canvas(width || 600, height || 600); @@ -150,7 +151,7 @@ canvasEl.height = nodeCanvas.height; var FabricCanvas = fabric.Canvas || fabric.StaticCanvas; - var fabricCanvas = new FabricCanvas(canvasEl); + var fabricCanvas = new FabricCanvas(canvasEl, options); fabricCanvas.contextContainer = nodeCanvas.getContext('2d'); fabricCanvas.nodeCanvas = nodeCanvas; fabricCanvas.Font = Canvas.Font;