Skip to content

Commit 96b8290

Browse files
committed
visualpython#10 - scroll to applied block
1 parent 32596ae commit 96b8290

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/api_block/blockContainer.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,9 @@ define([
261261
this.reRenderAllBlock_asc();
262262
this.resetBlockListAndRenderThisBlock(block);
263263
}
264-
return true;
264+
return block;
265265
} else {
266-
return false;
266+
return null;
267267
}
268268
}
269269

@@ -292,9 +292,9 @@ define([
292292
this.resetOptionPage();
293293
this.reRenderAllBlock_asc();
294294
}
295-
return true;
295+
return block;
296296
} else {
297-
return false;
297+
return null;
298298
}
299299

300300
}

src/api_block/init.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,11 +443,15 @@ define([
443443

444444
/** option page - apply 버튼 클릭 함수 바인딩 */
445445
$(document).on(STR_CLICK, VP_ID_PREFIX + VP_APIBLOCK_BOARD_OPTION_APPLY_BUTTON, function() {
446-
var isApplied = blockContainer.applyBlock();
446+
var appliedBlock = blockContainer.applyBlock();
447447

448-
if (isApplied) {
448+
if (appliedBlock) {
449449
// #11 applied! popup
450450
vpCommon.renderSuccessMessage('Applied!');
451+
452+
// #10 scroll to selected/applied block
453+
var appliedBlockDom = appliedBlock.getBlockMainDom();
454+
$(VP_CLASS_PREFIX + VP_CLASS_APIBLOCK_BOARD).animate({scrollTop: $(appliedBlockDom).position().top}, "fast");
451455
}
452456
});
453457

0 commit comments

Comments
 (0)