From 818a0b0cff51dd5472c34168f840c7bbfa420ec6 Mon Sep 17 00:00:00 2001 From: SPAHI4 Date: Wed, 22 Oct 2014 17:16:20 +0400 Subject: [PATCH] Added "middle" position --- watermark.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/watermark.js b/watermark.js index 1039f0c..9118bc5 100644 --- a/watermark.js +++ b/watermark.js @@ -106,7 +106,10 @@ else x = gcanvas.width-watermark.width-10; - + if(position.indexOf("middle")!=-1) { + x = (gcanvas.width()-watermark.width()) / 2; + y = (gcanvas.height()-watermark.height()) / 2; + } gctx.drawImage(watermark, x, y); img.onload = null; @@ -141,4 +144,4 @@ }; })(w); w.wmark = wm; -})(window); \ No newline at end of file +})(window);