support dragging blocks out from table views

snap7
Jens Mönig 2022-01-23 11:25:04 +01:00
rodzic 58c1d98a58
commit f5c330f404
3 zmienionych plików z 24 dodań i 2 usunięć

Wyświetl plik

@ -12,6 +12,7 @@
### 2022-01-23
* morphic: added Node >> childThatIsA
* tables: support dragging blocks out from table views
### 2022-01-22
* blocks: support dragging blocks out from result bubbles

Wyświetl plik

@ -24,7 +24,7 @@
<script src="src/paint.js?version=2021-07-05"></script>
<script src="src/lists.js?version=2021-12-15"></script>
<script src="src/byob.js?version=2022-01-07"></script>
<script src="src/tables.js?version=2021-05-07"></script>
<script src="src/tables.js?version=2022-01-23"></script>
<script src="src/sketch.js?version=2021-11-03"></script>
<script src="src/video.js?version=2019-06-27"></script>
<script src="src/maps.js?version=2021-06-15"></script>

Wyświetl plik

@ -72,7 +72,7 @@ ListWatcherMorph, BoxMorph, Variable, isSnapObject, useBlurredShadows*/
/*jshint esversion: 6*/
modules.tables = '2021-July-05';
modules.tables = '2022-January-23';
var Table;
var TableCellMorph;
@ -343,6 +343,7 @@ TableCellMorph.prototype.render = function (ctx) {
x,
y;
this.isDraggable = this.data instanceof Context;
ctx.fillStyle = background;
if (this.shouldBeList()) {
BoxMorph.prototype.outlinePath.call(
@ -475,6 +476,26 @@ TableCellMorph.prototype.mouseLeave = function () {
}
};
TableCellMorph.prototype.selectForEdit = function () {
var script = this.data.toBlock(),
prepare = script.prepareToBeGrabbed,
ide = this.parentThatIsA(IDE_Morph) ||
this.world().childThatIsA(IDE_Morph);
script.prepareToBeGrabbed = function (hand) {
prepare.call(this, hand);
hand.grabOrigin = {
origin: ide.palette,
position: ide.palette.center()
};
this.prepareToBeGrabbed = prepare;
};
if (ide.isAppMode) {return; }
script.setPosition(this.position());
return script;
};
// TableMorph //////////////////////////////////////////////////////////
// TableMorph inherits from FrameMorph: