Fix flicker.

Remove more code.
This commit is contained in:
Paulo Veiga 2011-08-29 20:10:05 -03:00
parent d94414775e
commit c74d2de32d
11 changed files with 83 additions and 155 deletions

View File

@ -82,7 +82,6 @@
<filelist dir="${basedir}/src/main/javascript/" files="TextEditorFactory.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="VariableDistanceBoard.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="util/Shape.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="util/Converter.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="FixedDistanceBoard.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="BoardEntry.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="ModelCodeName.js"/>

View File

@ -88,7 +88,7 @@ mindplot.RelationshipLine = new Class({
this._positionateConnector(targetTopic);
if (this.isOnFocus()) {
this._refreshSelectedShape();
this._refreshShape();
}
this._focusShape.moveToBack();
this._controlPointsController.redraw();
@ -149,17 +149,19 @@ mindplot.RelationshipLine = new Class({
setOnFocus : function(focus) {
// Change focus shape
if (focus) {
this._refreshSelectedShape();
this._controlPointsController.setLine(this);
}
this._focusShape.setVisibility(focus);
if (this.isOnFocus() != focus) {
if (focus) {
this._refreshShape();
this._controlPointsController.setLine(this);
}
this._focusShape.setVisibility(focus);
this._controlPointsController.setVisibility(focus);
this._onFocus = focus;
this._controlPointsController.setVisibility(focus);
this._onFocus = focus;
}
},
_refreshSelectedShape : function () {
_refreshShape : function () {
var sPos = this._line2d.getFrom();
var tPos = this._line2d.getTo();
var ctrlPoints = this._line2d.getControlPoints();
@ -171,8 +173,6 @@ mindplot.RelationshipLine = new Class({
shapeCtrlPoints[1].x = ctrlPoints[1].x;
shapeCtrlPoints[1].y = ctrlPoints[1].y;
this._focusShape.updateLine();
//this._focusShape.setSrcControlPoint(ctrlPoints[0]);
//this._focusShape.setDestControlPoint(ctrlPoints[1]);
},
addEvent : function(type, listener) {

View File

@ -28,8 +28,10 @@ mindplot.ScreenManager = new Class({
event.stopPropagation()
});
// @Todo: This must be resolved in other way ...
mindplot.util.Converter.setScreenManager(this);
this._divContainer.addEvent('dblclick', function(event) {
event.stopPropagation() ;
event.preventDefault();
});
},
setScale : function(scale) {
@ -62,9 +64,9 @@ mindplot.ScreenManager = new Class({
}
},
getWorkspaceElementPosition : function(e) {
_getElementPosition : function(elem) {
// Retrieve current element position.
var elementPosition = e.getPosition();
var elementPosition = elem.getPosition();
var x = elementPosition.x;
var y = elementPosition.y;
@ -105,10 +107,9 @@ mindplot.ScreenManager = new Class({
//Retrieve topic Position
var topic = iconGroup.getTopic();
var topicPosition = this.getWorkspaceElementPosition(topic);
var topicPosition = this._getElementPosition(topic);
topicPosition.x = topicPosition.x - (parseInt(topic.getSize().width) / 2);
// Remove decimal part..
return {x:x + topicPosition.x,y:y + topicPosition.y};
},

View File

@ -47,8 +47,9 @@ mindplot.commands.AddTopicCommand = new Class(
if (this._animated) {
core.Utils.setVisibilityAnimated([topic,topic.getOutgoingLine()], true, doneFn);
} else
} else {
doneFn.attempt();
}
},
undoExecute: function(commandContext) {

View File

@ -57,7 +57,7 @@ mindplot.commands.MoveControlPointCommand = new Class({
break;
}
if (this._line.isOnFocus()) {
this._line._refreshSelectedShape();
this._line._refreshShape();
this._ctrlPointControler.setLine(this._line);
}
this._line.getLine().updateLine(this._point);
@ -86,7 +86,7 @@ mindplot.commands.MoveControlPointCommand = new Class({
this._line.getLine().updateLine(this._point);
if (this._line.isOnFocus()) {
this._ctrlPointControler.setLine(line);
line._refreshSelectedShape();
line._refreshShape();
}
}
});

View File

@ -1,31 +0,0 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
mindplot.util.Converter = {
topicToScreenPosition : function(topic) {
$assert(topic, "topic is not defined");
$assert(this._screenManager, "screenManager is not defined");
return this._screenManager.getWorkspaceElementPosition(topic);
}
};
mindplot.util.Converter.setScreenManager = function(instance) {
this._screenManager = instance;
};

View File

@ -66,10 +66,8 @@
<include>${basedir}/target/tmp/peer/svg/LinePeer-min.js</include>
<include>${basedir}/target/tmp/peer/svg/TahomaFont-min.js</include>
<include>${basedir}/target/tmp/peer/svg/VerdanaFont-min.js</include>
<include>${basedir}/target/tmp/Element-min.js</include>
<include>${basedir}/target/tmp/Elipse-min.js</include>
<include>${basedir}/target/tmp/EventDispatcher-min.js</include>
<include>${basedir}/target/tmp/Font-min.js</include>
<include>${basedir}/target/tmp/Group-min.js</include>
<include>${basedir}/target/tmp/Image-min.js</include>

View File

@ -87,19 +87,7 @@ web2d.Element.prototype.positionRelativeTo = function(elem, options) {
*
*/
web2d.Element.prototype.addEvent = function(type, listener) {
if (!this._supportedEvents.include(type)) {
throw "Unsupported event type: " + type;
}
// Concat previous event listeners for a given type.
if (!this._dispatcherByEventType[type]) {
this._dispatcherByEventType[type] = new web2d.EventDispatcher(this);
var eventListener = this._dispatcherByEventType[type].eventListener;
this._peer.addEvent(type, eventListener);
}
this._dispatcherByEventType[type].addListener(type, listener);
this._peer.addEvent(type, listener);
};
/**
*
@ -113,17 +101,7 @@ web2d.Element.prototype.addEvent = function(type, listener) {
* This interace will be invoked passing an event as argument and the 'this' referece in the function will be the element.
*/
web2d.Element.prototype.removeEvent = function(type, listener) {
var dispatcher = this._dispatcherByEventType[type];
if (dispatcher == null) {
throw "There is no listener previously registered";
}
var result = dispatcher.removeListener(type, listener);
// If there is not listeners, EventDispatcher must be removed.
if (dispatcher.getListenersCount() <= 0) {
this._peer.removeEvent(type, dispatcher.eventListener);
this._dispatcherByEventType[type] = null;
}
this._peer.removeEvent(type, listener);
};
/**

View File

@ -85,12 +85,12 @@ web2d.peer.svg.ElementPeer.prototype.removeChild = function(elementPeer) {
*/
web2d.peer.svg.ElementPeer.prototype.addEvent = function(type, listener) {
this._native.addEventListener(type, listener, false);
this._native.addEvent(type, listener);
};
web2d.peer.svg.ElementPeer.prototype.removeEvent = function(type, listener) {
this._native.removeEventListener(type, listener, false);
this._native.removeEvent(type, listener);
};
web2d.peer.svg.ElementPeer.prototype.setSize = function(width, height) {

View File

@ -1,26 +1,24 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
web2d.peer.svg.TextPeer = function()
{
web2d.peer.svg.TextPeer = function() {
var svgElement = window.document.createElementNS(this.svgNamespace, 'text');
web2d.peer.svg.ElementPeer.call(this, svgElement);
this._native.setAttribute("focusable", "false");
this._position = {x:0,y:0};
this._font = new web2d.Font("Arial", this);
};
@ -29,24 +27,21 @@ objects.extend(web2d.peer.svg.TextPeer, web2d.peer.svg.ElementPeer);
//todo: use ths method to specify the maximum size of the text box
/*web2d.web2d.peer.svg.TextPeer.prototype.setSize = function(width, height)
{
web2d.web2d.peer.svg.TextPeer.superClass.setSize.call(this,width,height);
this._native.setAttribute('rx', width / 2);
this._native.setAttribute('ry', height /ose 2);
};
*/
{
web2d.web2d.peer.svg.TextPeer.superClass.setSize.call(this,width,height);
this._native.setAttribute('rx', width / 2);
this._native.setAttribute('ry', height /ose 2);
};
*/
web2d.peer.svg.TextPeer.prototype.appendChild = function(element)
{
web2d.peer.svg.TextPeer.prototype.appendChild = function(element) {
this._native.appendChild(element._native);
};
web2d.peer.svg.TextPeer.prototype.setText = function(text)
{
web2d.peer.svg.TextPeer.prototype.setText = function(text) {
text = core.Utils.escapeInvalidTags(text);
var child = this._native.firstChild;
if ($defined(child))
{
if ($defined(child)) {
this._native.removeChild(child);
}
this._text = text;
@ -54,51 +49,42 @@ web2d.peer.svg.TextPeer.prototype.setText = function(text)
this._native.appendChild(textNode);
};
web2d.peer.svg.TextPeer.prototype.getText = function()
{
web2d.peer.svg.TextPeer.prototype.getText = function() {
return this._text;
};
web2d.peer.svg.TextPeer.prototype.setPosition = function(x, y)
{
web2d.peer.svg.TextPeer.prototype.setPosition = function(x, y) {
this._position = {x:x, y:y};
var height = this._font.getSize();
if($defined(this._parent) && $defined(this._native.getBBox))
if ($defined(this._parent) && $defined(this._native.getBBox))
height = this.getHeight();
var size = parseInt(height);
this._native.setAttribute('y', y+size*3/4);
this._native.setAttribute('y', y + size * 3 / 4);
//y+size/2
this._native.setAttribute('x', x);
};
web2d.peer.svg.TextPeer.prototype.getPosition = function()
{
web2d.peer.svg.TextPeer.prototype.getPosition = function() {
return this._position;
};
web2d.peer.svg.TextPeer.prototype.setFont = function(font, size, style, weight)
{
if ($defined(font))
{
web2d.peer.svg.TextPeer.prototype.setFont = function(font, size, style, weight) {
if ($defined(font)) {
this._font = new web2d.Font(font, this);
}
if ($defined(style))
{
if ($defined(style)) {
this._font.setStyle(style);
}
if ($defined(weight))
{
if ($defined(weight)) {
this._font.setWeight(weight);
}
if ($defined(size))
{
if ($defined(size)) {
this._font.setSize(size);
}
this._updateFontStyle();
};
web2d.peer.svg.TextPeer.prototype._updateFontStyle = function()
{
web2d.peer.svg.TextPeer.prototype._updateFontStyle = function() {
this._native.setAttribute('font-family', this._font.getFontFamily());
this._native.setAttribute('font-size', this._font.getGraphSize());
this._native.setAttribute('font-style', this._font.getStyle());
@ -108,41 +94,34 @@ web2d.peer.svg.TextPeer.prototype._updateFontStyle = function()
this._native.xFontScale = scale.toFixed(1);
};
web2d.peer.svg.TextPeer.prototype.setColor = function(color)
{
web2d.peer.svg.TextPeer.prototype.setColor = function(color) {
this._native.setAttribute('fill', color);
};
web2d.peer.svg.TextPeer.prototype.getColor = function()
{
web2d.peer.svg.TextPeer.prototype.getColor = function() {
return this._native.getAttribute('fill');
};
web2d.peer.svg.TextPeer.prototype.setTextSize = function (size)
{
web2d.peer.svg.TextPeer.prototype.setTextSize = function (size) {
this._font.setSize(size);
this._updateFontStyle();
};
web2d.peer.svg.TextPeer.prototype.setContentSize = function(width, height)
{
web2d.peer.svg.TextPeer.prototype.setContentSize = function(width, height) {
this._native.xTextSize = width.toFixed(1) + "," + height.toFixed(1);
};
web2d.peer.svg.TextPeer.prototype.setStyle = function (style)
{
web2d.peer.svg.TextPeer.prototype.setStyle = function (style) {
this._font.setStyle(style);
this._updateFontStyle();
};
web2d.peer.svg.TextPeer.prototype.setWeight = function (weight)
{
web2d.peer.svg.TextPeer.prototype.setWeight = function (weight) {
this._font.setWeight(weight);
this._updateFontStyle();
};
web2d.peer.svg.TextPeer.prototype.setFontFamily = function (family)
{
web2d.peer.svg.TextPeer.prototype.setFontFamily = function (family) {
var oldFont = this._font;
this._font = new web2d.Font(family, this);
this._font.setSize(oldFont.getSize());
@ -151,8 +130,7 @@ web2d.peer.svg.TextPeer.prototype.setFontFamily = function (family)
this._updateFontStyle();
};
web2d.peer.svg.TextPeer.prototype.getFont = function ()
{
web2d.peer.svg.TextPeer.prototype.getFont = function () {
return {
font:this._font.getFont(),
size:parseInt(this._font.getSize()),
@ -161,28 +139,24 @@ web2d.peer.svg.TextPeer.prototype.getFont = function ()
};
};
web2d.peer.svg.TextPeer.prototype.setSize = function (size)
{
web2d.peer.svg.TextPeer.prototype.setSize = function (size) {
this._font.setSize(size);
this._updateFontStyle();
};
web2d.peer.svg.TextPeer.prototype.getWidth = function ()
{
web2d.peer.svg.TextPeer.prototype.getWidth = function () {
var computedWidth = this._native.getBBox().width;
var width = parseInt(computedWidth);
width = width + this._font.getWidthMargin();
return width;
};
web2d.peer.svg.TextPeer.prototype.getHeight = function ()
{
web2d.peer.svg.TextPeer.prototype.getHeight = function () {
var computedHeight = this._native.getBBox().height;
return parseInt(computedHeight);
};
web2d.peer.svg.TextPeer.prototype.getHtmlFontSize = function ()
{
web2d.peer.svg.TextPeer.prototype.getHtmlFontSize = function () {
return this._font.getHtmlSize();
};

View File

@ -6,6 +6,14 @@ html {
overflow: hidden;
}
body {
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
}
#waitDialog {
position: absolute;
top: 10px;