to the latest version
pull/3/merge
jmoenig 2015-06-26 13:04:27 +02:00
rodzic de82d373be
commit 7d1db3dfe9
2 zmienionych plików z 56 dodań i 19 usunięć

Wyświetl plik

@ -828,8 +828,8 @@
// use context to paint stuff here
};
If your new morph stores or references other morphs outside of the
submorph tree in other properties, be sure to also override the
If your new morph stores or references to other morphs outside of
the submorph tree in other properties, be sure to also override the
default
updateReferences()
@ -1048,7 +1048,7 @@
/*global window, HTMLCanvasElement, getMinimumFontHeight, FileReader, Audio,
FileList, getBlurredShadowSupport*/
var morphicVersion = '2015-June-25';
var morphicVersion = '2015-June-26';
var modules = {}; // keep track of additional loaded modules
var useBlurredShadows = getBlurredShadowSupport(); // check for Chrome-bug
@ -2405,10 +2405,13 @@ Morph.prototype.moveBy = function (delta) {
};
Morph.prototype.silentMoveBy = function (delta) {
var children = this.children,
i = children.length;
this.bounds = this.bounds.translateBy(delta);
this.children.forEach(function (child) {
child.silentMoveBy(delta);
});
// ugly optimization avoiding forEach()
for (i; i > 0; i -= 1) {
children[i - 1].silentMoveBy(delta);
}
};
Morph.prototype.setPosition = function (aPoint) {
@ -6502,7 +6505,7 @@ InspectorMorph.prototype.setExtent = function (aPoint) {
this.fixLayout();
};
//InspectorMorph editing ops:
// InspectorMorph editing ops:
InspectorMorph.prototype.save = function () {
var txt = this.detail.contents.children[0].text.toString(),
@ -6592,6 +6595,15 @@ InspectorMorph.prototype.step = function () {
this.fixLayout();
};
// InspectorMorph duplicating:
InspectorMorph.prototype.updateReferences = function (map) {
var active = this.list.activeIndex();
InspectorMorph.uber.updateReferences.call(this, map);
this.buildPanes();
this.list.activateIndex(active);
};
// MenuMorph ///////////////////////////////////////////////////////////
// MenuMorph: referenced constructors
@ -9058,6 +9070,18 @@ ListMorph.prototype.setExtent = function (aPoint) {
ListMorph.uber.setExtent.call(this, aPoint);
};
ListMorph.prototype.activeIndex = function () {
return this.listContents.children.indexOf(this.active);
};
ListMorph.prototype.activateIndex = function (idx) {
var item = this.listContents.children[idx];
if (!item) {return; }
item.image = item.pressImage;
item.changed();
item.trigger();
};
// StringFieldMorph ////////////////////////////////////////////////////
// StringFieldMorph inherit from FrameMorph:

Wyświetl plik

@ -7,9 +7,9 @@
written by Jens Mönig
jens@moenig.org
Copyright (C) 2012 by Jens Mönig
Copyright (C) 2015 by Jens Mönig
this documentation last changed: April 07, 2013
this documentation last changed: June 26, 2015
This file is part of Snap!.
@ -465,9 +465,15 @@
MyMorph.prototype.mouseMove = function(pos) {};
The only optional parameter of such a method is a Point object
All of these methods have as optional parameter a Point object
indicating the current position of the Hand inside the World's
coordinate system.
coordinate system. The
mouseMove(pos, button)
event method has an additional optional parameter indicating the
currently pressed mouse button, which is either 'left' or 'right'.
You can use this to let users interact with 3D environments.
Events may be "bubbled" up a morph's owner chain by calling
@ -522,6 +528,12 @@
a duplicate of the template whose "isDraggable" flag is true and
whose "isTemplate" flag is false, in other words: a non-template.
When creating a copy from a template, the copy's
reactToTemplateCopy
is invoked, if it is present.
Dragging is indicated by adding a drop shadow to the morph in hand.
If a morph follows the hand without displaying a drop shadow it is
merely being moved about without changing its parent (owner morph),
@ -817,13 +829,13 @@
// use context to paint stuff here
};
If your new morph stores or references other morphs outside of the
submorph tree in other properties, be sure to also override the
If your new morph stores or references to other morphs outside of
the submorph tree in other properties, be sure to also override the
default
copyRecordingReferences()
updateReferences()
method accordingly if you want it to support duplication.
method if you want it to support duplication.
(6) development and user modes
@ -1015,16 +1027,17 @@
programming hero.
I have originally written morphic.js in Florian Balmer's Notepad2
editor for Windows and later switched to Apple's Dashcode. I've also
come to depend on both Douglas Crockford's JSLint, Mozilla's Firebug
and Google's Chrome to get it right.
editor for Windows, later switched to Apple's Dashcode and later
still to Apple's Xcode. I've also come to depend on both Douglas
Crockford's JSLint, Mozilla's Firebug and Google's Chrome to get
it right.
IX. contributors
----------------------
Joe Otto found and fixed many early bugs and taught me some tricks.
Nathan Dinsmore contributed mouse wheel scrolling, cached
background texture handling and countless bug fixes.
background texture handling, countless bug fixes and optimizations.
Ian Reynolds contributed backspace key handling for Chrome.
Davide Della Casa contributed performance optimizations for Firefox.