Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
updated build
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin committed Jan 3, 2017
1 parent b3e6eb4 commit a00e022
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
17 changes: 16 additions & 1 deletion build/gifshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ defaultOptions = {
'keepCameraOn': false,
'images': [],
'video': null,
'stamp': null,
'webcamVideoElement': null,
'cameraStream': null,
'text': '',
Expand Down Expand Up @@ -1135,9 +1136,23 @@ AnimatedGIF = function (utils, frameWorkerCode, NeuQuant, GifWriter) {
},
'addFrame': function (element, gifshotOptions, frameText) {
gifshotOptions = utils.isObject(gifshotOptions) ? gifshotOptions : {};
var self = this, ctx = self.ctx, options = self.options, width = options.gifWidth, height = options.gifHeight, gifHeight = gifshotOptions.gifHeight, gifWidth = gifshotOptions.gifWidth, text = gifshotOptions.text, fontWeight = gifshotOptions.fontWeight, fontSize = utils.getFontSize(gifshotOptions), fontFamily = gifshotOptions.fontFamily, fontColor = gifshotOptions.fontColor, textAlign = gifshotOptions.textAlign, textBaseline = gifshotOptions.textBaseline, textXCoordinate = gifshotOptions.textXCoordinate ? gifshotOptions.textXCoordinate : textAlign === 'left' ? 1 : textAlign === 'right' ? width : width / 2, textYCoordinate = gifshotOptions.textYCoordinate ? gifshotOptions.textYCoordinate : textBaseline === 'top' ? 1 : textBaseline === 'center' ? height / 2 : height, font = fontWeight + ' ' + fontSize + ' ' + fontFamily, imageData, stroke;
var self = this, ctx = self.ctx, options = self.options, width = options.gifWidth, height = options.gifHeight, stamp = options.stamp, stampHeight = 26, stampWidth = stampHeight / 0.192, gifHeight = gifshotOptions.gifHeight, gifWidth = gifshotOptions.gifWidth, text = gifshotOptions.text, fontWeight = gifshotOptions.fontWeight, fontSize = utils.getFontSize(gifshotOptions), fontFamily = gifshotOptions.fontFamily, fontColor = gifshotOptions.fontColor, textAlign = gifshotOptions.textAlign, textBaseline = gifshotOptions.textBaseline, textXCoordinate = gifshotOptions.textXCoordinate ? gifshotOptions.textXCoordinate : textAlign === 'left' ? 1 : textAlign === 'right' ? width - 7 : width / 2, textYCoordinate = gifshotOptions.textYCoordinate ? gifshotOptions.textYCoordinate : textBaseline === 'top' ? 7 : textBaseline === 'center' ? height / 2 : height, font = fontWeight + ' ' + fontSize + ' ' + fontFamily, imageData, stroke;
if (width < 250) {
if (width < 90) {
stamp = null;
frameText = null;
} else if (height < 50) {
stamp = null;
} else {
textXCoordinate = 90;
textYCoordinate = height - 30;
}
}
try {
ctx.drawImage(element, 0, 0, width, height);
if (stamp && stampWidth > 80) {
ctx.drawImage(stamp, 2.5, 2.5);
}
if (text || frameText) {
ctx.font = font;
ctx.fillStyle = fontColor;
Expand Down
Loading

0 comments on commit a00e022

Please sign in to comment.