Skip to content

Commit fe9523c

Browse files
author
Ruben Daniels
committed
* Fix animations for gotoline, gotofile, codeeditor, searchinfiles, searchreplace
1 parent 0bd4e91 commit fe9523c

10 files changed

Lines changed: 77 additions & 45 deletions

File tree

plugins-client/ext.anims/anims.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module.exports = ext.register("ext/anims/anims", {
4646
var isFirst, oNode = (isFirst = aNode == firstChild) ? lastChild : firstChild;
4747
if (oNode == aNode || !oNode.visible)
4848
throw new Error("animating object that has no partner");
49-
49+
5050
var to2;
5151
if (pNode.$vbox) {
5252
to2 = { timingFunction : options.timingFunction };
@@ -64,6 +64,15 @@ module.exports = ext.register("ext/anims/anims", {
6464
}
6565

6666
if (shouldAnimate && !options.immediate) {
67+
68+
ide.dispatchEvent("animate", {
69+
type: "splitbox",
70+
which: aNode,
71+
other: oNode,
72+
options: options,
73+
options2: to2
74+
});
75+
6776
Firmin.animate(aNode.$ext, options, options.duration || 0.2, function() {
6877
aNode.$ext.style[apf.CSSPREFIX + "TransitionDuration"] = "";
6978
//apf.layout.forceResize();

plugins-client/ext.code/code.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,25 @@ module.exports = ext.register("ext/code/code", {
836836
ide.addEventListener("afteronline", function(){
837837
menus.menus["View/Syntax"].enable();
838838
});
839+
840+
ide.addEventListener("animate", function(e){
841+
if (e.type == "splitbox") {
842+
if (e.options.height != undefined && apf.isChildOf(e.other, ceEditor, true)) {
843+
var delta = e.which.getHeight() - parseInt(e.options.height);
844+
if (delta < 0) return;
845+
846+
var renderer = ceEditor.$editor.renderer;
847+
renderer.onResize(true, null, null, ceEditor.getHeight() + delta);
848+
}
849+
else if (e.options.width != undefined && apf.isChildOf(e.other, ceEditor, true)) {
850+
var delta = e.which.getWidth() - parseInt(e.options.width);
851+
if (delta < 0) return;
852+
853+
var renderer = ceEditor.$editor.renderer;
854+
renderer.onResize(true, null, ceEditor.getWidth() + delta);
855+
}
856+
}
857+
});
839858
},
840859

841860
/**

plugins-client/ext.editors/editors.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,14 +766,16 @@ module.exports = ext.register("ext/editors/editors", {
766766
else if (!page.id)
767767
app.navigateTo(app.loc || (app.loc = "myhome"));*/
768768

769-
770-
setTimeout(function(){
769+
clearTimeout(this.afterswitchTimeout);
770+
this.afterswitchTimeout = setTimeout(function(){
771771
_self.switchLoop = page.id;
772772

773773
ide.dispatchEvent("tab.afterswitch", {
774774
previousPage: e.previousPage,
775775
nextPage: e.nextPage
776776
});
777+
778+
delete _self.switchLoop;
777779
}, 150);
778780
},
779781

plugins-client/ext.gotofile/gotofile.js

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var editors = require("ext/editors/editors");
1515
var markup = require("text!ext/gotofile/gotofile.xml");
1616
var search = require('ext/gotofile/search');
1717
var filelist = require("ext/filelist/filelist");
18+
var anims = require("ext/anims/anims");
1819

1920
module.exports = ext.register("ext/gotofile/gotofile", {
2021
name : "Go To File",
@@ -408,22 +409,18 @@ module.exports = ext.register("ext/gotofile/gotofile", {
408409
winGoToFile.visible = false;
409410

410411
//Animate
411-
apf.tween.single(winGoToFile, {
412-
type : "fade",
413-
from : 1,
414-
to : 0,
415-
steps : 5,
416-
interval : 0,
417-
control : (this.control = {}),
418-
onfinish : function(){
419-
winGoToFile.visible = true;
420-
winGoToFile.hide();
421-
422-
if (editors.currentEditor && editors.currentEditor.ceEditor)
423-
editors.currentEditor.ceEditor.focus();
424-
425-
callback && callback();
426-
}
412+
anims.animate(winGoToFile, {
413+
opacity: "0",
414+
timingFunction: "linear",
415+
duration : 0.025
416+
}, function(){
417+
winGoToFile.visible = true;
418+
winGoToFile.hide();
419+
420+
if (editors.currentEditor && editors.currentEditor.ceEditor)
421+
editors.currentEditor.ceEditor.focus();
422+
423+
callback && callback();
427424
});
428425
}
429426
else {

plugins-client/ext.gotoline/gotoline.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,10 @@ module.exports = ext.register("ext/gotoline/gotoline", {
226226
if (typeof line != "number")
227227
line = parseInt(txtLineNr.getValue(), 10) || 0;
228228

229-
ace.gotoLine(line);
229+
if (!this.lastLine || this.lastLine != line) {
230+
ace.gotoLine(line);
231+
this.lastLine = line;
232+
}
230233

231234
if (typeof preview != "undefined") {
232235
var animate = apf.isTrue(settings.model.queryValue("editors/code/@animatedscroll"));

plugins-client/ext.main/style/skins.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11116,7 +11116,8 @@
1111611116
color:white;
1111711117
}
1111811118
11119-
.filemgr-treeFocus > .item-fix.selected:first-child {
11119+
.filemgr-treeFocus > .item-fix.selected:first-child,
11120+
.filemgr-tree.openfile > .item-fix.selected:first-child {
1112011121
border-top-color:#166CAD;
1112111122
}
1112211123

plugins-client/ext.save/save.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,10 @@ module.exports = ext.register("ext/save/save", {
8181
ide.addEventListener("init.ext/editors/editors", function(){
8282
tabEditors.addEventListener("close", _self.$close = function(e) {
8383
var at = e.page.$at;
84-
if (!at.undo_ptr)
85-
at.undo_ptr = at.$undostack[0];
8684
var node = e.page.$doc.getNode();
87-
if (node && at.undo_ptr && at.$undostack[at.$undostack.length-1] !== at.undo_ptr
88-
|| !at.undo_ptr && node.getAttribute("changed") == 1
89-
&& e.page.$doc.getValue()) {
85+
if (node && (at.undo_ptr && at.$undostack[at.$undostack.length-1] !== at.undo_ptr
86+
|| !at.undo_ptr && node.getAttribute("changed") == 1)
87+
&& (!node.getAttribute("newfile") || e.page.$doc.getValue())) {
9088

9189
ext.initExtension(_self);
9290

plugins-client/ext.searchinfiles/searchinfiles.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ var commands = require("ext/commands/commands");
2121
var tooltip = require("ext/tooltip/tooltip");
2222
var libsearch = require("ext/searchreplace/libsearch");
2323
var searchreplace = require("ext/searchreplace/searchreplace");
24+
var anims = require("ext/anims/anims");
2425

2526
module.exports = ext.register("ext/searchinfiles/searchinfiles", apf.extend({
2627
name : "Search in files",
@@ -42,7 +43,9 @@ module.exports = ext.register("ext/searchinfiles/searchinfiles", apf.extend({
4243

4344
hook : function(){
4445
var _self = this;
45-
46+
47+
this.markupInsertionPoint = searchRow;
48+
4649
commands.addCommand({
4750
name: "searchinfiles",
4851
hint: "search for a string through all files in the current workspace",
@@ -82,14 +85,6 @@ module.exports = ext.register("ext/searchinfiles/searchinfiles", apf.extend({
8285
}
8386
});
8487

85-
ide.addEventListener("init.ext/console/console", function(e){
86-
searchRow.insertBefore(winSearchInFiles, e.ext.splitter);
87-
});
88-
if (winSearchInFiles.parentNode != searchRow) {
89-
searchRow.insertBefore(winSearchInFiles,
90-
self.winDbgConsole && winDbgConsole.previousSibling || null);
91-
}
92-
9388
winSearchInFiles.addEventListener("prop.visible", function(e) {
9489
if (e.value) {
9590
if (self.trFiles)
@@ -276,6 +271,7 @@ module.exports = ext.register("ext/searchinfiles/searchinfiles", apf.extend({
276271
}
277272
}
278273

274+
searchRow.appendChild(winSearchInFiles);
279275
winSearchInFiles.show();
280276
txtSFFind.focus();
281277
txtSFFind.select();
@@ -285,10 +281,11 @@ module.exports = ext.register("ext/searchinfiles/searchinfiles", apf.extend({
285281

286282
//Animate
287283
if (animate) {
288-
Firmin.animate(winSearchInFiles.$ext, {
284+
anims.animateSplitBoxNode(winSearchInFiles, {
289285
height: "102px",
290-
timingFunction: "cubic-bezier(.10, .10, .25, .90)"
291-
}, 0.2, function() {
286+
timingFunction: "cubic-bezier(.10, .10, .25, .90)",
287+
duration: 0.2
288+
}, function() {
292289
winSearchInFiles.$ext.style[apf.CSSPREFIX + "TransitionDuration"] = "";
293290
winSearchInFiles.$ext.style.height = "";
294291

@@ -306,20 +303,21 @@ module.exports = ext.register("ext/searchinfiles/searchinfiles", apf.extend({
306303
if (txtSFFind.getValue())
307304
_self.saveHistory(txtSFFind.getValue());
308305

309-
310306
//Animate
311307
if (animate) {
312308
winSearchInFiles.visible = false;
313309

314310
winSearchInFiles.$ext.style.height
315311
= winSearchInFiles.$ext.offsetHeight + "px";
316312

317-
Firmin.animate(winSearchInFiles.$ext, {
313+
anims.animateSplitBoxNode(winSearchInFiles, {
318314
height: "0px",
319-
timingFunction: "ease-in-out"
320-
}, 0.2, function(){
315+
timingFunction: "ease-in-out",
316+
duration : 0.2
317+
}, function(){
321318
winSearchInFiles.visible = true;
322319
winSearchInFiles.hide();
320+
winSearchInFiles.parentNode.removeChild(winSearchInFiles);
323321

324322
winSearchInFiles.$ext.style[apf.CSSPREFIX + "TransitionDuration"] = "";
325323

@@ -335,6 +333,8 @@ module.exports = ext.register("ext/searchinfiles/searchinfiles", apf.extend({
335333
}
336334
else {
337335
winSearchInFiles.hide();
336+
winSearchInFiles.parentNode.removeChild(winSearchInFiles);
337+
338338
callback
339339
? callback()
340340
: apf.layout.forceResize();

plugins-client/ext.searchreplace/searchreplace.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ module.exports = ext.register("ext/searchreplace/searchreplace", apf.extend({
368368
if (!editor || !editor.amlEditor)
369369
return;
370370

371-
var wasVisible = winSearchReplace.visible;
371+
var wasVisible = !!winSearchReplace.parentNode;//visible;
372372
var stateChange = isReplace != undefined && this.$lastState != isReplace;
373373

374374
tooltipSearchReplace.$ext.style.display = "none";
@@ -416,6 +416,7 @@ module.exports = ext.register("ext/searchreplace/searchreplace", apf.extend({
416416
}
417417
}
418418

419+
searchRow.appendChild(winSearchReplace);
419420
winSearchReplace.show();
420421
txtFind.focus();
421422
txtFind.select();
@@ -472,6 +473,7 @@ module.exports = ext.register("ext/searchreplace/searchreplace", apf.extend({
472473
}, function(){
473474
winSearchReplace.visible = true;
474475
winSearchReplace.hide();
476+
winSearchReplace.parentNode.removeChild(winSearchReplace);
475477

476478
if (!noselect)
477479
editor.ceEditor.focus();
@@ -484,6 +486,7 @@ module.exports = ext.register("ext/searchreplace/searchreplace", apf.extend({
484486
else {
485487
winSearchReplace.visible = true;
486488
winSearchReplace.hide();
489+
winSearchReplace.parentNode.removeChild(winSearchReplace);
487490
if (!noselect)
488491
editor.ceEditor.focus();
489492

plugins-client/lib.apf/www/apf/elements/codeeditor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,8 @@ apf.codeeditor = module.exports = function(struct, tagName) {
497497
//@todo cleanup and put initial-message behaviour in one location
498498
this.clear = function(){
499499
this.$propHandlers["value"].call(this, "", null, true);
500-
this.$editor.resize();
501-
this.$editor.renderer.updateFull(true);
500+
this.$editor.resize(true);
501+
//this.$editor.renderer.updateFull(true);
502502

503503
this.dispatchEvent("clear");//@todo this should work via value change
504504
};

0 commit comments

Comments
 (0)