From 001ff2e371a46fc232e04bfb89aec9c3b8f84094 Mon Sep 17 00:00:00 2001 From: Paulo Veiga Date: Fri, 2 Sep 2011 18:25:34 -0300 Subject: [PATCH] Add icon to padding. --- mindplot/src/main/javascript/Icon.js | 11 +++-------- mindplot/src/main/javascript/IconGroup.js | 10 +++++++--- mindplot/src/main/javascript/Note.js | 3 ++- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/mindplot/src/main/javascript/Icon.js b/mindplot/src/main/javascript/Icon.js index 24088bee..2bd23e83 100644 --- a/mindplot/src/main/javascript/Icon.js +++ b/mindplot/src/main/javascript/Icon.js @@ -21,7 +21,7 @@ mindplot.Icon = new Class({ $assert(url, 'topic can not be null'); this._image = new web2d.Image(); this._image.setHref(url); - this._image.setSize(100,100); + this._image.setSize(mindplot.Icon.SIZE, mindplot.Icon.SIZE); }, getImage : function() { @@ -44,21 +44,16 @@ mindplot.Icon = new Class({ return this._image.getPosition(); }, - setSize : function(x, y) { - return this._image.setSize(x, y); - }, - addEvent : function(type, fnc) { this._image.addEvent(type, fnc); }, - remove : function() - { + remove : function() { throw "Unsupported operation"; } }); -mindplot.Icon.HEIGHT = 100; +mindplot.Icon.SIZE = 90; diff --git a/mindplot/src/main/javascript/IconGroup.js b/mindplot/src/main/javascript/IconGroup.js index 3fc899f8..b486248f 100644 --- a/mindplot/src/main/javascript/IconGroup.js +++ b/mindplot/src/main/javascript/IconGroup.js @@ -141,14 +141,18 @@ mindplot.IconGroup = new Class({ _resize : function(iconsLength) { this._group.setSize(iconsLength * this._iconSize.width, this._iconSize.height); - this._group.setCoordSize(iconsLength * mindplot.Icon.HEIGHT, mindplot.Icon.HEIGHT); + + var iconSize = mindplot.Icon.SIZE + (mindplot.IconGroup.ICON_PADDING * 2); + this._group.setCoordSize(iconsLength * iconSize, iconSize); }, _positionIcon : function(icon, order) { - icon.getImage().setPosition(mindplot.Icon.HEIGHT * order, 0); + + var iconSize = mindplot.Icon.SIZE + (mindplot.IconGroup.ICON_PADDING * 2); + icon.getImage().setPosition(iconSize * order + mindplot.IconGroup.ICON_PADDING, mindplot.IconGroup.ICON_PADDING); } }); - +mindplot.IconGroup.ICON_PADDING = 5; mindplot.IconGroup.RemoveTip = new Class({ initialize : function(container) { diff --git a/mindplot/src/main/javascript/Note.js b/mindplot/src/main/javascript/Note.js index 86a3dd4c..43b0a017 100644 --- a/mindplot/src/main/javascript/Note.js +++ b/mindplot/src/main/javascript/Note.js @@ -19,7 +19,8 @@ mindplot.Note = new Class({ Extends: mindplot.Icon, initialize : function(topic, noteModel) { - $assert(topicId, 'topic can not be null'); + $assert(topic, 'topic can not be null'); + this.parent(mindplot.Note.IMAGE_URL); this._noteModel = noteModel; this._topic = topic;