mirror of
https://github.com/wassname/CanvasTextWrapper.git
synced 2026-06-27 17:13:51 +08:00
@@ -5,7 +5,7 @@
|
||||
* Copyright (c) 2014 Vadim Namniak
|
||||
*/
|
||||
|
||||
(function() {
|
||||
(function(root) {
|
||||
'use strict';
|
||||
|
||||
var EL_WIDTH,EL_HEIGHT,MAX_TXT_WIDTH,MAX_TXT_HEIGHT;
|
||||
@@ -284,5 +284,9 @@
|
||||
}
|
||||
};
|
||||
|
||||
window.CanvasTextWrapper = CanvasTextWrapper;
|
||||
})();
|
||||
if ('module' in root && 'exports' in module) {
|
||||
module.exports = CanvasTextWrapper;
|
||||
} else {
|
||||
root.CanvasTextWrapper = CanvasTextWrapper;
|
||||
}
|
||||
})(this);
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Executable → Regular
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<script src="CanvasTextWrapper.js"></script>
|
||||
<script >
|
||||
var ctx = document.createElement('canvas').getContext('2d');
|
||||
ctx.canvas.width = ctx.canvas.height = 200;
|
||||
CanvasTextWrapper(ctx.canvas, "hello world how long can this be????");
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.body.appendChild(ctx.canvas);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Executable → Regular
Reference in New Issue
Block a user