working on freemind layout
This commit is contained in:
@@ -58,6 +58,7 @@
|
||||
<include>${basedir}/target/tmp/Utils-min.js</include>
|
||||
<include>${basedir}/target/tmp/WaitDialog-min.js</include>
|
||||
<include>${basedir}/target/tmp/footer-min.js</include>
|
||||
<include>${basedir}/target/tmp/Executor-min.js</include>
|
||||
</includes>
|
||||
</aggregation>
|
||||
</aggregations>
|
||||
|
55
core-js/src/main/javascript/Executor.js
Normal file
55
core-js/src/main/javascript/Executor.js
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* I need this class to clean up things after loading has finished. Without this, async functions at startup are a
|
||||
* nightmare.
|
||||
*/
|
||||
|
||||
core.Executor = new Class({
|
||||
options:{
|
||||
isLoading:true
|
||||
},
|
||||
initialize:function(options){
|
||||
this._pendingFunctions=[];
|
||||
},
|
||||
setLoading:function(isLoading){
|
||||
this.options.isLoading = isLoading;
|
||||
if(!isLoading){
|
||||
this._pendingFunctions.forEach(function(item){
|
||||
var result = item.fn.attempt(item.args, item.bind);
|
||||
core.assert(result, "execution failed");
|
||||
});
|
||||
this._pendingFunctions=[];
|
||||
}
|
||||
},
|
||||
isLoading:function(){
|
||||
return this.options.isLoading;
|
||||
},
|
||||
delay:function(fn, delay, bind, args){
|
||||
if(this.options.isLoading){
|
||||
this._pendingFunctions.push({fn:fn, bind:bind, args:args});
|
||||
}
|
||||
else{
|
||||
fn.delay(delay, bind, args);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
core.Executor.instance = new core.Executor();
|
@@ -318,6 +318,47 @@ core.Utils.animateVisibility = function (elems, isVisible, doneFn){
|
||||
_fadeEffect =fadeEffect.periodical(10);
|
||||
};
|
||||
|
||||
core.Utils.animatePosition = function (elems, doneFn, designer){
|
||||
var _moveEffect = null;
|
||||
var i = 10;
|
||||
var step = 10;
|
||||
var moveEffect = function (){
|
||||
if(i>0){
|
||||
var keys = elems.keys();
|
||||
for(var j = 0; j<keys.length; j++){
|
||||
var id = keys[j];
|
||||
var mod = elems.get(id);
|
||||
var allTopics = designer._getTopics();
|
||||
var currentTopic = allTopics.filter(function(node){
|
||||
return node.getId()== id;
|
||||
})[0];
|
||||
var xStep= (mod.originalPos.x -mod.newPos.x)/step;
|
||||
var yStep= (mod.originalPos.y -mod.newPos.y)/step;
|
||||
var newPos = currentTopic.getPosition().clone();
|
||||
newPos.x +=xStep;
|
||||
newPos.y +=yStep;
|
||||
currentTopic.setPosition(newPos, false);
|
||||
}
|
||||
} else {
|
||||
$clear(_moveEffect);
|
||||
var keys = elems.keys();
|
||||
for(var j = 0; j<keys.length; j++){
|
||||
var id = keys[j];
|
||||
var mod = elems.get(id);
|
||||
var allTopics = designer._getTopics();
|
||||
var currentTopic = allTopics.filter(function(node){
|
||||
return node.getId()== id;
|
||||
})[0];
|
||||
currentTopic.setPosition(mod.originalPos, false);
|
||||
}
|
||||
if(core.Utils.isDefined(doneFn))
|
||||
doneFn.attempt();
|
||||
}
|
||||
i--;
|
||||
};
|
||||
_moveEffect =moveEffect.periodical(10);
|
||||
};
|
||||
|
||||
core.Utils._addInnerChildrens = function(elem){
|
||||
var children = [];
|
||||
var childs = elem._getChildren();
|
||||
|
Reference in New Issue
Block a user