From be59bc46c3a4b9c23084cea0ddb714447bcbc7af Mon Sep 17 00:00:00 2001 From: Yoann Moinet Date: Mon, 28 Sep 2015 23:22:41 -0400 Subject: [PATCH] feat(nipple): remove position offset --- src/manager.js | 4 ++-- src/nipple.js | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/manager.js b/src/manager.js index fd5edef..97e8ced 100644 --- a/src/manager.js +++ b/src/manager.js @@ -292,8 +292,8 @@ Manager.prototype.processOnMove = function (evt) { } nipple.frontPosition = { - x: pos.x - nipple.position.x + nipple.options.size / 4, - y: pos.y - nipple.position.y + nipple.options.size / 4 + x: pos.x - nipple.position.x, + y: pos.y - nipple.position.y }; if (!this.nippleOptions.dataOnly) { diff --git a/src/nipple.js b/src/nipple.js index ae49127..5bcaee1 100644 --- a/src/nipple.js +++ b/src/nipple.js @@ -107,6 +107,8 @@ Nipple.prototype.stylize = function () { display: 'block', width: '100%', height: '100%', + marginLeft: -this.options.size / 2 + 'px', + marginTop: -this.options.size / 2 + 'px', background: this.options.color, 'borderRadius': '50%', 'webkitBorderRadius': '50%', @@ -119,6 +121,8 @@ Nipple.prototype.stylize = function () { height: '50%', position: 'absolute', display: 'block', + marginLeft: -this.options.size / 4 + 'px', + marginTop: -this.options.size / 4 + 'px', background: this.options.color, 'borderRadius': '50%', 'webkitBorderRadius': '50%',