mirror of
https://github.com/wassname/CanvasTextWrapper.git
synced 2026-09-10 11:40:42 +08:00
fixed 1st example
This commit is contained in:
@@ -1,10 +1,3 @@
|
|||||||
/*! CanvasTextWrapper
|
|
||||||
* https://github.com/namniak/CanvasTextWrapper
|
|
||||||
* Version: 0.4.0
|
|
||||||
* MIT License (http://www.opensource.org/licenses/mit-license.html)
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
(function (root) {
|
(function (root) {
|
||||||
|
|
||||||
function CanvasTextWrapper(canvas, text, options) {
|
function CanvasTextWrapper(canvas, text, options) {
|
||||||
@@ -73,6 +66,7 @@
|
|||||||
|
|
||||||
setFont(--fontSize);
|
setFont(--fontSize);
|
||||||
lineHeight = fontSize;
|
lineHeight = fontSize;
|
||||||
|
wrap();
|
||||||
} else {
|
} else {
|
||||||
wrap();
|
wrap();
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ document.onreadystatechange = function() {
|
|||||||
canvas.width = w;
|
canvas.width = w;
|
||||||
canvas.height = h;
|
canvas.height = h;
|
||||||
context = canvas.getContext('2d');
|
context = canvas.getContext('2d');
|
||||||
context.lineWidth = 2;
|
context.lineWidth = 1;
|
||||||
context.strokeStyle = 'yellow';
|
context.strokeStyle = 'yellow';
|
||||||
CanvasTextWrapper(canvas,(options[i].txt),options[i]);
|
CanvasTextWrapper(canvas,(options[i].txt),options[i]);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
var model = [
|
var model = [
|
||||||
{
|
{
|
||||||
txt: 'Break text on every next word',
|
txt: 'Break text on every next word',
|
||||||
font: 'italic 800 36px Arial, sans-serif',
|
font: 'italic 800 25px Arial, sans-serif',
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
lineBreak: 'word',
|
lineBreak: 'word',
|
||||||
lineHeight: "160%"
|
lineHeight: "160%"
|
||||||
|
|||||||
Reference in New Issue
Block a user