UNPKG

fin-hypergrid

Version:
49 lines (36 loc) 1.2 kB
'use strict'; var CellRenderer = require('./CellRenderer'); /** * @constructor * @extends CellRenderer */ var LastSelection = CellRenderer.extend('LastSelection', { /** * @desc A rendering of the last Selection Model * @implements paintFunction * @memberOf LastSelection.prototype */ paint: function(gc, config) { var visOverlay = gc.alpha(config.selectionRegionOverlayColor) > 0, visOutline = gc.alpha(config.selectionRegionOutlineColor) > 0; if (visOverlay || visOutline) { var x = config.bounds.x, y = config.bounds.y, width = config.bounds.width, height = config.bounds.height; gc.beginPath(); gc.rect(x, y, width, height); if (visOverlay) { gc.cache.fillStyle = config.selectionRegionOverlayColor; gc.fill(); } if (visOutline) { gc.cache.lineWidth = 1; gc.cache.strokeStyle = config.selectionRegionOutlineColor; gc.stroke(); } gc.closePath(); } } }); module.exports = LastSelection;