Add new canvas instruction array in ol/render/canvas/Instruction

Don't re-create the arrays on every replay group
This commit is contained in:
Frederic Junod
2018-02-12 18:25:02 +01:00
parent ba460554a1
commit 95dff19070
3 changed files with 40 additions and 21 deletions
+28 -1
View File
@@ -5,7 +5,7 @@
/**
* @enum {number}
*/
export default {
const Instruction = {
BEGIN_GEOMETRY: 0,
BEGIN_PATH: 1,
CIRCLE: 2,
@@ -20,3 +20,30 @@ export default {
SET_STROKE_STYLE: 11,
STROKE: 12
};
/**
* @type {Array.<Instruction>}
*/
export const fillInstruction = [Instruction.FILL];
/**
* @type {Array.<Instruction>}
*/
export const strokeInstruction = [Instruction.STROKE];
/**
* @type {Array.<Instruction>}
*/
export const beginPathInstruction = [Instruction.BEGIN_PATH];
/**
* @type {Array.<Instruction>}
*/
export const closePathInstruction = [Instruction.CLOSE_PATH];
export default Instruction;