zimjs 17.0.4 → 17.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/package.json +1 -1
- package/src/zim.js +2660 -783
- package/ts-src/typings/zim/index.d.ts +106 -9
package/src/zim.js
CHANGED
|
@@ -9745,6 +9745,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
9745
9745
|
this.setBounds = function(a,b,c,d) {
|
|
9746
9746
|
var n = normalizeBounds(a, b, c, d);
|
|
9747
9747
|
that.cjsContainer_setBounds(n[0],n[1],n[2],n[3]);
|
|
9748
|
+
that.width;
|
|
9748
9749
|
return that;
|
|
9749
9750
|
};
|
|
9750
9751
|
this.getBounds = function(targetSpace) {
|
|
@@ -10197,6 +10198,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
10197
10198
|
this.setBounds = function(a,b,c,d) {
|
|
10198
10199
|
var n = normalizeBounds(a, b, c, d);
|
|
10199
10200
|
this.cjsShape_setBounds(n[0],n[1],n[2],n[3]);
|
|
10201
|
+
this.width;
|
|
10200
10202
|
return this;
|
|
10201
10203
|
};
|
|
10202
10204
|
this.getBounds = function(targetSpace) {
|
|
@@ -10273,9 +10275,10 @@ zim class - extends a createjs.Bitmap
|
|
|
10273
10275
|
|
|
10274
10276
|
DESCRIPTION
|
|
10275
10277
|
Makes a Bitmap object from an image source (image, video or canvas).
|
|
10276
|
-
It is best to
|
|
10277
|
-
|
|
10278
|
-
See the ZIM Frame class and
|
|
10278
|
+
It is best to preload images in the Frame() or with loadAssets() and the path parameter
|
|
10279
|
+
then simply use ZIM Pic() to display the image.
|
|
10280
|
+
See the ZIM Frame class and ZIM Pic in the Docs.
|
|
10281
|
+
But Bitmap() is handy to turn other canvases or any DisplayObject into a picture.
|
|
10279
10282
|
|
|
10280
10283
|
NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
|
|
10281
10284
|
|
|
@@ -10597,6 +10600,7 @@ zim.Bitmap = function(image, width, height, left, top, scale, style, group, inhe
|
|
|
10597
10600
|
this.setBounds = function(a,b,c,d) {
|
|
10598
10601
|
var n = normalizeBounds(a, b, c, d);
|
|
10599
10602
|
that.cjsBitmap_setBounds(n[0],n[1],n[2],n[3]);
|
|
10603
|
+
that.width;
|
|
10600
10604
|
return that;
|
|
10601
10605
|
};
|
|
10602
10606
|
this.getBounds = function(targetSpace) {
|
|
@@ -10786,6 +10790,424 @@ zim.Bitmap.prototype.dispose = function() {return this.doDispose();};
|
|
|
10786
10790
|
zimify(zim.Bitmap.prototype);
|
|
10787
10791
|
//-50.7
|
|
10788
10792
|
|
|
10793
|
+
/*--
|
|
10794
|
+
zim.SlicedBitmap = function(width, height, obj, slices, types, gap, scale, style, group, inherit)
|
|
10795
|
+
|
|
10796
|
+
SlicedBitmap
|
|
10797
|
+
zim class - extends a zim.Bitmap which extends a createjs.Bitmap
|
|
10798
|
+
|
|
10799
|
+
DESCRIPTION
|
|
10800
|
+
Makes an n-sliced bitmap. This is similar to 9-sliced, and can do 9-sliced,
|
|
10801
|
+
but also can have any number of horizontal or vertical slices.
|
|
10802
|
+
The slices make regions that can be fixed in scale, stretched or tiled.
|
|
10803
|
+
This is handy for graphics that have detailed corners or edges that should not be scaled
|
|
10804
|
+
and then areas that can be scaled or tiled when size is changed.
|
|
10805
|
+
The bitmap can then be sized with slicesWidth and slicesHeight rather than width and height
|
|
10806
|
+
to stretch and tile those regions but leave fixed regions fixed in size.
|
|
10807
|
+
|
|
10808
|
+
The ZIM transform() defaults to using slicesWidth and slicesHeight when resizing the edges
|
|
10809
|
+
it will still scale when using the corners. This can be turned off by setting sliceX and sliceY parameters of transform to false.
|
|
10810
|
+
|
|
10811
|
+
Properties for the slice lines are available and can be set and animated as can the scalesWidth and scalesHeight.
|
|
10812
|
+
|
|
10813
|
+
SEE: https://zimjs.com/slices for the ZIM Slices tool and example of SlicedBitmap
|
|
10814
|
+
|
|
10815
|
+
NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
|
|
10816
|
+
|
|
10817
|
+
EXAMPLE
|
|
10818
|
+
// slice a pic in four at 25% from the edges, scale the middle and keep the sides and corners not scaled.
|
|
10819
|
+
new SlicedBitmap(1600, pic.height, pic, [0.25,0.75],[0.25,0.75]], [[0,1,0],[0,1,0])
|
|
10820
|
+
.center()
|
|
10821
|
+
.transform({minScaleX:.05, minScaleY:.05});
|
|
10822
|
+
END EXAMPLE
|
|
10823
|
+
|
|
10824
|
+
EXAMPLE
|
|
10825
|
+
// slice a pic in four at 25% from the edges, scale the middle and keep the sides and corners not scaled.
|
|
10826
|
+
const pic = new Pic("car.png"); // preload this in Frame() or loadAssets()
|
|
10827
|
+
const startSlices = [0.25,0.75],[0.25,0.75]];
|
|
10828
|
+
const startTypes = [[0,2,0],[0,1,0]; // middle is tiled horizontally and stretched vertically
|
|
10829
|
+
const slicer = new Slicer({
|
|
10830
|
+
obj:pic.clone(), // slicer will adjust obj so clone the pic so can use it unaffected later
|
|
10831
|
+
scale:.5,
|
|
10832
|
+
slices:startSlices,
|
|
10833
|
+
types:startTypes,
|
|
10834
|
+
upload:false
|
|
10835
|
+
})
|
|
10836
|
+
.pos(30,50)
|
|
10837
|
+
.change(()=>{preview.exchange = slicer.exchange;); // this will update the picture below
|
|
10838
|
+
|
|
10839
|
+
// this will provide slice type options
|
|
10840
|
+
new SlicerTypes(slicer).pos(30,120,RIGHT,TOP);
|
|
10841
|
+
|
|
10842
|
+
// SlicedBitmaps slicesWidth and slicesHeight do not currently scale from the registration point
|
|
10843
|
+
// here we animate the slicesWidth and use a container to animate from the center
|
|
10844
|
+
const holder = new Container(800,400).center();
|
|
10845
|
+
const preview = new SlicedBitmap(1600, pic.height, pic, slicer.slices, slicer.types, 2, .5)
|
|
10846
|
+
.center(holder)
|
|
10847
|
+
.animate({
|
|
10848
|
+
props:{slicesWidth:980},
|
|
10849
|
+
// props:{sH0:.31}, // alternatively, animate the first horizontal slice (vertical line)
|
|
10850
|
+
time:2,
|
|
10851
|
+
ease:"elasticInOut",
|
|
10852
|
+
rewind:true,
|
|
10853
|
+
rewindWait:1,
|
|
10854
|
+
loop:true,
|
|
10855
|
+
loopWait:1,
|
|
10856
|
+
animateCall:()=>{preview.center(holder)} // always recenter the SlicedBitmap in the container
|
|
10857
|
+
});
|
|
10858
|
+
END EXAMPLE
|
|
10859
|
+
|
|
10860
|
+
PARAMETERS
|
|
10861
|
+
** supports DUO - parameters or single object with properties below
|
|
10862
|
+
** supports OCT - parameter defaults can be set with STYLE control (like CSS)
|
|
10863
|
+
width - (default null) the width of the object - this will apply slices and types settings to keep fixed, scale or tile regions
|
|
10864
|
+
height - (default null) the height of the object - this will apply slices and types settings to keep fixed, scale or tile regions
|
|
10865
|
+
obj - (default null) a DisplayObject such as a ZIM Pic, Container, etc. or an HTML image or canvas
|
|
10866
|
+
slices - (default null) an array of horizontal and vertical arrays holding slice percentage
|
|
10867
|
+
[[.25,.75], [.1,.4,.5,.9]]
|
|
10868
|
+
three horizontal regions made from two vertical lines placed at 1/4 and 3/4 the width
|
|
10869
|
+
five vertical regions made from four horizontal lines with 1/10 the picture at left, middle and right
|
|
10870
|
+
types - (default null) an array of horizontal and vertical arrays holding slice types
|
|
10871
|
+
0 - fix - keeps the original width and height of the region. Usually, good for corners.
|
|
10872
|
+
1 - stretch - stretch the region to fill space as an object is stretched
|
|
10873
|
+
2 - tile - tile the region at original scale - currently, will match the first side and sometimes the second side
|
|
10874
|
+
gap - (default 2) pixels to overlap on each side to avoid canvas ditthered edges
|
|
10875
|
+
scale - (default 1) a scale for the caching
|
|
10876
|
+
style - (default true) set to false to ignore styles set with the STYLE - will receive original parameter defaults
|
|
10877
|
+
group - (default null) set to String (or comma delimited String) so STYLE can set default styles to the group(s) (like a CSS class)
|
|
10878
|
+
inherit - (default null) used internally but can receive an {} of styles directly
|
|
10879
|
+
|
|
10880
|
+
METHODS
|
|
10881
|
+
slicesSca() - like sca() but will call sclicesScaleX and slicesScaleY to operate on regions
|
|
10882
|
+
hasProp(property as String) - returns true if property exists on object else returns false
|
|
10883
|
+
clone() - makes a copy with properties such as x, y, etc. also copied - also copies file and src properties
|
|
10884
|
+
dispose() - removes from parent, removes event listeners - must still set outside references to null for garbage collection
|
|
10885
|
+
if this is a cloned bitmap then the original asset("image.png") will still exist unless it is disposed.
|
|
10886
|
+
|
|
10887
|
+
ALSO: ZIM 4TH adds all the methods listed under Container (see above), such as:
|
|
10888
|
+
drag(), hitTestRect(), animate(), sca(), reg(), mov(), center(), centerReg(),
|
|
10889
|
+
addTo(), removeFrom(), loop(), outline(), place(), pos(), alp(), rot(), setMask(), etc.
|
|
10890
|
+
ALSO: see the ZIM Bitmap methods, such as:
|
|
10891
|
+
keyOut(), cache(), getColorAt(), etc.
|
|
10892
|
+
ALSO: see the CreateJS Easel Docs for Bitmap methods, such as:
|
|
10893
|
+
on(), off(), dispatchEvent(), etc.
|
|
10894
|
+
|
|
10895
|
+
PROPERTIES
|
|
10896
|
+
type - holds the class name as a String
|
|
10897
|
+
slices - get or set slices - see slices parameter and sH, sV properties
|
|
10898
|
+
types - get or set types - see types parameter and tH, tV properties
|
|
10899
|
+
gap - get or set the gap 0 see gap parameter
|
|
10900
|
+
slicesWidth - set the width so slices operate - different than width which will scale in general, not operating the slices
|
|
10901
|
+
slicesHeight - set the height so slices operate - different than height which will scale in general, not operating the slices
|
|
10902
|
+
slicesSale - set the scale so the slices operate - different than scale which will scale in general, not operating the slices
|
|
10903
|
+
slicesScaleX - set the scaleX so the slices operate - different than scaleX which will scale in general, not operating the slices
|
|
10904
|
+
slicesScaleY - set the scaleY so the slices operate - different than scaleY which will scale in general, not operating the slices
|
|
10905
|
+
exchange - set the [slices, types] in one array - used to recieve data from the ZIM Slicer
|
|
10906
|
+
sH - set an individual horizontal slice percent - these are sH0, sH1, sH2, etc. and are properties that can be animated and wiggled as well
|
|
10907
|
+
sV - set an individual vertical slice percent - these are sH0, sH1, sH2, etc. and are properties that can be animated and wiggled as well
|
|
10908
|
+
tH - set an individual horizontal slice type - also see types parameter
|
|
10909
|
+
tV - set an individual vertical slice type - also see types parameter
|
|
10910
|
+
|
|
10911
|
+
ALSO: see ZIM Docs for Bitmap properties, such as:
|
|
10912
|
+
width, height, widthOnly, heightOnly, draggable, level, blendMode, etc.
|
|
10913
|
+
ALSO: see the CreateJS Easel Docs for Bitmap properties, such as:
|
|
10914
|
+
x, y, rotation, scaleX, scaleY, regX, regY, skewX, skewY,
|
|
10915
|
+
alpha, cursor, shadow, mouseEnabled, etc.
|
|
10916
|
+
|
|
10917
|
+
EVENTS
|
|
10918
|
+
See the CreateJS Easel Docs for Bitmap events, such as:
|
|
10919
|
+
added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmove, pressup, removed, rollout, rollover
|
|
10920
|
+
--*///+50.7
|
|
10921
|
+
zim.SlicedBitmap = function(width, height, obj, slices, types, gap, scale, style, group, inherit) {
|
|
10922
|
+
var sig = "width, height, obj, slices, types, gap, scale, style, group, inherit";
|
|
10923
|
+
var duo; if (duo = zob(zim.SlicedBitmap, arguments, sig, this)) return duo;
|
|
10924
|
+
z_d("50.75");
|
|
10925
|
+
|
|
10926
|
+
this.group = group;
|
|
10927
|
+
var DS = style===false?{}:zim.getStyle("SlicedBitmap", this.group, inherit);
|
|
10928
|
+
|
|
10929
|
+
var objCanvas;
|
|
10930
|
+
var message = "ZIM SlicedBitmap needs DisplayObject";
|
|
10931
|
+
if (zot(obj)) obj = DS.obj!=null?DS.obj:null;
|
|
10932
|
+
if (!obj.getBounds) {zogy(message); return;}
|
|
10933
|
+
var b = obj.getBounds();
|
|
10934
|
+
var w = b.width;
|
|
10935
|
+
var h = b.height;
|
|
10936
|
+
if (zot(width)) width = DS.width!=null?DS.width:500;
|
|
10937
|
+
if (zot(height)) height = DS.height!=null?DS.height:500;
|
|
10938
|
+
if (!obj.cacheCanvas) {
|
|
10939
|
+
if (obj.cache) {
|
|
10940
|
+
obj.cache(b.x,b.y,w,h);
|
|
10941
|
+
objCanvas = obj.cacheCanvas;
|
|
10942
|
+
}
|
|
10943
|
+
else {zogy(message); return;}
|
|
10944
|
+
} else {
|
|
10945
|
+
objCanvas = obj.cacheCanvas;
|
|
10946
|
+
}
|
|
10947
|
+
if (zot(slices)) slices = DS.slices!=null?DS.slices:[[],[]];
|
|
10948
|
+
var defaults = [[1],[1]];
|
|
10949
|
+
zim.loop(slices,function(s,i) {
|
|
10950
|
+
zim.loop(s,function() {
|
|
10951
|
+
defaults[i].push(1);
|
|
10952
|
+
});
|
|
10953
|
+
});
|
|
10954
|
+
if (zot(types)) types = DS.types!=null?DS.types:defaults;
|
|
10955
|
+
if (zot(scale)) scale = DS.scale!=null?DS.scale:1;
|
|
10956
|
+
|
|
10957
|
+
// convert to createjs pixels rather than percent
|
|
10958
|
+
var slicesSend = zim.copy(slices);
|
|
10959
|
+
zim.loop(slicesSend[0], function(s,i) {
|
|
10960
|
+
slicesSend[0][i] = s*w;
|
|
10961
|
+
});
|
|
10962
|
+
zim.loop(slicesSend[1], function(s,i) {
|
|
10963
|
+
slicesSend[1][i] = s*h;
|
|
10964
|
+
});
|
|
10965
|
+
var sb = this.scaleBitmap = new createjs.ScaleBitmap(objCanvas, slicesSend, types, gap);
|
|
10966
|
+
slicesSend = null;
|
|
10967
|
+
sb.setDrawSize(width,height);
|
|
10968
|
+
sb.cache(0,0,width,height,scale);
|
|
10969
|
+
|
|
10970
|
+
|
|
10971
|
+
this.zimBitmap_constructor(sb.cacheCanvas);
|
|
10972
|
+
this.type = "SlicedBitmap";
|
|
10973
|
+
var that = this;
|
|
10974
|
+
|
|
10975
|
+
// METHODS
|
|
10976
|
+
|
|
10977
|
+
that.slicesSca = function(scale, scaleY) {
|
|
10978
|
+
if (zot(scale)) scale = that.slicesScaleX;
|
|
10979
|
+
if (zot(scaleY)) scaleY = scale;
|
|
10980
|
+
obj.slicesScaleX = scale; obj.slicesScaleY = scaleY;
|
|
10981
|
+
return that;
|
|
10982
|
+
};
|
|
10983
|
+
|
|
10984
|
+
// PROPERTIES
|
|
10985
|
+
|
|
10986
|
+
Object.defineProperty(that, 'slicesWidth', {
|
|
10987
|
+
get: function() {
|
|
10988
|
+
return width;
|
|
10989
|
+
},
|
|
10990
|
+
set: function(value) {
|
|
10991
|
+
width = value;
|
|
10992
|
+
sb.setDrawSize(width, height);
|
|
10993
|
+
sb.cache(0,0,width,height,scale);
|
|
10994
|
+
that.sourceRect = new createjs.Rectangle(0,0,width*scale,height*scale);
|
|
10995
|
+
that.setBounds(null);
|
|
10996
|
+
if (that.transformControls) that.transformControls.resize();
|
|
10997
|
+
}
|
|
10998
|
+
});
|
|
10999
|
+
Object.defineProperty(that, 'ssW', { // no transformControls resize as was feeding back from transform
|
|
11000
|
+
get: function() {
|
|
11001
|
+
return width;
|
|
11002
|
+
},
|
|
11003
|
+
set: function(value) {
|
|
11004
|
+
width = value;
|
|
11005
|
+
sb.setDrawSize(width, height);
|
|
11006
|
+
sb.cache(0,0,width,height,scale);
|
|
11007
|
+
that.sourceRect = new createjs.Rectangle(0,0,width*scale,height*scale);
|
|
11008
|
+
that.setBounds(null);
|
|
11009
|
+
}
|
|
11010
|
+
});
|
|
11011
|
+
|
|
11012
|
+
Object.defineProperty(that, 'slicesHeight', {
|
|
11013
|
+
get: function() {
|
|
11014
|
+
return height;
|
|
11015
|
+
},
|
|
11016
|
+
set: function(value) {
|
|
11017
|
+
height = value;
|
|
11018
|
+
sb.setDrawSize(width, height);
|
|
11019
|
+
sb.cache(0,0,width,height,scale);
|
|
11020
|
+
that.sourceRect = new createjs.Rectangle(0,0,width*scale,height*scale);
|
|
11021
|
+
that.setBounds(null);
|
|
11022
|
+
if (that.transformControls) that.transformControls.resize();
|
|
11023
|
+
}
|
|
11024
|
+
});
|
|
11025
|
+
Object.defineProperty(that, 'ssH', { // no transformControls resize as was feeding back from transform
|
|
11026
|
+
get: function() {
|
|
11027
|
+
return height;
|
|
11028
|
+
},
|
|
11029
|
+
set: function(value) {
|
|
11030
|
+
height = value;
|
|
11031
|
+
sb.setDrawSize(width, height);
|
|
11032
|
+
sb.cache(0,0,width,height,scale);
|
|
11033
|
+
that.sourceRect = new createjs.Rectangle(0,0,width*scale,height*scale);
|
|
11034
|
+
that.setBounds(null);
|
|
11035
|
+
}
|
|
11036
|
+
});
|
|
11037
|
+
|
|
11038
|
+
var originalWidth = width;
|
|
11039
|
+
Object.defineProperty(that, 'slicesScaleX', {
|
|
11040
|
+
get: function() {
|
|
11041
|
+
return width/originalWidth;
|
|
11042
|
+
},
|
|
11043
|
+
set: function(value) {
|
|
11044
|
+
that.slicesWidth = value?originalWidth*value:0;
|
|
11045
|
+
}
|
|
11046
|
+
});
|
|
11047
|
+
Object.defineProperty(that, 'ssX', { // no transformControls resize as was feeding back from transform
|
|
11048
|
+
get: function() {
|
|
11049
|
+
return width/originalWidth;
|
|
11050
|
+
},
|
|
11051
|
+
set: function(value) {
|
|
11052
|
+
that.ssW = value?originalWidth*value:0;
|
|
11053
|
+
}
|
|
11054
|
+
});
|
|
11055
|
+
|
|
11056
|
+
var originalHeight = height;
|
|
11057
|
+
Object.defineProperty(that, 'slicesScaleY', {
|
|
11058
|
+
get: function() {
|
|
11059
|
+
return height/originalHeight;
|
|
11060
|
+
},
|
|
11061
|
+
set: function(value) {
|
|
11062
|
+
that.slicesHeight = value?originalHeight*value:0;
|
|
11063
|
+
}
|
|
11064
|
+
});
|
|
11065
|
+
Object.defineProperty(that, 'ssY', { // no transformControls resize as was feeding back from transform
|
|
11066
|
+
get: function() {
|
|
11067
|
+
return height/originalHeight;
|
|
11068
|
+
},
|
|
11069
|
+
set: function(value) {
|
|
11070
|
+
that.ssH = value?originalHeight*value:0;
|
|
11071
|
+
}
|
|
11072
|
+
});
|
|
11073
|
+
|
|
11074
|
+
Object.defineProperty(that, 'slicesScale', {
|
|
11075
|
+
get: function() {
|
|
11076
|
+
return width/originalWidth;
|
|
11077
|
+
},
|
|
11078
|
+
set: function(value) {
|
|
11079
|
+
that.slicesWidth = value?originalWidth*value:0;
|
|
11080
|
+
that.slicesHeight = value?originalHeight*value:0;
|
|
11081
|
+
}
|
|
11082
|
+
});
|
|
11083
|
+
|
|
11084
|
+
|
|
11085
|
+
Object.defineProperty(that, 'slices', {
|
|
11086
|
+
get: function() {
|
|
11087
|
+
return slices;
|
|
11088
|
+
},
|
|
11089
|
+
set: function(value) {
|
|
11090
|
+
if (zot(value) || !Array.isArray(value)) value = [[],[]];
|
|
11091
|
+
slices = value;
|
|
11092
|
+
var b = obj.getBounds();
|
|
11093
|
+
var w = b.width;
|
|
11094
|
+
var h = b.height;
|
|
11095
|
+
var slicesSend = zim.copy(slices);
|
|
11096
|
+
zim.loop(slicesSend[0], function(s,i) {
|
|
11097
|
+
slicesSend[0][i] = s*w;
|
|
11098
|
+
});
|
|
11099
|
+
zim.loop(slicesSend[1], function(s,i) {
|
|
11100
|
+
slicesSend[1][i] = s*h;
|
|
11101
|
+
});
|
|
11102
|
+
sb.slices = slicesSend;
|
|
11103
|
+
slicesSend = null;
|
|
11104
|
+
sb.updateCache();
|
|
11105
|
+
}
|
|
11106
|
+
});
|
|
11107
|
+
|
|
11108
|
+
Object.defineProperty(that, 'types', {
|
|
11109
|
+
get: function() {
|
|
11110
|
+
return types;
|
|
11111
|
+
},
|
|
11112
|
+
set: function(value) {
|
|
11113
|
+
if (zot(value) || !Array.isArray(value)) {
|
|
11114
|
+
var defaults = [[1],[1]];
|
|
11115
|
+
zim.loop(slices,function(s,i) {
|
|
11116
|
+
zim.loop(s,function() {
|
|
11117
|
+
defaults[i].push(1);
|
|
11118
|
+
});
|
|
11119
|
+
});
|
|
11120
|
+
value = defaults;
|
|
11121
|
+
}
|
|
11122
|
+
sb.types = types = value;
|
|
11123
|
+
sb.updateCache();
|
|
11124
|
+
}
|
|
11125
|
+
});
|
|
11126
|
+
|
|
11127
|
+
Object.defineProperty(that, 'gap', {
|
|
11128
|
+
get: function() {
|
|
11129
|
+
return gap;
|
|
11130
|
+
},
|
|
11131
|
+
set: function(value) {
|
|
11132
|
+
sb.gap = gap = value;
|
|
11133
|
+
}
|
|
11134
|
+
});
|
|
11135
|
+
|
|
11136
|
+
Object.defineProperty(that, 'exchange', {
|
|
11137
|
+
get: function() {
|
|
11138
|
+
return [slices, types];
|
|
11139
|
+
},
|
|
11140
|
+
set: function(value) {
|
|
11141
|
+
var b = obj.getBounds();
|
|
11142
|
+
var w = b.width;
|
|
11143
|
+
var h = b.height;
|
|
11144
|
+
slices = value[0];
|
|
11145
|
+
var slicesSend = zim.copy(slices);
|
|
11146
|
+
zim.loop(slicesSend[0], function(s,i) {
|
|
11147
|
+
slicesSend[0][i] = s*w;
|
|
11148
|
+
});
|
|
11149
|
+
zim.loop(slicesSend[1], function(s,i) {
|
|
11150
|
+
slicesSend[1][i] = s*h;
|
|
11151
|
+
});
|
|
11152
|
+
sb.slices = slicesSend;
|
|
11153
|
+
slicesSend = null;
|
|
11154
|
+
sb.types = types = value[1];
|
|
11155
|
+
sb.updateCache();
|
|
11156
|
+
}
|
|
11157
|
+
});
|
|
11158
|
+
|
|
11159
|
+
zim.loop(20, function(i) {
|
|
11160
|
+
Object.defineProperty(that, 'sH'+i, {
|
|
11161
|
+
get: function() {
|
|
11162
|
+
return slices[0][i];
|
|
11163
|
+
},
|
|
11164
|
+
set: function(value) {
|
|
11165
|
+
slices[0][i] = value;
|
|
11166
|
+
that.slices = slices;
|
|
11167
|
+
}
|
|
11168
|
+
});
|
|
11169
|
+
});
|
|
11170
|
+
|
|
11171
|
+
zim.loop(20, function(i) {
|
|
11172
|
+
Object.defineProperty(that, 'sV'+i, {
|
|
11173
|
+
get: function() {
|
|
11174
|
+
return slices[1][i];
|
|
11175
|
+
},
|
|
11176
|
+
set: function(value) {
|
|
11177
|
+
slices[1][i] = value;
|
|
11178
|
+
that.slices = slices;
|
|
11179
|
+
}
|
|
11180
|
+
});
|
|
11181
|
+
});
|
|
11182
|
+
|
|
11183
|
+
zim.loop(20, function(i) {
|
|
11184
|
+
Object.defineProperty(that, 'tH'+i, {
|
|
11185
|
+
get: function() {
|
|
11186
|
+
return types[0][i];
|
|
11187
|
+
},
|
|
11188
|
+
set: function(value) {
|
|
11189
|
+
types[0][i] = value;
|
|
11190
|
+
that.types = types;
|
|
11191
|
+
}
|
|
11192
|
+
});
|
|
11193
|
+
});
|
|
11194
|
+
|
|
11195
|
+
zim.loop(20, function(i) {
|
|
11196
|
+
Object.defineProperty(that, 'tV'+i, {
|
|
11197
|
+
get: function() {
|
|
11198
|
+
return types[1][i];
|
|
11199
|
+
},
|
|
11200
|
+
set: function(value) {
|
|
11201
|
+
types[1][i] = value;
|
|
11202
|
+
that.types = types;
|
|
11203
|
+
}
|
|
11204
|
+
});
|
|
11205
|
+
});
|
|
11206
|
+
|
|
11207
|
+
}
|
|
11208
|
+
zim.extend(zim.SlicedBitmap, zim.Bitmap, null, "zimBitmap", false);
|
|
11209
|
+
//-50.75
|
|
11210
|
+
|
|
10789
11211
|
/*--
|
|
10790
11212
|
zim.Sprite = function(image, cols, rows, count, offsetX, offsetY, spacingX, spacingY, width, height, animations, json, id, globalControl, spriteSheet, label, frame, style, group, inherit)
|
|
10791
11213
|
|
|
@@ -10958,7 +11380,7 @@ group - (default null) set to String (or comma delimited String) so STYLE can se
|
|
|
10958
11380
|
inherit - (default null) used internally but can receive an {} of styles directly
|
|
10959
11381
|
|
|
10960
11382
|
METHODS
|
|
10961
|
-
run(time, label, call, params, wait, waitedCall, waitedParams, loop, loopCount, loopWait, loopCall, loopParams, loopWaitCall, loopWaitParams, loopPick, rewind, rewindWait, rewindCall, rewindParams, rewindWaitCall, rewindWaitParams, rewindTime, rewindEase, startFrame, endFrame, tweek, id, globalControl)
|
|
11383
|
+
run(time, label, call, params, wait, waitedCall, waitedParams, loop, loopCount, loopWait, loopCall, loopParams, loopWaitCall, loopWaitParams, loopPick, rewind, rewindWait, rewindCall, rewindParams, rewindWaitCall, rewindWaitParams, rewindTime, rewindEase, startFrame, endFrame, frame, tweek, id, globalControl)
|
|
10962
11384
|
The run() method animates the Sprite over an amount of time
|
|
10963
11385
|
Would recommend this method over the CreateJS play() and gotoAndPlay()
|
|
10964
11386
|
methods because the framerate for these get overwritten by other S.update() calls
|
|
@@ -10998,6 +11420,8 @@ run(time, label, call, params, wait, waitedCall, waitedParams, loop, loopCount,
|
|
|
10998
11420
|
note - this goes backwards - so "bounceOut" would happen at the end of the rewind
|
|
10999
11421
|
startFrame - (default null - or 0) the frame to start on - will be overridden by a label with frames
|
|
11000
11422
|
endFrame - (default null - or totalFrames) the frame to end on - will be overridden by a label with frames
|
|
11423
|
+
frame - (default null) set the single frame to run - will override startFrame and endFrame
|
|
11424
|
+
this is good for a TextureAtlas where you show one frame of the sprite as a picture
|
|
11001
11425
|
tweek - (default 1) a factor for extra time on rewind and loops if needed
|
|
11002
11426
|
id - (default randomly assigned) an id you can use in other animations - available as sprite.id
|
|
11003
11427
|
use this id in other animations for pauseRun and stopRun to act on these as well
|
|
@@ -11281,8 +11705,8 @@ animationend, change, added, click, dblclick, mousedown, mouseout, mouseover, pr
|
|
|
11281
11705
|
return framesNormalized;
|
|
11282
11706
|
};
|
|
11283
11707
|
|
|
11284
|
-
this.run = function(time, label, call, params, wait, waitedCall, waitedParams, loop, loopCount, loopWait, loopCall, loopParams, loopWaitCall, loopWaitParams, loopPick, rewind, rewindWait, rewindCall, rewindParams, rewindWaitCall, rewindWaitParams, rewindTime, rewindEase, startFrame, endFrame, tweek, id, globalControl, pauseOnBlur) {
|
|
11285
|
-
var sig = "time, label, call, params, wait, waitedCall, waitedParams, loop, loopCount, loopWait, loopCall, loopParams, loopWaitCall, loopWaitParams, loopPick, rewind, rewindWait, rewindCall, rewindParams, rewindWaitCall, rewindWaitParams, rewindTime, rewindEase, startFrame, endFrame, tweek, id, globalControl, pauseOnBlur";
|
|
11708
|
+
this.run = function(time, label, call, params, wait, waitedCall, waitedParams, loop, loopCount, loopWait, loopCall, loopParams, loopWaitCall, loopWaitParams, loopPick, rewind, rewindWait, rewindCall, rewindParams, rewindWaitCall, rewindWaitParams, rewindTime, rewindEase, startFrame, endFrame, frame, tweek, id, globalControl, pauseOnBlur) {
|
|
11709
|
+
var sig = "time, label, call, params, wait, waitedCall, waitedParams, loop, loopCount, loopWait, loopCall, loopParams, loopWaitCall, loopWaitParams, loopPick, rewind, rewindWait, rewindCall, rewindParams, rewindWaitCall, rewindWaitParams, rewindTime, rewindEase, startFrame, endFrame, frame, tweek, id, globalControl, pauseOnBlur";
|
|
11286
11710
|
var duo; if (duo = zob(that.run, arguments, sig)) return duo;
|
|
11287
11711
|
|
|
11288
11712
|
var timeType = getTIME();
|
|
@@ -11291,6 +11715,7 @@ animationend, change, added, click, dblclick, mousedown, mouseout, mouseover, pr
|
|
|
11291
11715
|
if (zot(tweek)) tweek = 1;
|
|
11292
11716
|
if (!zot(id)) that.id = id;
|
|
11293
11717
|
if (!zot(globalControl)) that.globalControl = globalControl;
|
|
11718
|
+
if (!zot(frame)) startFrame = endFrame = frame;
|
|
11294
11719
|
|
|
11295
11720
|
var extraTime;
|
|
11296
11721
|
if (Array.isArray(label)) {
|
|
@@ -11513,6 +11938,7 @@ animationend, change, added, click, dblclick, mousedown, mouseout, mouseover, pr
|
|
|
11513
11938
|
this.setBounds = function(a,b,c,d) {
|
|
11514
11939
|
var n = normalizeBounds(a, b, c, d);
|
|
11515
11940
|
that.cjsSprite_setBounds(n[0],n[1],n[2],n[3]);
|
|
11941
|
+
that.width;
|
|
11516
11942
|
return that;
|
|
11517
11943
|
};
|
|
11518
11944
|
this.getBounds = function(targetSpace) {
|
|
@@ -11700,6 +12126,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
11700
12126
|
this.setBounds = function(a,b,c,d) {
|
|
11701
12127
|
var n = normalizeBounds(a, b, c, d);
|
|
11702
12128
|
that.cjsMovieClip_setBounds(n[0],n[1],n[2],n[3]);
|
|
12129
|
+
that.width;
|
|
11703
12130
|
return that;
|
|
11704
12131
|
};
|
|
11705
12132
|
this.getBounds = function(targetSpace) {
|
|
@@ -23080,8 +23507,7 @@ addChild(), removeChild(), addChildAt(), getChildAt(), contains(), removeAllChil
|
|
|
23080
23507
|
|
|
23081
23508
|
PROPERTIES
|
|
23082
23509
|
type - the name of the class as a String
|
|
23083
|
-
text - get
|
|
23084
|
-
See: https://zimjs.com/zapp/Z_VSR9X for updating text
|
|
23510
|
+
text - get or set the text
|
|
23085
23511
|
labels - an array of ZIM Label objects for the letters
|
|
23086
23512
|
numLetters - how many letters (same as numChildren)
|
|
23087
23513
|
|
|
@@ -23123,391 +23549,449 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
23123
23549
|
this.type = "LabelLetters";
|
|
23124
23550
|
|
|
23125
23551
|
var that = this;
|
|
23126
|
-
var letterData = that.letterData = [];
|
|
23127
|
-
var original, data;
|
|
23128
|
-
if (label.type != "Label") {
|
|
23129
|
-
data = parseHTML(label); // returns {text:text, data:data}
|
|
23130
|
-
letterData = data.data;
|
|
23131
|
-
label = new zim.Label(data.text);
|
|
23132
|
-
} else {
|
|
23133
|
-
data = parseHTML(label.text);
|
|
23134
|
-
letterData = data.data;
|
|
23135
|
-
label.text = data.text;
|
|
23136
|
-
}
|
|
23137
|
-
that.text = data.original;
|
|
23138
|
-
that._color = label.color;
|
|
23139
|
-
|
|
23140
|
-
// handle DIR effect
|
|
23141
|
-
if ((WW.DIR && WW.DIR=="rtl") || (!WW.DIR && zim.DIR=="rtl")) {
|
|
23142
|
-
if (lineAlign=="start") lineAlign="right";
|
|
23143
|
-
else if (lineAlign=="end") lineAlign="left";
|
|
23144
|
-
} else {
|
|
23145
|
-
if (lineAlign=="start") lineAlign="left";
|
|
23146
|
-
else if (lineAlign=="end") lineAlign="right";
|
|
23147
|
-
}
|
|
23148
|
-
|
|
23149
|
-
function parseHTML(html) {
|
|
23150
|
-
var data = [];
|
|
23151
|
-
|
|
23152
|
-
// var example = "LabelLetters()<br><br><font group=heading backgroundColor=yellow rollBackgroundColor=green><a href=https://zimjs.com target=_blank>Example</a></font>: <b>strong</b> <i>emphasis</i> <u>underline</u><br><font color=red size=50 family=verdana><strong>big</strong> red verdana</font><br>the next line"
|
|
23153
|
-
// "LabelLetters()Example: strong emphasis underlinebig red verdanathe next line"
|
|
23154
|
-
// "01234567890123456789012345678901234567890123456789012345678901234567890120123456789012"
|
|
23155
|
-
// "0 1 2 3 4 5 6 7"
|
|
23156
|
-
// html = "!Roger הגיע בשבילך משהו בדואר Dan אני לומד עברית";
|
|
23157
|
-
// html = "הגיע בשבילך משהו בדואר.";
|
|
23158
|
-
|
|
23159
|
-
function insert(data) {
|
|
23160
|
-
return data.split("").reverse().join("")
|
|
23161
|
-
}
|
|
23162
|
-
if (rtl) {
|
|
23163
|
-
count = -1;
|
|
23164
|
-
html = html.replace(/[\u0591-\u07FF]+/ig, insert);
|
|
23165
|
-
|
|
23166
|
-
// and there may be tags or LTR characters next to RTL without a space:
|
|
23167
|
-
html = html.replace(/([^\u0591-\u07FF ])([\u0591-\u07FF])/ig, "$1-!!-$2"); // note the not space
|
|
23168
|
-
html = html.replace(/([\u0591-\u07FF])([^\u0591-\u07FF ])/ig, "$1-!!-$2"); // note the not space
|
|
23169
|
-
html = html.replace(/([^\u0591-\u07FF]) ([\u0591-\u07FF])/ig, "$1-!!- -!!-$2");
|
|
23170
|
-
html = html.replace(/([\u0591-\u07FF]) ([^\u0591-\u07FF])/ig, "$1-!!- -!!-$2");
|
|
23171
|
-
|
|
23172
|
-
var sp = html.split(/-!!-/g);
|
|
23173
|
-
zim.loop(sp, function(ssp, i){
|
|
23174
|
-
if (ssp.match(/[\u0591-\u07FF]/i)) {
|
|
23175
|
-
sp[i] = ssp.split(" ").reverse().join(" ");
|
|
23176
|
-
}
|
|
23177
|
-
});
|
|
23178
|
-
html = sp.join("");
|
|
23179
|
-
}
|
|
23180
|
-
|
|
23181
23552
|
|
|
23182
|
-
|
|
23183
|
-
|
|
23184
|
-
|
|
23185
|
-
|
|
23186
|
-
|
|
23187
|
-
|
|
23188
|
-
|
|
23189
|
-
|
|
23190
|
-
|
|
23191
|
-
|
|
23192
|
-
|
|
23193
|
-
|
|
23194
|
-
|
|
23195
|
-
|
|
23196
|
-
|
|
23197
|
-
|
|
23198
|
-
|
|
23199
|
-
|
|
23200
|
-
var regs = [
|
|
23201
|
-
/<(a|i|u|f|br|\/a|\/i|\/u|\/f|\/b)[^>]*>/g,
|
|
23202
|
-
/<(a|i|u|f|br|\/a|\/i|\/u|\/f|b)[^>]*>/g,
|
|
23203
|
-
/<(b|i|u|f|br|\/b|\/i|\/u|\/f|\/a)[^>]*>/g,
|
|
23204
|
-
/<(b|i|u|f|br|\/b|\/i|\/u|\/f|a)[^>]*>/g,
|
|
23205
|
-
/<(b|a|u|f|br|\/b|\/a|\/u|\/f|\/i)[^>]*>/g,
|
|
23206
|
-
/<(b|a|u|f|br|\/b|\/a|\/u|\/f|i)[^>]*>/g,
|
|
23207
|
-
/<(b|a|i|f|br|\/b|\/a|\/i|\/f|\/u)[^>]*>/g,
|
|
23208
|
-
/<(b|a|i|f|br|\/b|\/a|\/i|\/f|u)[^>]*>/g,
|
|
23209
|
-
/<(b|a|i|u|br|\/b|\/a|\/i|\/u|\/f)[^>]*>/g,
|
|
23210
|
-
/<(b|a|i|u|br|\/b|\/a|\/i|\/u|f)[^>]*>/g
|
|
23211
|
-
];
|
|
23212
|
-
var types = ["b","a","i","u","font"];
|
|
23213
|
-
var p;
|
|
23214
|
-
zim.loop(types, function(type, i) {
|
|
23215
|
-
p = html.replace(regs[i*2],"");
|
|
23216
|
-
var arr;
|
|
23217
|
-
if (type=="font") {
|
|
23218
|
-
arr = p.split("<font ");
|
|
23219
|
-
} else if (type=="a") {
|
|
23220
|
-
arr = p.split("<a ");
|
|
23221
|
-
} else {
|
|
23222
|
-
arr = p.split("<"+type+">");
|
|
23223
|
-
}
|
|
23224
|
-
process(arr, type, 0); // 0 for add
|
|
23225
|
-
|
|
23226
|
-
p = html.replace(regs[i*2+1],"");
|
|
23227
|
-
arr = p.split("</"+type+">");
|
|
23228
|
-
process(arr, type, 1); // 1 for remove
|
|
23229
|
-
});
|
|
23230
|
-
|
|
23553
|
+
function make() {
|
|
23554
|
+
|
|
23555
|
+
that.disposeAllChildren();
|
|
23556
|
+
|
|
23557
|
+
var letterData = that.letterData = [];
|
|
23558
|
+
var original, data;
|
|
23559
|
+
if (label.type != "Label") {
|
|
23560
|
+
data = parseHTML(label); // returns {text:text, data:data}
|
|
23561
|
+
letterData = data.data;
|
|
23562
|
+
label = new zim.Label(data.text);
|
|
23563
|
+
} else {
|
|
23564
|
+
data = parseHTML(label.text);
|
|
23565
|
+
letterData = data.data;
|
|
23566
|
+
label.text = data.text;
|
|
23567
|
+
}
|
|
23568
|
+
that._text = data.original;
|
|
23569
|
+
that._color = label.color;
|
|
23231
23570
|
|
|
23232
|
-
|
|
23233
|
-
|
|
23234
|
-
|
|
23235
|
-
|
|
23236
|
-
|
|
23237
|
-
|
|
23571
|
+
// handle DIR effect
|
|
23572
|
+
if ((WW.DIR && WW.DIR=="rtl") || (!WW.DIR && zim.DIR=="rtl")) {
|
|
23573
|
+
if (lineAlign=="start") lineAlign="right";
|
|
23574
|
+
else if (lineAlign=="end") lineAlign="left";
|
|
23575
|
+
} else {
|
|
23576
|
+
if (lineAlign=="start") lineAlign="left";
|
|
23577
|
+
else if (lineAlign=="end") lineAlign="right";
|
|
23578
|
+
}
|
|
23238
23579
|
|
|
23239
|
-
function
|
|
23240
|
-
|
|
23241
|
-
if ((type=="font" || type=="a") && action==0) {
|
|
23242
|
-
var length = text[0].length;
|
|
23243
|
-
zim.loop(text, function(s, i) {
|
|
23244
|
-
|
|
23245
|
-
if (i==0) return;
|
|
23246
|
-
var d = data[length];
|
|
23247
|
-
if (!d) data[length] = [];
|
|
23248
|
-
d = data[length] ;
|
|
23249
|
-
|
|
23250
|
-
var arr = s.split(">");
|
|
23580
|
+
function parseHTML(html) {
|
|
23581
|
+
var data = [];
|
|
23251
23582
|
|
|
23252
|
-
|
|
23253
|
-
|
|
23583
|
+
// var example = "LabelLetters()<br><br><font group=heading backgroundColor=yellow rollBackgroundColor=green><a href=https://zimjs.com target=_blank>Example</a></font>: <b>strong</b> <i>emphasis</i> <u>underline</u><br><font color=red size=50 family=verdana><strong>big</strong> red verdana</font><br>the next line"
|
|
23584
|
+
// "LabelLetters()Example: strong emphasis underlinebig red verdanathe next line"
|
|
23585
|
+
// "01234567890123456789012345678901234567890123456789012345678901234567890120123456789012"
|
|
23586
|
+
// "0 1 2 3 4 5 6 7"
|
|
23587
|
+
// html = "!Roger הגיע בשבילך משהו בדואר Dan אני לומד עברית";
|
|
23588
|
+
// html = "הגיע בשבילך משהו בדואר.";
|
|
23254
23589
|
|
|
23255
|
-
|
|
23256
|
-
|
|
23257
|
-
} else {
|
|
23258
|
-
text.pop();
|
|
23259
|
-
var running = 0;
|
|
23260
|
-
zim.loop(text, function(s) {
|
|
23261
|
-
running += s.length;
|
|
23262
|
-
var d = data[running];
|
|
23263
|
-
if (!d) data[running] = [];
|
|
23264
|
-
d = data[running];
|
|
23265
|
-
if (d[action]) d[action].push(type);
|
|
23266
|
-
else d[action] = [type];
|
|
23267
|
-
});
|
|
23268
|
-
}
|
|
23590
|
+
function insert(data) {
|
|
23591
|
+
return data.split("").reverse().join("")
|
|
23269
23592
|
}
|
|
23270
|
-
|
|
23271
|
-
|
|
23272
|
-
|
|
23273
|
-
|
|
23274
|
-
|
|
23275
|
-
|
|
23276
|
-
|
|
23277
|
-
|
|
23278
|
-
|
|
23279
|
-
|
|
23280
|
-
|
|
23281
|
-
|
|
23282
|
-
|
|
23283
|
-
|
|
23284
|
-
|
|
23285
|
-
|
|
23286
|
-
|
|
23287
|
-
|
|
23288
|
-
|
|
23289
|
-
|
|
23290
|
-
|
|
23291
|
-
|
|
23292
|
-
|
|
23293
|
-
|
|
23294
|
-
|
|
23295
|
-
|
|
23296
|
-
|
|
23297
|
-
|
|
23298
|
-
|
|
23299
|
-
|
|
23300
|
-
|
|
23301
|
-
|
|
23302
|
-
|
|
23303
|
-
|
|
23304
|
-
|
|
23305
|
-
|
|
23306
|
-
|
|
23307
|
-
|
|
23308
|
-
|
|
23309
|
-
|
|
23310
|
-
|
|
23311
|
-
|
|
23312
|
-
|
|
23313
|
-
|
|
23314
|
-
|
|
23315
|
-
|
|
23316
|
-
|
|
23317
|
-
|
|
23318
|
-
|
|
23319
|
-
|
|
23320
|
-
|
|
23321
|
-
|
|
23322
|
-
|
|
23323
|
-
|
|
23324
|
-
|
|
23325
|
-
|
|
23326
|
-
|
|
23327
|
-
|
|
23328
|
-
|
|
23329
|
-
|
|
23330
|
-
|
|
23331
|
-
|
|
23332
|
-
|
|
23333
|
-
var backgroundColorCheck = false;
|
|
23334
|
-
var rollBackgroundColorCheck = false;
|
|
23335
|
-
|
|
23336
|
-
// ROLLOVER CONTROL
|
|
23337
|
-
that.rolls = [[]];
|
|
23338
|
-
|
|
23339
|
-
for (i=0; i<that.numLetters; i++) {
|
|
23340
|
-
|
|
23341
|
-
// PARSE TAG CHECKS
|
|
23593
|
+
if (rtl) {
|
|
23594
|
+
count = -1;
|
|
23595
|
+
html = html.replace(/[\u0591-\u07FF]+/ig, insert);
|
|
23596
|
+
|
|
23597
|
+
// and there may be tags or LTR characters next to RTL without a space:
|
|
23598
|
+
html = html.replace(/([^\u0591-\u07FF ])([\u0591-\u07FF])/ig, "$1-!!-$2"); // note the not space
|
|
23599
|
+
html = html.replace(/([\u0591-\u07FF])([^\u0591-\u07FF ])/ig, "$1-!!-$2"); // note the not space
|
|
23600
|
+
html = html.replace(/([^\u0591-\u07FF]) ([\u0591-\u07FF])/ig, "$1-!!- -!!-$2");
|
|
23601
|
+
html = html.replace(/([\u0591-\u07FF]) ([^\u0591-\u07FF])/ig, "$1-!!- -!!-$2");
|
|
23602
|
+
|
|
23603
|
+
var sp = html.split(/-!!-/g);
|
|
23604
|
+
zim.loop(sp, function(ssp, i){
|
|
23605
|
+
if (ssp.match(/[\u0591-\u07FF]/i)) {
|
|
23606
|
+
sp[i] = ssp.split(" ").reverse().join(" ");
|
|
23607
|
+
}
|
|
23608
|
+
});
|
|
23609
|
+
html = sp.join("");
|
|
23610
|
+
}
|
|
23611
|
+
|
|
23612
|
+
|
|
23613
|
+
// normalize tags
|
|
23614
|
+
html = html.replace(/\n|\r/g,"<br>");
|
|
23615
|
+
html = html.replace(/<strong>|<strong \/>|<strong\/>/gi,"<b>");
|
|
23616
|
+
html = html.replace(/<\/strong>/gi,"</b>");
|
|
23617
|
+
html = html.replace(/<em>|<em \/>|<em\/>/gi,"<i>");
|
|
23618
|
+
html = html.replace(/<\/em>/gi,"</i>");
|
|
23619
|
+
html = html.replace(/\\n|\\r/g,"<br>");
|
|
23620
|
+
html = html.replace(/<br>|<br \/>|<br\/>(<\/br>)?/gi,"<br>");
|
|
23621
|
+
html = html.replace(/<b/gi,"<b");
|
|
23622
|
+
html = html.replace(/<i/gi,"<i");
|
|
23623
|
+
html = html.replace(/<u/gi,"<u");
|
|
23624
|
+
html = html.replace(/<br/gi,"<br");
|
|
23625
|
+
html = html.replace(/<a/gi,"<a");
|
|
23626
|
+
html = html.replace(/<font/gi,"<font");
|
|
23627
|
+
|
|
23628
|
+
// turn all other tags into "" do split on tag and count index for tag
|
|
23629
|
+
// process this and store in data so get index of tags in string with no tags counted
|
|
23630
|
+
|
|
23631
|
+
var regs = [
|
|
23632
|
+
/<(a|i|u|f|br|\/a|\/i|\/u|\/f|\/b)[^>]*>/g,
|
|
23633
|
+
/<(a|i|u|f|br|\/a|\/i|\/u|\/f|b)[^>]*>/g,
|
|
23634
|
+
/<(b|i|u|f|br|\/b|\/i|\/u|\/f|\/a)[^>]*>/g,
|
|
23635
|
+
/<(b|i|u|f|br|\/b|\/i|\/u|\/f|a)[^>]*>/g,
|
|
23636
|
+
/<(b|a|u|f|br|\/b|\/a|\/u|\/f|\/i)[^>]*>/g,
|
|
23637
|
+
/<(b|a|u|f|br|\/b|\/a|\/u|\/f|i)[^>]*>/g,
|
|
23638
|
+
/<(b|a|i|f|br|\/b|\/a|\/i|\/f|\/u)[^>]*>/g,
|
|
23639
|
+
/<(b|a|i|f|br|\/b|\/a|\/i|\/f|u)[^>]*>/g,
|
|
23640
|
+
/<(b|a|i|u|br|\/b|\/a|\/i|\/u|\/f)[^>]*>/g,
|
|
23641
|
+
/<(b|a|i|u|br|\/b|\/a|\/i|\/u|f)[^>]*>/g
|
|
23642
|
+
];
|
|
23643
|
+
var types = ["b","a","i","u","font"];
|
|
23644
|
+
var p;
|
|
23645
|
+
zim.loop(types, function(type, i) {
|
|
23646
|
+
p = html.replace(regs[i*2],"");
|
|
23647
|
+
var arr;
|
|
23648
|
+
if (type=="font") {
|
|
23649
|
+
arr = p.split("<font ");
|
|
23650
|
+
} else if (type=="a") {
|
|
23651
|
+
arr = p.split("<a ");
|
|
23652
|
+
} else {
|
|
23653
|
+
arr = p.split("<"+type+">");
|
|
23654
|
+
}
|
|
23655
|
+
process(arr, type, 0); // 0 for add
|
|
23342
23656
|
|
|
23343
|
-
|
|
23344
|
-
|
|
23657
|
+
p = html.replace(regs[i*2+1],"");
|
|
23658
|
+
arr = p.split("</"+type+">");
|
|
23659
|
+
process(arr, type, 1); // 1 for remove
|
|
23660
|
+
});
|
|
23661
|
+
|
|
23345
23662
|
|
|
23346
|
-
|
|
23347
|
-
|
|
23348
|
-
|
|
23349
|
-
|
|
23350
|
-
|
|
23351
|
-
|
|
23352
|
-
|
|
23353
|
-
|
|
23354
|
-
|
|
23355
|
-
|
|
23356
|
-
|
|
23357
|
-
|
|
23358
|
-
|
|
23359
|
-
|
|
23360
|
-
|
|
23361
|
-
|
|
23362
|
-
|
|
23363
|
-
|
|
23364
|
-
|
|
23365
|
-
|
|
23663
|
+
p = html.replace(/<br>/gi,"@^#");
|
|
23664
|
+
p = p.replace(/<(b|a|i|u|f|\/b|\/a|\/i|\/u|\/f)[^>]*>/g,"");
|
|
23665
|
+
var arr = p.split("@^#");
|
|
23666
|
+
original = arr.join("\n");
|
|
23667
|
+
p = arr.join("");
|
|
23668
|
+
process(arr, "br", 0); // 0 for add
|
|
23669
|
+
|
|
23670
|
+
function process(text, type, action) {
|
|
23671
|
+
if (text.length > 1) {
|
|
23672
|
+
if ((type=="font" || type=="a") && action==0) {
|
|
23673
|
+
var length = text[0].length;
|
|
23674
|
+
zim.loop(text, function(s, i) {
|
|
23675
|
+
|
|
23676
|
+
if (i==0) return;
|
|
23677
|
+
var d = data[length];
|
|
23678
|
+
if (!d) data[length] = [];
|
|
23679
|
+
d = data[length] ;
|
|
23680
|
+
|
|
23681
|
+
var arr = s.split(">");
|
|
23682
|
+
|
|
23683
|
+
if (d[action]) d[action].push(type + " " + arr[0]);
|
|
23684
|
+
else d[action] = [type + " " + arr[0]];
|
|
23685
|
+
|
|
23686
|
+
length += arr[1].length;
|
|
23687
|
+
});
|
|
23688
|
+
} else {
|
|
23689
|
+
text.pop();
|
|
23690
|
+
var running = 0;
|
|
23691
|
+
zim.loop(text, function(s) {
|
|
23692
|
+
running += s.length;
|
|
23693
|
+
var d = data[running];
|
|
23694
|
+
if (!d) data[running] = [];
|
|
23695
|
+
d = data[running];
|
|
23696
|
+
if (d[action]) d[action].push(type);
|
|
23697
|
+
else d[action] = [type];
|
|
23698
|
+
});
|
|
23366
23699
|
}
|
|
23367
|
-
}
|
|
23368
|
-
}
|
|
23700
|
+
}
|
|
23701
|
+
}
|
|
23369
23702
|
|
|
23370
|
-
//
|
|
23371
|
-
|
|
23372
|
-
|
|
23373
|
-
|
|
23374
|
-
|
|
23375
|
-
|
|
23376
|
-
|
|
23377
|
-
if (item=="br") brCheck++;
|
|
23378
|
-
});
|
|
23379
|
-
zim.loop(d[i][0], function (item) {
|
|
23380
|
-
var r, ind;
|
|
23381
|
-
if (item.match(/^font/i)) {
|
|
23382
|
-
r = item.match(/ color\s?=\s?(\S*)/i);
|
|
23383
|
-
if (r) {
|
|
23384
|
-
colorCheck = r[1];
|
|
23385
|
-
ind = zim.colors.indexOf(colorCheck);
|
|
23386
|
-
if (ind>=0) colorCheck = zim.colorsHex[ind];
|
|
23387
|
-
colorCheck = colorCheck.replace(/'/g,"");
|
|
23388
|
-
}
|
|
23389
|
-
r = item.match(/size\s?=\s?(\S*)/i);
|
|
23390
|
-
if (r) sizeCheck = r[1];
|
|
23391
|
-
r = item.match(/backgroundColor\s?=\s?(\S*)/i);
|
|
23392
|
-
if (r) {
|
|
23393
|
-
backgroundColorCheck = r[1];
|
|
23394
|
-
ind = zim.colors.indexOf(backgroundColorCheck);
|
|
23395
|
-
if (ind>=0) backgroundColorCheck = zim.colorsHex[ind];
|
|
23396
|
-
backgroundColorCheck = backgroundColorCheck.replace(/'/g,"");
|
|
23397
|
-
}
|
|
23398
|
-
r = item.match(/rollBackgroundColor\s?=\s?(\S*)/i);
|
|
23399
|
-
if (r) {
|
|
23400
|
-
rollBackgroundColorCheck = r[1];
|
|
23401
|
-
ind = zim.colors.indexOf(rollBackgroundColorCheck);
|
|
23402
|
-
if (ind>=0) rollBackgroundColorCheck = zim.colorsHex[ind];
|
|
23403
|
-
rollBackgroundColorCheck = rollBackgroundColorCheck.replace(/'/g,"");
|
|
23404
|
-
}
|
|
23405
|
-
r = item.match(/group\s?=\s?(\S*)/i);
|
|
23406
|
-
if (r) groupCheck = r[1];
|
|
23407
|
-
r = item.match(/family\s?=\s?(.*)/i);
|
|
23408
|
-
if (r) {
|
|
23409
|
-
familyCheck = r[1];
|
|
23410
|
-
familyCheck = familyCheck.split(/\ssize\s?=|\scolor\s?=|\sgroup\s?=/i)[0];
|
|
23411
|
-
}
|
|
23412
|
-
return;
|
|
23413
|
-
}
|
|
23414
|
-
if (item.match(/^a/i)) {
|
|
23415
|
-
r = item.match(/href\s?=\s?(\S*)/i);
|
|
23416
|
-
if (r) urlCheck = r[1];
|
|
23417
|
-
r = item.match(/target\s?=\s?(\S*)/i);
|
|
23418
|
-
if (r) targetCheck = r[1];
|
|
23419
|
-
return;
|
|
23420
|
-
}
|
|
23421
|
-
});
|
|
23422
|
-
} // end start tag
|
|
23423
|
-
|
|
23424
|
-
} // end all tags
|
|
23703
|
+
// [[adds at index], [removes at index]]
|
|
23704
|
+
// b,i,u,br,a,font
|
|
23705
|
+
// var da = [,, [["b","i"]] ,[,["b"]],,,[["br","font color=red size=10 family=courier"]],["i"]],...];
|
|
23706
|
+
return {text:p, data:data, original:original};
|
|
23707
|
+
}
|
|
23708
|
+
|
|
23709
|
+
that.numLetters = label.text.length;
|
|
23425
23710
|
|
|
23426
|
-
//
|
|
23427
|
-
var
|
|
23428
|
-
if (
|
|
23429
|
-
|
|
23711
|
+
// NORMALIZE SPACINGS
|
|
23712
|
+
var letterSpacingsOriginal = !zot(letterSpacings);
|
|
23713
|
+
if (letterSpacings && !Array.isArray(letterSpacings)) letterSpacings = null;
|
|
23714
|
+
var i;
|
|
23715
|
+
if (!letterSpacings) {
|
|
23716
|
+
letterSpacings = [];
|
|
23717
|
+
for (i = 0; i < that.numLetters; i++) {
|
|
23718
|
+
letterSpacings.push(letterSpacing);
|
|
23719
|
+
}
|
|
23430
23720
|
} else {
|
|
23431
|
-
|
|
23432
|
-
|
|
23721
|
+
for (i = 0; i < that.numLetters; i++) {
|
|
23722
|
+
if (zot(letterSpacings[i])) letterSpacings[i] = letterSpacing;
|
|
23723
|
+
}
|
|
23433
23724
|
}
|
|
23434
|
-
that.
|
|
23435
|
-
|
|
23436
|
-
if (
|
|
23437
|
-
if (
|
|
23438
|
-
|
|
23439
|
-
|
|
23440
|
-
|
|
23441
|
-
|
|
23442
|
-
|
|
23443
|
-
|
|
23444
|
-
|
|
23445
|
-
|
|
23446
|
-
letter.zobc = letter.backgroundColor;
|
|
23447
|
-
that.rolls[letter.rollIndex].push(letter);
|
|
23448
|
-
letter.expand(0);
|
|
23449
|
-
letter.on("mouseover", rollOn);
|
|
23450
|
-
letter.on("mouseout", rollOff);
|
|
23725
|
+
that.letterSpacings = letterSpacings;
|
|
23726
|
+
|
|
23727
|
+
if (lineSpacings && !Array.isArray(lineSpacings)) lineSpacings = null;
|
|
23728
|
+
if (!lineSpacings) {
|
|
23729
|
+
lineSpacings = [];
|
|
23730
|
+
for (i = 0; i < that.numLetters - 1; i++) {
|
|
23731
|
+
lineSpacings.push(lineSpacing);
|
|
23732
|
+
}
|
|
23733
|
+
} else {
|
|
23734
|
+
for (i = 0; i < that.numLetters - 1; i++) {
|
|
23735
|
+
if (zot(lineSpacings[i])) lineSpacings[i] = lineSpacing;
|
|
23736
|
+
}
|
|
23451
23737
|
}
|
|
23738
|
+
that.lineSpacings = lineSpacings;
|
|
23452
23739
|
|
|
23453
|
-
|
|
23454
|
-
|
|
23455
|
-
|
|
23456
|
-
|
|
23457
|
-
|
|
23458
|
-
|
|
23459
|
-
|
|
23460
|
-
|
|
23461
|
-
|
|
23462
|
-
|
|
23463
|
-
|
|
23464
|
-
}
|
|
23465
|
-
if (familyCheck) letter.font = familyCheck;
|
|
23466
|
-
if (sizeCheck) letter.size = sizeCheck;
|
|
23740
|
+
// LINE CONTROL
|
|
23741
|
+
that.labels = [];
|
|
23742
|
+
that.lines = [[]];
|
|
23743
|
+
var lineWidths = [];
|
|
23744
|
+
var lineHeights = [];
|
|
23745
|
+
var linePositionsY = [0];
|
|
23746
|
+
var lineY = 0;
|
|
23747
|
+
var lineW = 0;
|
|
23748
|
+
var lineH = 0;
|
|
23749
|
+
var lineNum = 0;
|
|
23750
|
+
var maxW = 0;
|
|
23467
23751
|
|
|
23752
|
+
// HTML CONTROL
|
|
23753
|
+
var d = letterData;
|
|
23754
|
+
var bCheck = false;
|
|
23755
|
+
var iCheck = false;
|
|
23756
|
+
var uCheck = false;
|
|
23757
|
+
var brCheck = false;
|
|
23758
|
+
var colorCheck = false;
|
|
23759
|
+
var sizeCheck = false;
|
|
23760
|
+
var groupCheck = false;
|
|
23761
|
+
var familyCheck = false;
|
|
23762
|
+
var urlCheck = false;
|
|
23763
|
+
var targetCheck = false;
|
|
23764
|
+
var backgroundColorCheck = false;
|
|
23765
|
+
var rollBackgroundColorCheck = false;
|
|
23468
23766
|
|
|
23469
|
-
|
|
23470
|
-
|
|
23471
|
-
linePositionsY.push(lineY);
|
|
23472
|
-
lineHeights.push(zot(lineHeight)?lineH:lineHeight);
|
|
23473
|
-
lineWidths.push(lineW);
|
|
23474
|
-
maxW = Math.max(maxW, lineW);
|
|
23475
|
-
}
|
|
23767
|
+
// ROLLOVER CONTROL
|
|
23768
|
+
that.rolls = [[]];
|
|
23476
23769
|
|
|
23477
|
-
|
|
23478
|
-
|
|
23479
|
-
|
|
23480
|
-
|
|
23481
|
-
|
|
23482
|
-
|
|
23483
|
-
|
|
23484
|
-
|
|
23485
|
-
|
|
23486
|
-
|
|
23770
|
+
for (i=0; i<that.numLetters; i++) {
|
|
23771
|
+
|
|
23772
|
+
// PARSE TAG CHECKS
|
|
23773
|
+
|
|
23774
|
+
brCheck = false;
|
|
23775
|
+
if (d[i]) {
|
|
23776
|
+
|
|
23777
|
+
// end tags - do ends first just in case tag ends at same letter it starts
|
|
23778
|
+
if (d[i][1]) {
|
|
23779
|
+
if (d[i][1].indexOf("b") >= 0) bCheck = false;
|
|
23780
|
+
if (d[i][1].indexOf("i") >= 0) iCheck = false;
|
|
23781
|
+
if (d[i][1].indexOf("u") >= 0) uCheck = false;
|
|
23782
|
+
zim.loop(d[i][1], function (item) {
|
|
23783
|
+
if (item.match(/^font/i)) {
|
|
23784
|
+
colorCheck = false;
|
|
23785
|
+
backgroundColorCheck = false;
|
|
23786
|
+
if (rollBackgroundColorCheck) that.rolls.push([]);
|
|
23787
|
+
rollBackgroundColorCheck = false;
|
|
23788
|
+
sizeCheck = false;
|
|
23789
|
+
familyCheck = false;
|
|
23790
|
+
groupCheck = false;
|
|
23791
|
+
return;
|
|
23792
|
+
}
|
|
23793
|
+
if (item.match(/^a/i)) {
|
|
23794
|
+
urlCheck = false;
|
|
23795
|
+
targetCheck = false;
|
|
23796
|
+
return;
|
|
23797
|
+
}
|
|
23798
|
+
});
|
|
23799
|
+
}
|
|
23800
|
+
|
|
23801
|
+
// start tags
|
|
23802
|
+
if (d[i][0]) {
|
|
23803
|
+
if (d[i][0].indexOf("b") >= 0) bCheck = true;
|
|
23804
|
+
if (d[i][0].indexOf("i") >= 0) iCheck = true;
|
|
23805
|
+
if (d[i][0].indexOf("u") >= 0) uCheck = true;
|
|
23806
|
+
brCheck = 0;
|
|
23807
|
+
zim.loop(d[i][0], function (item) {
|
|
23808
|
+
if (item=="br") brCheck++;
|
|
23809
|
+
});
|
|
23810
|
+
zim.loop(d[i][0], function (item) {
|
|
23811
|
+
var r, ind;
|
|
23812
|
+
if (item.match(/^font/i)) {
|
|
23813
|
+
r = item.match(/ color\s?=\s?(\S*)/i);
|
|
23814
|
+
if (r) {
|
|
23815
|
+
colorCheck = r[1];
|
|
23816
|
+
ind = zim.colors.indexOf(colorCheck);
|
|
23817
|
+
if (ind>=0) colorCheck = zim.colorsHex[ind];
|
|
23818
|
+
colorCheck = colorCheck.replace(/'/g,"");
|
|
23819
|
+
}
|
|
23820
|
+
r = item.match(/size\s?=\s?(\S*)/i);
|
|
23821
|
+
if (r) sizeCheck = r[1];
|
|
23822
|
+
r = item.match(/backgroundColor\s?=\s?(\S*)/i);
|
|
23823
|
+
if (r) {
|
|
23824
|
+
backgroundColorCheck = r[1];
|
|
23825
|
+
ind = zim.colors.indexOf(backgroundColorCheck);
|
|
23826
|
+
if (ind>=0) backgroundColorCheck = zim.colorsHex[ind];
|
|
23827
|
+
backgroundColorCheck = backgroundColorCheck.replace(/'/g,"");
|
|
23828
|
+
}
|
|
23829
|
+
r = item.match(/rollBackgroundColor\s?=\s?(\S*)/i);
|
|
23830
|
+
if (r) {
|
|
23831
|
+
rollBackgroundColorCheck = r[1];
|
|
23832
|
+
ind = zim.colors.indexOf(rollBackgroundColorCheck);
|
|
23833
|
+
if (ind>=0) rollBackgroundColorCheck = zim.colorsHex[ind];
|
|
23834
|
+
rollBackgroundColorCheck = rollBackgroundColorCheck.replace(/'/g,"");
|
|
23835
|
+
}
|
|
23836
|
+
r = item.match(/group\s?=\s?(\S*)/i);
|
|
23837
|
+
if (r) groupCheck = r[1];
|
|
23838
|
+
r = item.match(/family\s?=\s?(.*)/i);
|
|
23839
|
+
if (r) {
|
|
23840
|
+
familyCheck = r[1];
|
|
23841
|
+
familyCheck = familyCheck.split(/\ssize\s?=|\scolor\s?=|\sgroup\s?=/i)[0];
|
|
23842
|
+
}
|
|
23843
|
+
return;
|
|
23844
|
+
}
|
|
23845
|
+
if (item.match(/^a/i)) {
|
|
23846
|
+
r = item.match(/href\s?=\s?(\S*)/i);
|
|
23847
|
+
if (r) urlCheck = r[1];
|
|
23848
|
+
r = item.match(/target\s?=\s?(\S*)/i);
|
|
23849
|
+
if (r) targetCheck = r[1];
|
|
23850
|
+
return;
|
|
23851
|
+
}
|
|
23852
|
+
});
|
|
23853
|
+
} // end start tag
|
|
23854
|
+
|
|
23855
|
+
} // end all tags
|
|
23856
|
+
|
|
23857
|
+
// HANDLE CHECKS AND STORE MAX SIZES
|
|
23858
|
+
var letter;
|
|
23859
|
+
if (groupCheck) {
|
|
23860
|
+
letter = new zim.Label({text:label.text[i], group:groupCheck})
|
|
23861
|
+
} else {
|
|
23862
|
+
letter = label.clone();
|
|
23863
|
+
letter.text = label.text[i];
|
|
23864
|
+
}
|
|
23865
|
+
that.labels.push(letter);
|
|
23866
|
+
|
|
23867
|
+
if (bCheck) letter.bold = true;
|
|
23868
|
+
if (iCheck) letter.italic = true;
|
|
23869
|
+
if (colorCheck) letter.color = colorCheck;
|
|
23870
|
+
if (backgroundColorCheck) letter.backgroundColor = backgroundColorCheck;
|
|
23871
|
+
|
|
23872
|
+
var s = letterSpacingsOriginal?letterSpacings[i]:zot(letter.backgroundColor)?letterSpacings[i]:-.5;
|
|
23873
|
+
|
|
23874
|
+
if (rollBackgroundColorCheck) {
|
|
23875
|
+
letter.rollIndex = that.rolls.length-1;
|
|
23876
|
+
letter.zrbc = rollBackgroundColorCheck;
|
|
23877
|
+
letter.zobc = letter.backgroundColor;
|
|
23878
|
+
that.rolls[letter.rollIndex].push(letter);
|
|
23879
|
+
letter.expand(0);
|
|
23880
|
+
letter.on("mouseover", rollOn);
|
|
23881
|
+
letter.on("mouseout", rollOff);
|
|
23882
|
+
}
|
|
23883
|
+
|
|
23884
|
+
if (urlCheck) {
|
|
23885
|
+
letter.expand(s,0);
|
|
23886
|
+
letter.zurl = urlCheck;
|
|
23887
|
+
letter.ztar = targetCheck;
|
|
23888
|
+
letter.cur();
|
|
23889
|
+
letter.on("click", function (e) {
|
|
23890
|
+
var letter = e.currentTarget;
|
|
23891
|
+
rollOff(e);
|
|
23892
|
+
if (!letter.ztar) letter.ztar = "_self";
|
|
23893
|
+
zgo(letter.zurl, letter.ztar);
|
|
23894
|
+
});
|
|
23895
|
+
}
|
|
23896
|
+
if (familyCheck) letter.font = familyCheck;
|
|
23897
|
+
if (sizeCheck) letter.size = sizeCheck;
|
|
23898
|
+
|
|
23899
|
+
|
|
23900
|
+
if (brCheck) {
|
|
23901
|
+
lineY += (zot(lineHeight)?lineH:lineHeight) + lineSpacings[lineNum];
|
|
23902
|
+
linePositionsY.push(lineY);
|
|
23903
|
+
lineHeights.push(zot(lineHeight)?lineH:lineHeight);
|
|
23904
|
+
lineWidths.push(lineW);
|
|
23905
|
+
maxW = Math.max(maxW, lineW);
|
|
23906
|
+
}
|
|
23907
|
+
|
|
23908
|
+
if (brCheck) {
|
|
23909
|
+
if (brCheck > 1) {
|
|
23910
|
+
zim.loop(brCheck-1, function () {
|
|
23911
|
+
that.lines.push([]);
|
|
23912
|
+
lineY += (zot(lineHeight)?lineH:lineHeight) + lineSpacings[lineNum];
|
|
23913
|
+
linePositionsY.push(lineY);
|
|
23914
|
+
lineHeights.push(zot(lineHeight)?lineH:lineHeight);
|
|
23915
|
+
lineWidths.push(0);
|
|
23916
|
+
lineNum++;
|
|
23917
|
+
});
|
|
23918
|
+
}
|
|
23919
|
+
lineH = 0;
|
|
23920
|
+
lineW = 0;
|
|
23921
|
+
that.lines.push([]);
|
|
23922
|
+
lineNum++;
|
|
23487
23923
|
}
|
|
23488
|
-
|
|
23489
|
-
lineW
|
|
23490
|
-
|
|
23491
|
-
|
|
23492
|
-
|
|
23493
|
-
|
|
23494
|
-
|
|
23495
|
-
|
|
23924
|
+
|
|
23925
|
+
lineW += letter.width + s;
|
|
23926
|
+
lineH = Math.max(lineH, letter.height);
|
|
23927
|
+
|
|
23928
|
+
if (i==that.numLetters-1) {
|
|
23929
|
+
lineWidths.push(lineW);
|
|
23930
|
+
lineHeights.push(lineH);
|
|
23931
|
+
maxW = Math.max(maxW, lineW);
|
|
23932
|
+
}
|
|
23933
|
+
|
|
23934
|
+
that.lines[lineNum].push(letter);
|
|
23935
|
+
|
|
23936
|
+
if (uCheck) letter.underline = new zim.Line(letter.width+s+1,1,letter.color).center(letter,that).mov(0,letter.height/2);
|
|
23937
|
+
|
|
23938
|
+
} // end checks
|
|
23496
23939
|
|
|
23497
|
-
|
|
23498
|
-
lineWidths.push(lineW);
|
|
23499
|
-
lineHeights.push(lineH);
|
|
23500
|
-
maxW = Math.max(maxW, lineW);
|
|
23501
|
-
}
|
|
23940
|
+
|
|
23502
23941
|
|
|
23503
|
-
that.lines[lineNum].push(letter);
|
|
23504
23942
|
|
|
23505
|
-
|
|
23943
|
+
// LOOP THROUGH LINES AND APPLY POSITIONS
|
|
23944
|
+
var count = 0;
|
|
23945
|
+
for (var j=0; j<that.lines.length; j++) {
|
|
23946
|
+
var ll = that.lines[j];
|
|
23947
|
+
lineW = lineWidths[j];
|
|
23948
|
+
lineH = lineHeights[j];
|
|
23949
|
+
lineY = linePositionsY[j];
|
|
23950
|
+
|
|
23951
|
+
var startX, startY;
|
|
23952
|
+
if (lineAlign=="left") startX = 0;
|
|
23953
|
+
else if (lineAlign=="right") startX = maxW-lineW;
|
|
23954
|
+
else startX = (maxW-lineW)/2;
|
|
23955
|
+
startY = lineY;
|
|
23956
|
+
|
|
23957
|
+
for (i=0; i<ll.length; i++) {
|
|
23958
|
+
count++;
|
|
23959
|
+
if (cache) letter.cache();
|
|
23960
|
+
letter = ll[i];
|
|
23961
|
+
letter.regX = align=="left"?0:(align=="right"?letter.width:letter.width/2);
|
|
23962
|
+
letter.regY = valign=="top"?0:(valign=="bottom"?letter.height:letter.height/2);
|
|
23506
23963
|
|
|
23507
|
-
|
|
23508
|
-
|
|
23964
|
+
var sY = startY+(valign=="top"?0:valign=="bottom"?letter.height:letter.height/2);
|
|
23965
|
+
if (lineValign=="center" || lineValign=="middle") {
|
|
23966
|
+
sY += (lineHeights[j]-letter.height)/2;
|
|
23967
|
+
} else if (lineValign=="bottom") {
|
|
23968
|
+
sY += lineHeights[j]-letter.height;
|
|
23969
|
+
}
|
|
23970
|
+
s = letterSpacingsOriginal?letterSpacings[count-1]:zot(letter.backgroundColor)?letterSpacings[count-1]:-.5;
|
|
23971
|
+
if (align=="left") {
|
|
23972
|
+
letter.loc(startX, sY, that);
|
|
23973
|
+
startX = letter.x+letter.width+s;
|
|
23974
|
+
} else if (align=="right") {
|
|
23975
|
+
letter.loc(startX+letter.width, sY, that);
|
|
23976
|
+
startX = letter.x+s;
|
|
23977
|
+
} else {
|
|
23978
|
+
letter.loc(startX+letter.width/2, sY, that);
|
|
23979
|
+
startX = letter.x+letter.width/2+s;
|
|
23980
|
+
}
|
|
23981
|
+
|
|
23982
|
+
} // end lines letters
|
|
23983
|
+
} // end lines
|
|
23984
|
+
|
|
23985
|
+
if (!that.getBounds()) that.setBounds(0,0,0,0);
|
|
23986
|
+
that.regX = that.getBounds().x;
|
|
23987
|
+
that.regY = that.getBounds().y;
|
|
23988
|
+
|
|
23989
|
+
}
|
|
23990
|
+
|
|
23991
|
+
make();
|
|
23992
|
+
|
|
23509
23993
|
// ROLL FUNCTIONS
|
|
23510
|
-
|
|
23994
|
+
|
|
23511
23995
|
function rollOn(e) {
|
|
23512
23996
|
var letter = e.currentTarget;
|
|
23513
23997
|
var rolls = that.rolls[letter.rollIndex]
|
|
@@ -23524,58 +24008,22 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
23524
24008
|
});
|
|
23525
24009
|
if (letter.stage) letter.stage.update();
|
|
23526
24010
|
}
|
|
23527
|
-
|
|
23528
|
-
|
|
23529
|
-
// LOOP THROUGH LINES AND APPLY POSITIONS
|
|
23530
|
-
var count = 0;
|
|
23531
|
-
for (var j=0; j<that.lines.length; j++) {
|
|
23532
|
-
var ll = that.lines[j];
|
|
23533
|
-
lineW = lineWidths[j];
|
|
23534
|
-
lineH = lineHeights[j];
|
|
23535
|
-
lineY = linePositionsY[j];
|
|
23536
|
-
|
|
23537
|
-
var startX, startY;
|
|
23538
|
-
if (lineAlign=="left") startX = 0;
|
|
23539
|
-
else if (lineAlign=="right") startX = maxW-lineW;
|
|
23540
|
-
else startX = (maxW-lineW)/2;
|
|
23541
|
-
startY = lineY;
|
|
23542
|
-
|
|
23543
|
-
for (i=0; i<ll.length; i++) {
|
|
23544
|
-
count++;
|
|
23545
|
-
if (cache) letter.cache();
|
|
23546
|
-
letter = ll[i];
|
|
23547
|
-
letter.regX = align=="left"?0:(align=="right"?letter.width:letter.width/2);
|
|
23548
|
-
letter.regY = valign=="top"?0:(valign=="bottom"?letter.height:letter.height/2);
|
|
23549
|
-
|
|
23550
|
-
var sY = startY+(valign=="top"?0:valign=="bottom"?letter.height:letter.height/2);
|
|
23551
|
-
if (lineValign=="center" || lineValign=="middle") {
|
|
23552
|
-
sY += (lineHeights[j]-letter.height)/2;
|
|
23553
|
-
} else if (lineValign=="bottom") {
|
|
23554
|
-
sY += lineHeights[j]-letter.height;
|
|
23555
|
-
}
|
|
23556
|
-
s = letterSpacingsOriginal?letterSpacings[count-1]:zot(letter.backgroundColor)?letterSpacings[count-1]:-.5;
|
|
23557
|
-
if (align=="left") {
|
|
23558
|
-
letter.loc(startX, sY, this);
|
|
23559
|
-
startX = letter.x+letter.width+s;
|
|
23560
|
-
} else if (align=="right") {
|
|
23561
|
-
letter.loc(startX+letter.width, sY, this);
|
|
23562
|
-
startX = letter.x+s;
|
|
23563
|
-
} else {
|
|
23564
|
-
letter.loc(startX+letter.width/2, sY, this);
|
|
23565
|
-
startX = letter.x+letter.width/2+s;
|
|
23566
|
-
}
|
|
23567
|
-
|
|
23568
|
-
} // end lines letters
|
|
23569
|
-
} // end lines
|
|
23570
24011
|
|
|
23571
|
-
if (!this.getBounds()) this.setBounds(0,0,0,0);
|
|
23572
|
-
this.regX = this.getBounds().x;
|
|
23573
|
-
this.regY = this.getBounds().y;
|
|
23574
24012
|
|
|
23575
24013
|
this.setProps = function(props) {
|
|
23576
24014
|
zim.setProps(this.labels, props);
|
|
23577
24015
|
return this;
|
|
23578
24016
|
}
|
|
24017
|
+
|
|
24018
|
+
Object.defineProperty(this, 'text', {
|
|
24019
|
+
get: function () {
|
|
24020
|
+
return this._text;
|
|
24021
|
+
},
|
|
24022
|
+
set: function (value) {
|
|
24023
|
+
label = value;
|
|
24024
|
+
make();
|
|
24025
|
+
}
|
|
24026
|
+
});
|
|
23579
24027
|
|
|
23580
24028
|
Object.defineProperty(this, 'color', {
|
|
23581
24029
|
get: function () {
|
|
@@ -23735,7 +24183,7 @@ addChild(), removeChild(), addChildAt(), getChildAt(), contains(), removeAllChil
|
|
|
23735
24183
|
|
|
23736
24184
|
PROPERTIES
|
|
23737
24185
|
type - the name of the class as a String
|
|
23738
|
-
text - get
|
|
24186
|
+
text - get or set the text
|
|
23739
24187
|
labels - an array of ZIM Label objects for the letters
|
|
23740
24188
|
numWords - how many words in labels (same as numChildren)
|
|
23741
24189
|
|
|
@@ -23775,28 +24223,42 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
23775
24223
|
if (zot(spacingH)) spacingH = DS.spacingH != null ? DS.spacingH : size/2;
|
|
23776
24224
|
if (zot(spacingV)) spacingV = DS.spacingV != null ? DS.spacingV : size/2;
|
|
23777
24225
|
|
|
23778
|
-
|
|
23779
|
-
if (label.type == "Label") sentence = label.text;
|
|
23780
|
-
else sentence = label;
|
|
24226
|
+
var that = this;
|
|
23781
24227
|
|
|
23782
|
-
|
|
23783
|
-
|
|
23784
|
-
|
|
23785
|
-
|
|
23786
|
-
|
|
23787
|
-
|
|
23788
|
-
|
|
23789
|
-
|
|
23790
|
-
|
|
23791
|
-
|
|
23792
|
-
|
|
23793
|
-
|
|
23794
|
-
|
|
23795
|
-
|
|
23796
|
-
|
|
24228
|
+
function make(label) {
|
|
24229
|
+
var sentence;
|
|
24230
|
+
if (label.type == "Label") sentence = label.text;
|
|
24231
|
+
else sentence = label;
|
|
24232
|
+
that._text = sentence;
|
|
24233
|
+
var words = sentence.split(' ').filter(Boolean);
|
|
24234
|
+
var labels = that.labels = [];
|
|
24235
|
+
zim.loop(words, function(word) {
|
|
24236
|
+
var lab = label.type=="Label"?label.clone():new zim.Label();
|
|
24237
|
+
lab.text = word;
|
|
24238
|
+
lab.size = zik(size);
|
|
24239
|
+
lab.font = zik(font);
|
|
24240
|
+
lab.color = zik(color);
|
|
24241
|
+
if (!zot(backgroundColor)) lab.backgroundColor = zik(backgroundColor);
|
|
24242
|
+
lab.reg(zik(itemRegX), zik(itemRegY));
|
|
24243
|
+
if (itemCache) lab.cache();
|
|
24244
|
+
labels.push(lab);
|
|
24245
|
+
});
|
|
24246
|
+
}
|
|
24247
|
+
make(label);
|
|
23797
24248
|
|
|
23798
|
-
this.zimWrapper_constructor(labels, width, spacingH, spacingV, wrapperType, align, valign, alignInner, valignInner, flip, reverse, bottomFull, colSize, rowSize, height, minSpreadNum, minStretchNum, percentVoidH, offsetVoidH, percentVoidV, offsetVoidV, minStretchFirst, style, group, inherit);
|
|
24249
|
+
this.zimWrapper_constructor(that.labels, width, spacingH, spacingV, wrapperType, align, valign, alignInner, valignInner, flip, reverse, bottomFull, colSize, rowSize, height, minSpreadNum, minStretchNum, percentVoidH, offsetVoidH, percentVoidV, offsetVoidV, minStretchFirst, style, group, inherit);
|
|
23799
24250
|
|
|
24251
|
+
Object.defineProperty(this, 'text', {
|
|
24252
|
+
get: function () {
|
|
24253
|
+
return this._text;
|
|
24254
|
+
},
|
|
24255
|
+
set: function (label) {
|
|
24256
|
+
that.remove();
|
|
24257
|
+
make(label);
|
|
24258
|
+
that.add(that.labels);
|
|
24259
|
+
}
|
|
24260
|
+
});
|
|
24261
|
+
|
|
23800
24262
|
if (style!==false) zim.styleTransforms(this, DS);
|
|
23801
24263
|
this.clone = function () {
|
|
23802
24264
|
return that.cloneProps(new zim.LabelWords(label, width, size, font, color, backgroundColor, itemCache, itemRegX, itemRegY, spacingH, spacingV, wrapperType, align, valign, alignInner, valignInner, flip, reverse, bottomFull, colSize, rowSize, height, minSpreadNum, minStretchNum, percentVoidH, offsetVoidH, percentVoidV, offsetVoidV, minStretchFirst, style, this.group, inherit));
|
|
@@ -24754,13 +25216,13 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
24754
25216
|
if (that.rolled) return;
|
|
24755
25217
|
});
|
|
24756
25218
|
|
|
24757
|
-
this.on("pressup", function () {
|
|
25219
|
+
this.on("pressup", function (e) {
|
|
24758
25220
|
that.pressed = onCheck = pressCheck = false;
|
|
24759
|
-
|
|
25221
|
+
|
|
24760
25222
|
if (reallyOn) buttonOn(); // will recall the roll ZIM01
|
|
24761
25223
|
else if (that.rollPersist) removeRoll();
|
|
24762
25224
|
|
|
24763
|
-
if (
|
|
25225
|
+
if (e.nativeEvent && (e.nativeEvent.type == "touchend" || e.nativeEvent == "touchcancel")) { // touch screen
|
|
24764
25226
|
buttonOff();
|
|
24765
25227
|
}
|
|
24766
25228
|
});
|
|
@@ -27187,6 +27649,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
27187
27649
|
if (replace) that.contentContainer.removeAllChildren();
|
|
27188
27650
|
if (center) obj.center(that.contentContainer, index);
|
|
27189
27651
|
else obj.addTo(that.contentContainer, index);
|
|
27652
|
+
addHTML(that.contentContainer);
|
|
27190
27653
|
return that;
|
|
27191
27654
|
}
|
|
27192
27655
|
|
|
@@ -27331,7 +27794,6 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
27331
27794
|
});
|
|
27332
27795
|
}
|
|
27333
27796
|
|
|
27334
|
-
|
|
27335
27797
|
this.on("removed", hide2);
|
|
27336
27798
|
function hide2() {
|
|
27337
27799
|
var ch,i;
|
|
@@ -27440,6 +27902,8 @@ NOTE: to add ZIM Swipe() to objects in window set the overrideNoSwipe parameter
|
|
|
27440
27902
|
NOTE: if animating the window off screen then either turn optimize:false
|
|
27441
27903
|
or use window.update() in the "animation" event with the animate({events:true})
|
|
27442
27904
|
|
|
27905
|
+
NOTE: if window content has items set to visible false then set optimize false to avoid conflict
|
|
27906
|
+
|
|
27443
27907
|
NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
|
|
27444
27908
|
|
|
27445
27909
|
EXAMPLE
|
|
@@ -27560,6 +28024,7 @@ optimize - (default true) set to false to not turn DisplayObjects visible false
|
|
|
27560
28024
|
as the Window is scrolled, any objects within the content and any objects within one level of those objects
|
|
27561
28025
|
are set to visible false if their bounds are not hitting the the window bounds + 300 - thanks Ami Hanya for the suggestion
|
|
27562
28026
|
also see optimize property
|
|
28027
|
+
if window content has items set to visible false then set optimize false to avoid conflict
|
|
27563
28028
|
resizeBoundary - (default null) add a ZIM Boundary() object for the resize handle - relative to the resize handle start position
|
|
27564
28029
|
new Boundary(-100, 0, 200, 0) - would allow the resize handle to move to the left or right 100 pixels but not up or down
|
|
27565
28030
|
new Boundary(0, -100, 0, 200) - would allow the resize handle to move to up or down 100 pixels but not left or right
|
|
@@ -27614,7 +28079,7 @@ addChild(), removeChild(), addChildAt(), getChildAt(), contains(), removeAllChil
|
|
|
27614
28079
|
|
|
27615
28080
|
PROPERTIES
|
|
27616
28081
|
type - holds the class name as a String
|
|
27617
|
-
backing -
|
|
28082
|
+
backing - ZIM Shape used for backing of Window
|
|
27618
28083
|
backgroundColor - the color of the backing
|
|
27619
28084
|
borderColor - the color of the border
|
|
27620
28085
|
borderWidth - the width of the border
|
|
@@ -27629,6 +28094,7 @@ content - gives access to the content provided as a parameter to the Window()
|
|
|
27629
28094
|
buttons - an array of the Button objects if provided
|
|
27630
28095
|
config - the original content config object {}
|
|
27631
28096
|
optimize - see optimize parameter - set to true (default) or false to optimize scrolling of Window
|
|
28097
|
+
if window content has items set to visible false then set optimize false to avoid conflict
|
|
27632
28098
|
enabled - get or set whether the Window is enabled
|
|
27633
28099
|
scrollEnabled - get or set whether the Window can be scrolled
|
|
27634
28100
|
scrollBar - data object that holds the following properties (with defaults):
|
|
@@ -27761,6 +28227,8 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
27761
28227
|
var backing = this.backing = new zim.Shape({style:false});
|
|
27762
28228
|
this.addChild(backing);
|
|
27763
28229
|
|
|
28230
|
+
var htmlList = new zim.Dictionary(true);
|
|
28231
|
+
|
|
27764
28232
|
var mask = new createjs.Shape();
|
|
27765
28233
|
mask.type = "WindowBacking";
|
|
27766
28234
|
var mg = mask.graphics;
|
|
@@ -28160,7 +28628,8 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
28160
28628
|
titleBarRect.sha(null);
|
|
28161
28629
|
if (resizeHandle) that.resizeHandle.visible = true;
|
|
28162
28630
|
that.setBounds(ob.x, ob.y, ob.width, ob.height);
|
|
28163
|
-
|
|
28631
|
+
show2();
|
|
28632
|
+
that.dispatchEvent("expand");
|
|
28164
28633
|
} else {
|
|
28165
28634
|
collapseIcon.rot(180);
|
|
28166
28635
|
that.backing.visible = false;
|
|
@@ -28173,6 +28642,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
28173
28642
|
titleBarRect.sha(shadowColor, 5,5, shadowBlur);
|
|
28174
28643
|
if (resizeHandle) that.resizeHandle.visible = false;
|
|
28175
28644
|
that.setBounds(ob.x, ob.y, ob.width, titleBar.height);
|
|
28645
|
+
hide2();
|
|
28176
28646
|
that.dispatchEvent("collapse");
|
|
28177
28647
|
}
|
|
28178
28648
|
if (that.stage) that.stage.update();
|
|
@@ -28199,6 +28669,34 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
28199
28669
|
that.collapse(true);
|
|
28200
28670
|
}
|
|
28201
28671
|
});
|
|
28672
|
+
|
|
28673
|
+
}
|
|
28674
|
+
}
|
|
28675
|
+
this.on("removed", hide2);
|
|
28676
|
+
function hide2() {
|
|
28677
|
+
var ch,i;
|
|
28678
|
+
var tar = that.content||that.contentContainer||that;
|
|
28679
|
+
if (tar.type != "Container") tar = that.contentContainer||that;
|
|
28680
|
+
for (i=0; i<tar.numChildren; i++) { // record depths first
|
|
28681
|
+
ch = tar.getChildAt(i);
|
|
28682
|
+
if (ch.type == "TextArea" || ch.type == "Loader" || ch.type == "Tag") {
|
|
28683
|
+
var obj = {obj:ch, depth:tar.getChildIndex(ch)};
|
|
28684
|
+
htmlList.add(ch, obj);
|
|
28685
|
+
}
|
|
28686
|
+
}
|
|
28687
|
+
for (i=tar.numChildren-1; i>=0; i--) { // remove textareas and loaders second
|
|
28688
|
+
ch = tar.getChildAt(i);
|
|
28689
|
+
if (ch.type == "TextArea" || ch.type == "Loader" || ch.type == "Tag") {
|
|
28690
|
+
tar.removeChild(ch);
|
|
28691
|
+
}
|
|
28692
|
+
}
|
|
28693
|
+
}
|
|
28694
|
+
this.on("added", show2);
|
|
28695
|
+
function show2() {
|
|
28696
|
+
var tar = that.content||that.contentContainer||that;
|
|
28697
|
+
if (tar.type != "Container") tar = that.contentContainer||that;
|
|
28698
|
+
for (var i=0; i<htmlList.length; i++) {
|
|
28699
|
+
tar.addChildAt(htmlList.values[i].obj, htmlList.values[i].depth);
|
|
28202
28700
|
}
|
|
28203
28701
|
}
|
|
28204
28702
|
|
|
@@ -28267,7 +28765,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
28267
28765
|
var duo; if (duo = zob(that.add, arguments, sig, that)) return duo;
|
|
28268
28766
|
|
|
28269
28767
|
var c = obj;
|
|
28270
|
-
if (!c.getBounds()) {zogy("Window.add() - please add content with bounds set"); return;}
|
|
28768
|
+
if (!c.getBounds()) {zogy("Window.add() - please add content with bounds set"); return;}
|
|
28271
28769
|
makeDamp(c);
|
|
28272
28770
|
if (zot(index)) index = content.numChildren;
|
|
28273
28771
|
if (replace) {
|
|
@@ -28294,7 +28792,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
28294
28792
|
});
|
|
28295
28793
|
}
|
|
28296
28794
|
if (c.x == 0) c.x = paddingH;
|
|
28297
|
-
if (c.y == 0) c.y = paddingV;
|
|
28795
|
+
if (c.y == 0) c.y = paddingV;
|
|
28298
28796
|
that.update();
|
|
28299
28797
|
return that;
|
|
28300
28798
|
};
|
|
@@ -28351,7 +28849,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
28351
28849
|
stage = that.stage;
|
|
28352
28850
|
content.loop(function(item) {
|
|
28353
28851
|
// ADJUSTED ZIM 016 - look into how we can optimize a wrapper and keep scrollbars the right size
|
|
28354
|
-
if (!item.hitTestBounds || !item.stage || item.type == "Wrapper") return; // don't turn off items if not on stage yet
|
|
28852
|
+
if (!item.hitTestBounds || !item.stage || item.type == "Wrapper" || item.type == "List") return; // don't turn off items if not on stage yet
|
|
28355
28853
|
if (item.hitTestBounds(that,300)) {
|
|
28356
28854
|
item.visible = true;
|
|
28357
28855
|
if (item.loop) item.loop(function(item2) {
|
|
@@ -30326,9 +30824,9 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
30326
30824
|
for (var i=0; i<num; i++) {
|
|
30327
30825
|
light = new Container(size,size).reg("center","center");
|
|
30328
30826
|
|
|
30329
|
-
//
|
|
30330
|
-
if (indicatorType == "dot") {
|
|
30331
|
-
light.dim = new zim.Circle(size/2, backgroundColor, borderColor, borderWidth, null, null, null, null, null, false);
|
|
30827
|
+
// dim
|
|
30828
|
+
if (indicatorType == "dot" || indicatorType == "circle") {
|
|
30829
|
+
light.dim = new zim.Circle(size/2, backgroundColor, borderColor, borderWidth, null, null, null, null, null, false);
|
|
30332
30830
|
} else if (indicatorType == "square" || indicatorType == "box") {
|
|
30333
30831
|
light.dim = new zim.Rectangle(size, size, backgroundColor, borderColor, borderWidth, null, null, null, null, false);
|
|
30334
30832
|
light.dim.regX = light.dim.width/2;
|
|
@@ -30351,7 +30849,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
30351
30849
|
this.lights.push(light);
|
|
30352
30850
|
|
|
30353
30851
|
// brights
|
|
30354
|
-
if (selectedIndicatorType == "dot") {
|
|
30852
|
+
if (selectedIndicatorType == "dot" || indicatorType == "circle") {
|
|
30355
30853
|
light.bright = new zim.Circle(size/2, foregroundColor, borderColor, borderWidth, null, null, null, null, null, false);
|
|
30356
30854
|
} else if (selectedIndicatorType == "square" || selectedIndicatorType == "box") {
|
|
30357
30855
|
light.bright = new zim.Rectangle(size, size, foregroundColor, borderColor, borderWidth, null, null, null, null, false);
|
|
@@ -30734,7 +31232,7 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
|
|
|
30734
31232
|
}
|
|
30735
31233
|
align = handleDIR(align);
|
|
30736
31234
|
|
|
30737
|
-
this.zimWindow_constructor(width, height, null, backgroundColor, borderColor, borderWidth, padding, corner, false, scrollBarActive, scrollBarDrag, scrollBarColor, scrollBarAlpha, scrollBarFade, scrollBarH, scrollBarV, false, null, null, false, true, shadowColor, shadowBlur, paddingH, paddingV, true, null, null, null, null, null, false, null, null, null, null, null, null, null, null, null, null, null, null, style, group, zim.copy(DS));
|
|
31235
|
+
this.zimWindow_constructor(width, height, null, backgroundColor, borderColor, borderWidth, padding, corner, false, scrollBarActive, scrollBarDrag, scrollBarColor, scrollBarAlpha, scrollBarFade, scrollBarH, scrollBarV, false, null, null, false, true, shadowColor, shadowBlur, paddingH, paddingV, true, null, null, null, null, null, false, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, style, group, zim.copy(DS));
|
|
30738
31236
|
this.type = "TextInput";
|
|
30739
31237
|
var that = this;
|
|
30740
31238
|
|
|
@@ -30810,7 +31308,16 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
|
|
|
30810
31308
|
label.onDblclick(e);
|
|
30811
31309
|
e.stopImmediatePropagation();
|
|
30812
31310
|
});
|
|
30813
|
-
|
|
31311
|
+
|
|
31312
|
+
|
|
31313
|
+
function vvp() {
|
|
31314
|
+
if (M && !zot(lastHeight) && WW.visualViewport.height > lastHeight) {
|
|
31315
|
+
that.tiBlur();
|
|
31316
|
+
WW.visualViewport.removeEventListener('resize', vvp);
|
|
31317
|
+
}
|
|
31318
|
+
lastHeight = WW.visualViewport.height;
|
|
31319
|
+
}
|
|
31320
|
+
var lastHeight;
|
|
30814
31321
|
that.label.on("focus", function () {
|
|
30815
31322
|
if (WW.M && keyboardShift) {
|
|
30816
31323
|
if (that.re) that.stage.frame.off("resize", that.re);
|
|
@@ -30820,6 +31327,10 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
|
|
|
30820
31327
|
that.stage.update();
|
|
30821
31328
|
}
|
|
30822
31329
|
});
|
|
31330
|
+
if (WW.visualViewport) {
|
|
31331
|
+
WW.visualViewport.removeEventListener('resize', vvp);
|
|
31332
|
+
WW.visualViewport.addEventListener('resize', vvp);
|
|
31333
|
+
}
|
|
30823
31334
|
var h = that.label.localToGlobal(0,0).y;
|
|
30824
31335
|
if (that.stage && h>that.stage.height/4) {
|
|
30825
31336
|
that.stage.y = that.stage.scaleY*(that.stage.height/4-h);
|
|
@@ -30833,10 +31344,11 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
|
|
|
30833
31344
|
that.dispatchEvent("focus");
|
|
30834
31345
|
});
|
|
30835
31346
|
|
|
30836
|
-
that.
|
|
31347
|
+
that.tiBlur = function() {
|
|
30837
31348
|
if (WW.M && keyboardShift) {
|
|
30838
31349
|
if (that.stage) {
|
|
30839
31350
|
if (that.re) that.stage.frame.off("resize", that.re);
|
|
31351
|
+
that.label.hiddenInput.blur();
|
|
30840
31352
|
that.stage.y = sYO;
|
|
30841
31353
|
that.stage.update();
|
|
30842
31354
|
}
|
|
@@ -30846,7 +31358,8 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
|
|
|
30846
31358
|
if (that.stage) that.stage.update();
|
|
30847
31359
|
}
|
|
30848
31360
|
that.dispatchEvent("blur");
|
|
30849
|
-
}
|
|
31361
|
+
}
|
|
31362
|
+
that.label.on("blur", that.tiBlur);
|
|
30850
31363
|
|
|
30851
31364
|
that.label.on("input", function (e) {
|
|
30852
31365
|
doPlaceholder();
|
|
@@ -31394,7 +31907,7 @@ zim.extend(zim.TextInput.LabelInput, zim.Label, "dispose", "zimLabel", false);
|
|
|
31394
31907
|
|
|
31395
31908
|
|
|
31396
31909
|
/*--
|
|
31397
|
-
zim.List = function(width, height, list, viewNum, vertical, currentSelected, align, valign, labelAlign, labelValign, labelIndent, labelIndentH, labelIndentV, indent, spacing, backgroundColor, rollBackgroundColor, downBackgroundColor, selectedBackgroundColor, selectedRollBackgroundColor, backdropColor, color, rollColor, downColor, selectedColor, selectedRollColor, borderColor, borderWidth, padding, corner, swipe, scrollBarActive, scrollBarDrag, scrollBarColor, scrollBarAlpha, scrollBarFade, scrollBarH, scrollBarV, scrollBarOverlay, slide, slideFactor, slideSnap, slideSnapDamp, shadowColor, shadowBlur, paddingH, paddingV, scrollWheel, damp, titleBar, titleBarColor, titleBarBackgroundColor, titleBarHeight, draggable, boundary, onTop, close, closeColor, collapse, collapseColor, collapsed, excludeCustomTap, organizer, checkBox, pulldown, clone, cancelCurrentDrag, index, noScale, pulldownToggle, optimize, keyEnabled, resizeHandle, resizeBoundary, resizeVisible, continuous, closeOthers, drop, dropTargets, dropColor, dropThickness, dropScrollSpeed, dropReticleAlpha, selectedIndex, style, group, inherit)
|
|
31910
|
+
zim.List = function(width, height, list, viewNum, vertical, currentSelected, align, valign, labelAlign, labelValign, labelIndent, labelIndentH, labelIndentV, indent, spacing, backgroundColor, rollBackgroundColor, downBackgroundColor, selectedBackgroundColor, selectedRollBackgroundColor, backdropColor, color, rollColor, downColor, selectedColor, selectedRollColor, borderColor, borderWidth, padding, corner, swipe, scrollBarActive, scrollBarDrag, scrollBarColor, scrollBarAlpha, scrollBarFade, scrollBarH, scrollBarV, scrollBarOverlay, slide, slideFactor, slideSnap, slideSnapDamp, shadowColor, shadowBlur, paddingH, paddingV, scrollWheel, damp, titleBar, titleBarColor, titleBarBackgroundColor, titleBarHeight, draggable, boundary, onTop, close, closeColor, collapse, collapseColor, collapsed, excludeCustomTap, organizer, checkBox, pulldown, clone, cancelCurrentDrag, index, noScale, pulldownToggle, optimize, keyEnabled, resizeHandle, resizeBoundary, resizeVisible, continuous, closeOthers, drop, dropTargets, dropSelf, dropCopy, dropColor, dropThickness, dropScrollSpeed, dropReticleAlpha, dropHitTest, dropFull, dropSnap, dropEnd, dropScale, dropWidth, dropHeight, selectedIndex, style, group, inherit)
|
|
31398
31911
|
|
|
31399
31912
|
List
|
|
31400
31913
|
zim class - extends a zim.Window which extends a zim.Container which extends a createjs.Container
|
|
@@ -31439,6 +31952,12 @@ Indent only works with custom items in the list in left, right alignment or top,
|
|
|
31439
31952
|
This moves the items away from their alignment
|
|
31440
31953
|
There is also label indenting for items with labels - and labelIndentV and labelIndentH
|
|
31441
31954
|
|
|
31955
|
+
DROP
|
|
31956
|
+
As if ZIM 017, drop parameters and properties have been added.
|
|
31957
|
+
These allow List items to be dragged and dropped within the same list or to other lists or to other objects.
|
|
31958
|
+
Objects not in lists can also be dragged into a list - see the drag() method's drop parameters.
|
|
31959
|
+
See https://zimjs.com/017/dropping.html
|
|
31960
|
+
|
|
31442
31961
|
NOTE: List can have a ZIM Organizer added with the organizer parameter
|
|
31443
31962
|
The organizer lets the user add, remove and move items up, down, to the top or the bottom
|
|
31444
31963
|
See: https://zimjs.com/docs.html?item=organizer
|
|
@@ -31463,7 +31982,6 @@ const list = new List({
|
|
|
31463
31982
|
list:["Enormous", "Big", "Medium", "Small", "Puny"],
|
|
31464
31983
|
viewNum:3, // this number will change the size of the list elements (default is 5)
|
|
31465
31984
|
}).center()
|
|
31466
|
-
S.update();
|
|
31467
31985
|
END EXAMPLE
|
|
31468
31986
|
|
|
31469
31987
|
EXAMPLE
|
|
@@ -31471,6 +31989,7 @@ EXAMPLE
|
|
|
31471
31989
|
// drop is set to true in the STYLE - this means the list can drop its items onto itself
|
|
31472
31990
|
// dropTargets is set after the lists are made - to be able to drop onto other lists
|
|
31473
31991
|
// these two things are separate - items can be dropped onto other lists but not their own, etc.
|
|
31992
|
+
// also see https://zimjs.com/017/dropping.html for dropping to and from outside a list
|
|
31474
31993
|
|
|
31475
31994
|
const w = 60;
|
|
31476
31995
|
const h = 60;
|
|
@@ -31681,10 +32200,10 @@ titleBarHeight - (default fit label) the height of the titleBar if a titleBar is
|
|
|
31681
32200
|
draggable - (default true if titleBar) set to false to not allow dragging titleBar to drag list
|
|
31682
32201
|
boundary - (default null) set to ZIM Boundary() object - or CreateJS.rectangle()
|
|
31683
32202
|
onTop - (default true) set to false to not bring list to top of container when dragging
|
|
31684
|
-
close - (default false)
|
|
31685
|
-
closeColor - (default grey)
|
|
31686
|
-
collapse - (default false)
|
|
31687
|
-
collapseColor - (default grey)
|
|
32203
|
+
close - (default false) a close X for the top right corner that closes the list when pressed
|
|
32204
|
+
closeColor - (default grey) the color of the close X if close is requested
|
|
32205
|
+
collapse - (default false) set to true to add a collapse button to the titleBar that reduces the list so only the bar shows and adds a button to expand
|
|
32206
|
+
collapseColor - (default grey) the color of the collapse icon
|
|
31688
32207
|
collapsed - (default false) set to true to start the list collapsed
|
|
31689
32208
|
excludeCustomTap - (default false) set to true to exclude custom buttons from tap() which would override existing tap() on the custom buttons
|
|
31690
32209
|
organizer - (default null) the ZIM Organizer for the list
|
|
@@ -31698,15 +32217,15 @@ pulldown - (default false) set to true to have List act like a Pulldown
|
|
|
31698
32217
|
use tapClose and offClose parameters to optionally adjust behaviour
|
|
31699
32218
|
See: https://zimjs.com/ten/pulldown.html
|
|
31700
32219
|
clone - (default false) set to true to add clones of the list items rather than the items themselves
|
|
31701
|
-
cancelCurrentDrag - (default false)
|
|
32220
|
+
cancelCurrentDrag - (default false) set to true to cancel window dragging when document window loses focus
|
|
31702
32221
|
this functionality seems to work except if ZIM is being used with Animate - so we have left it turned off by default
|
|
31703
|
-
index - (default 0)
|
|
31704
|
-
noScale - (default false)
|
|
31705
|
-
pulldownToggle - (default false)
|
|
32222
|
+
index - (default 0) set the index at start - set to -1 for no selection
|
|
32223
|
+
noScale - (default false) set to true to not scale custom items - this ignores viewNum
|
|
32224
|
+
pulldownToggle - (default false) set to true to collapse list in pulldown mode when final item is selected or pressing off list
|
|
31706
32225
|
optimize - (default true) set to false to not turn DisplayObjects that are not on the stage visible false
|
|
31707
32226
|
as the Window is scrolled, any objects within the content and any objects within one level of those objects
|
|
31708
32227
|
are set to visible false if their bounds are not hitting the stage bounds
|
|
31709
|
-
resizeHandle - (default false)
|
|
32228
|
+
resizeHandle - (default false) set to true to rollover bottom right corner to resize list with resizeHandle
|
|
31710
32229
|
currently, the List content does not automatically expand
|
|
31711
32230
|
so create the list with a width as wide as it will go
|
|
31712
32231
|
then call the resize() method to start the list at the desired width
|
|
@@ -31718,24 +32237,38 @@ resizeBoundary - (default null) add a ZIM Boundary() object for the resize handl
|
|
|
31718
32237
|
resizeVisible - (default false) set to true to always see the resizeHandle - if resizeHandle is set to true
|
|
31719
32238
|
continuous - (default false) set to true to make the list scroll continuously - should have more elements than the viewNum for this
|
|
31720
32239
|
closeOthers - (default false) set to true to close any open branches before expanding selected branch
|
|
31721
|
-
drop - (default false)
|
|
32240
|
+
drop - (default false) set to true to allow drag and drop of items onto the current list
|
|
31722
32241
|
if the list is vertical, dragging the item horizontally will pull it from the list
|
|
31723
32242
|
the item can then be dragged to a different location and dropped in place
|
|
31724
32243
|
for a horizontal list, dragging the item vertical will pull it from the list
|
|
31725
32244
|
also see the dropTargets parameter and the drop and dropTarget properties
|
|
31726
32245
|
note: the dropTargets alone can be set to drop onto other lists but not the current list
|
|
31727
32246
|
also see updateDrop() method if a list has been moved or scaled
|
|
31728
|
-
dropTargets - (default null)
|
|
32247
|
+
dropTargets - (default null) add a list or an array of lists to drop an item from the current list
|
|
31729
32248
|
see the drop parameter and the drop and dropTargets properties
|
|
31730
32249
|
note: dropTargets can be set without setting the drop parameter to true
|
|
31731
32250
|
and then items can be dragged to the target lists but not onto the current list
|
|
31732
32251
|
also see updateDrop() method if a list has been moved or scaled
|
|
31733
|
-
|
|
31734
|
-
|
|
31735
|
-
|
|
32252
|
+
dropSelf - (default true) set to false to not drop on itself if drop is true
|
|
32253
|
+
dropCopy - (default false) set to true to drop a copy
|
|
32254
|
+
dropColor - (default white) the color of the diamond reticle that indicates where an item will be dropped
|
|
32255
|
+
dropThickness - (default 1) the thickness of the diamond reticle that indicates where an item will be dropped
|
|
32256
|
+
dropScrollSpeed - (default 5) the speed the list is scrolled as a drop item is dragged up to 50px off an end of the list
|
|
31736
32257
|
this is only applied if the list scrolls on that end
|
|
31737
32258
|
the speed is multiplied by 1.5 when the item is between 50px and 80px off the end
|
|
31738
|
-
dropReticleAlpha - (default 1)
|
|
32259
|
+
dropReticleAlpha - (default 1) set the alpha of the drop reticle diamond - set to 0 to not show reticle
|
|
32260
|
+
dropScale - (default null) set a scale when dropped
|
|
32261
|
+
dropWidth - (default null) set a width when dropped - overrides scale
|
|
32262
|
+
height will keep proportion unless both dropWidth and dropHeight are provided
|
|
32263
|
+
dropHeight - (default null) set a height when dropped - overrides scale
|
|
32264
|
+
width will keep proportion unless both dropWidth and dropHeight are provided
|
|
32265
|
+
*** Drop parameters that work only when dropping on a dropTarget that is NOT a List
|
|
32266
|
+
dropHitTest - (default "bounds") can also be "reg", "circles", "circle", "rect" - see ZIM HitTests
|
|
32267
|
+
dropFull - (default true) do not drop on a full target
|
|
32268
|
+
note - if the object is removed from the target then a drop can occur again on that target
|
|
32269
|
+
dropSnap - (default true) snap to the target object
|
|
32270
|
+
dropEnd - (default true) once dropped on a target a noMouse() is set on the object
|
|
32271
|
+
*** End drop parameters that work only when dropping on a target that is NOT a List
|
|
31739
32272
|
selectedIndex - same as index, kept in for backwards compatibility in ZIM DUO
|
|
31740
32273
|
style - (default true) set to false to ignore styles set with the STYLE - will receive original parameter defaults
|
|
31741
32274
|
group - (default null) set to String (or comma delimited String) so STYLE can set default styles to the group(s) (like a CSS class)
|
|
@@ -31870,10 +32403,16 @@ dropReticle - each list that can be dropped on gets a dropReticle property that
|
|
|
31870
32403
|
so individual reticles can be adjusted - say different colors for different lists
|
|
31871
32404
|
dropItem - after a dropdown event, the dropItem is the ghost being dragged
|
|
31872
32405
|
dropIndex - after a dropdown event, the dropIndex is the original index of the item being dragged
|
|
31873
|
-
|
|
32406
|
+
dropTarget - after a dropup event, the dropTarget is the object the item was dropped into (could be original list)
|
|
31874
32407
|
dropNewIndex - after a dropup event, the dropNewIndex is the index in the list the item has been dropped
|
|
31875
32408
|
enabled - default is true - set to false to disable
|
|
31876
32409
|
|
|
32410
|
+
DROP ITEM PROPERTIES
|
|
32411
|
+
dropTarget - is the target dropped on
|
|
32412
|
+
dropList - is list item came from
|
|
32413
|
+
|
|
32414
|
+
// dropEnd should not be false if dropBack is true - when dropping from a list
|
|
32415
|
+
|
|
31877
32416
|
ALSO: see all Window properties - like titleBar, titleBarLabel, resizeHandle, etc.
|
|
31878
32417
|
|
|
31879
32418
|
ALSO: see ZIM Container for properties such as:
|
|
@@ -31892,17 +32431,18 @@ dispatches an "expanded" event when items have been expanded
|
|
|
31892
32431
|
this receives an event object with an items property of the items just opened
|
|
31893
32432
|
dispatches a "collapsed" event when items have been collapsed
|
|
31894
32433
|
dispatches a "dropdown" event when drop item is pulled from list
|
|
31895
|
-
list will have dropItem and dropIndex properties
|
|
32434
|
+
list will have dropItem and dropIndex properties
|
|
31896
32435
|
dispatches a "dropup" event when drop item is dropped
|
|
31897
|
-
list will have dropItem,
|
|
32436
|
+
list will have dropItem, dropTarget and dropNewIndex properties
|
|
32437
|
+
item dropped will have dropList for which list it came from and dropTarget for which object it is dropped on
|
|
31898
32438
|
|
|
31899
32439
|
ALSO: All Window events including "scrolling"
|
|
31900
32440
|
|
|
31901
32441
|
ALSO: see the CreateJS Easel Docs for Container events such as:
|
|
31902
32442
|
added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmove, pressup, removed, rollout, rollover
|
|
31903
32443
|
--*///+60.5
|
|
31904
|
-
zim.List = function(width, height, list, viewNum, vertical, currentSelected, align, valign, labelAlign, labelValign, labelIndent, labelIndentH, labelIndentV, indent, spacing, backgroundColor, rollBackgroundColor, downBackgroundColor, selectedBackgroundColor, selectedRollBackgroundColor, backdropColor, color, rollColor, downColor, selectedColor, selectedRollColor, borderColor, borderWidth, padding, corner, swipe, scrollBarActive, scrollBarDrag, scrollBarColor, scrollBarAlpha, scrollBarFade, scrollBarH, scrollBarV, scrollBarOverlay, slide, slideFactor, slideSnap, slideSnapDamp, shadowColor, shadowBlur, paddingH, paddingV, scrollWheel, damp, titleBar, titleBarColor, titleBarBackgroundColor, titleBarHeight, draggable, boundary, onTop, close, closeColor, collapse, collapseColor, collapsed, excludeCustomTap, organizer, checkBox, pulldown, clone, cancelCurrentDrag, index, noScale, pulldownToggle, optimize, keyEnabled, resizeHandle, resizeBoundary, resizeVisible, continuous, closeOthers, drop, dropTargets, dropColor, dropThickness, dropScrollSpeed, dropReticleAlpha, selectedIndex, style, group, inherit) {
|
|
31905
|
-
var sig = "width, height, list, viewNum, vertical, currentSelected, align, valign, labelAlign, labelValign, labelIndent, labelIndentH, labelIndentV, indent, spacing, backgroundColor, rollBackgroundColor, downBackgroundColor, selectedBackgroundColor, selectedRollBackgroundColor, backdropColor, color, rollColor, downColor, selectedColor, selectedRollColor, borderColor, borderWidth, padding, corner, swipe, scrollBarActive, scrollBarDrag, scrollBarColor, scrollBarAlpha, scrollBarFade, scrollBarH, scrollBarV, scrollBarOverlay, slide, slideFactor, slideSnap, slideSnapDamp, shadowColor, shadowBlur, paddingH, paddingV, scrollWheel, damp, titleBar, titleBarColor, titleBarBackgroundColor, titleBarHeight, draggable, boundary, onTop, close, closeColor, collapse, collapseColor, collapsed, excludeCustomTap, organizer, checkBox, pulldown, clone, cancelCurrentDrag, index, noScale, pulldownToggle, optimize, keyEnabled, resizeHandle, resizeBoundary, resizeVisible, continuous, closeOthers, drop, dropTargets, dropColor, dropThickness, dropScrollSpeed, dropReticleAlpha, selectedIndex, style, group, inherit";
|
|
32444
|
+
zim.List = function(width, height, list, viewNum, vertical, currentSelected, align, valign, labelAlign, labelValign, labelIndent, labelIndentH, labelIndentV, indent, spacing, backgroundColor, rollBackgroundColor, downBackgroundColor, selectedBackgroundColor, selectedRollBackgroundColor, backdropColor, color, rollColor, downColor, selectedColor, selectedRollColor, borderColor, borderWidth, padding, corner, swipe, scrollBarActive, scrollBarDrag, scrollBarColor, scrollBarAlpha, scrollBarFade, scrollBarH, scrollBarV, scrollBarOverlay, slide, slideFactor, slideSnap, slideSnapDamp, shadowColor, shadowBlur, paddingH, paddingV, scrollWheel, damp, titleBar, titleBarColor, titleBarBackgroundColor, titleBarHeight, draggable, boundary, onTop, close, closeColor, collapse, collapseColor, collapsed, excludeCustomTap, organizer, checkBox, pulldown, clone, cancelCurrentDrag, index, noScale, pulldownToggle, optimize, keyEnabled, resizeHandle, resizeBoundary, resizeVisible, continuous, closeOthers, drop, dropTargets, dropSelf, dropCopy, dropColor, dropThickness, dropScrollSpeed, dropReticleAlpha, dropHitTest, dropFull, dropSnap, dropEnd, dropScale, dropWidth, dropHeight, selectedIndex, style, group, inherit) {
|
|
32445
|
+
var sig = "width, height, list, viewNum, vertical, currentSelected, align, valign, labelAlign, labelValign, labelIndent, labelIndentH, labelIndentV, indent, spacing, backgroundColor, rollBackgroundColor, downBackgroundColor, selectedBackgroundColor, selectedRollBackgroundColor, backdropColor, color, rollColor, downColor, selectedColor, selectedRollColor, borderColor, borderWidth, padding, corner, swipe, scrollBarActive, scrollBarDrag, scrollBarColor, scrollBarAlpha, scrollBarFade, scrollBarH, scrollBarV, scrollBarOverlay, slide, slideFactor, slideSnap, slideSnapDamp, shadowColor, shadowBlur, paddingH, paddingV, scrollWheel, damp, titleBar, titleBarColor, titleBarBackgroundColor, titleBarHeight, draggable, boundary, onTop, close, closeColor, collapse, collapseColor, collapsed, excludeCustomTap, organizer, checkBox, pulldown, clone, cancelCurrentDrag, index, noScale, pulldownToggle, optimize, keyEnabled, resizeHandle, resizeBoundary, resizeVisible, continuous, closeOthers, drop, dropTargets, dropSelf, dropCopy, dropColor, dropThickness, dropScrollSpeed, dropReticleAlpha, dropHitTest, dropFull, dropSnap, dropEnd, dropScale, dropWidth, dropHeight, selectedIndex, style, group, inherit";
|
|
31906
32446
|
var duo; if (duo = zob(zim.List, arguments, sig, this)) return duo;
|
|
31907
32447
|
z_d("60.5");
|
|
31908
32448
|
|
|
@@ -31997,11 +32537,22 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
31997
32537
|
|
|
31998
32538
|
if (zot(drop)) drop = DS.drop!=null?DS.drop:false;
|
|
31999
32539
|
if (zot(dropTargets)) dropTargets = DS.dropTargets!=null?DS.dropTargets:null;
|
|
32540
|
+
if (zot(dropSelf)) dropSelf = DS.dropSelf!=null?DS.dropSelf:true;
|
|
32541
|
+
if (zot(dropCopy)) dropCopy = DS.dropCopy!=null?DS.dropCopy:false;
|
|
32000
32542
|
if (zot(dropColor)) dropColor = DS.dropColor!=null?DS.dropColor:zim.white;
|
|
32001
32543
|
if (zot(dropThickness)) dropThickness = DS.dropThickness!=null?DS.dropThickness:1;
|
|
32002
32544
|
if (zot(dropScrollSpeed)) dropScrollSpeed = DS.dropScrollSpeed!=null?DS.dropScrollSpeed:5;
|
|
32003
32545
|
if (zot(dropReticleAlpha)) dropReticleAlpha = DS.dropReticleAlpha!=null?DS.dropReticleAlpha:1;
|
|
32004
32546
|
|
|
32547
|
+
// Drop off list
|
|
32548
|
+
if (zot(dropHitTest)) dropHitTest = DS.dropHitTest!=null?DS.dropHitTest:"bounds";
|
|
32549
|
+
if (zot(dropSnap)) dropSnap = DS.dropSnap!=null?DS.dropSnap:true;
|
|
32550
|
+
if (zot(dropFull)) dropFull = DS.dropFull!=null?DS.dropFull:true;
|
|
32551
|
+
if (zot(dropEnd)) dropEnd = DS.dropEnd!=null?DS.dropEnd:true;
|
|
32552
|
+
if (zot(dropScale)) dropScale = DS.dropScale!=null?DS.dropScale:null;
|
|
32553
|
+
if (zot(dropWidth)) dropWidth = DS.dropWidth!=null?DS.dropWidth:null;
|
|
32554
|
+
if (zot(dropHeight)) dropHeight = DS.dropHeight!=null?DS.dropHeight:null;
|
|
32555
|
+
|
|
32005
32556
|
|
|
32006
32557
|
if (titleBar === false) titleBar = null;
|
|
32007
32558
|
this.vertical = vertical;
|
|
@@ -32678,7 +33229,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
32678
33229
|
// drop and dropTargets are assigned independently but both are added to dropTargets array
|
|
32679
33230
|
if (dropTargets && !Array.isArray(dropTargets)) dropTargets = [dropTargets];
|
|
32680
33231
|
if (!dropTargets) dropTargets = [];
|
|
32681
|
-
if (drop) dropTargets.unshift(that);
|
|
33232
|
+
if (drop && dropSelf) dropTargets.unshift(that);
|
|
32682
33233
|
|
|
32683
33234
|
that.added(function(stage) {
|
|
32684
33235
|
frame = stage.frame;
|
|
@@ -32697,7 +33248,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
32697
33248
|
// e.target can be something in the item - or the item
|
|
32698
33249
|
// but custom List items are usually in a Container
|
|
32699
33250
|
// so want to drag the item which is the child of the container that is in the List items
|
|
32700
|
-
if (!that.items.includes(downItem)) {
|
|
33251
|
+
if (!that.items.includes(downItem)) {
|
|
32701
33252
|
var good = false;
|
|
32702
33253
|
var checkItem = downItem
|
|
32703
33254
|
while(checkItem.parent) {
|
|
@@ -32710,6 +33261,9 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
32710
33261
|
}
|
|
32711
33262
|
if (!good) return;
|
|
32712
33263
|
}
|
|
33264
|
+
// watch - the List item container has a backing rectangle that has a parent that is in the items
|
|
33265
|
+
// so get the parent but then get the content
|
|
33266
|
+
if (that.items.includes(downItem.parent)) downItem = downItem.parent.content;
|
|
32713
33267
|
downPoint = that.globalToLocal(frame.mouseX, frame.mouseY);
|
|
32714
33268
|
itemPoint = downItem.globalToLocal(frame.mouseX, frame.mouseY);
|
|
32715
33269
|
itemIndex = zot(checkItem.znum) ? checkItem.parent.znum : checkItem.znum;
|
|
@@ -32719,45 +33273,6 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
32719
33273
|
that.dropNewIndex = null;
|
|
32720
33274
|
});
|
|
32721
33275
|
|
|
32722
|
-
function scrollUp(target, dropScrollSpeed) {
|
|
32723
|
-
if (target.scrollInt) target.scrollInt.clear();
|
|
32724
|
-
target.scrollInt = zim.interval(.01, function() {
|
|
32725
|
-
if (target.dropReticle.parent) target.dropReticle.removeFrom();
|
|
32726
|
-
if (target.vertical) {
|
|
32727
|
-
target.scrollY += dropScrollSpeed;
|
|
32728
|
-
if (target.scrollY > 0) {
|
|
32729
|
-
target.scrollY = 0;
|
|
32730
|
-
target.scrollInt.clear();
|
|
32731
|
-
}
|
|
32732
|
-
} else {
|
|
32733
|
-
target.scrollX += dropScrollSpeed;
|
|
32734
|
-
if (target.scrollX > 0) {
|
|
32735
|
-
target.scrollX = 0;
|
|
32736
|
-
target.scrollInt.clear();
|
|
32737
|
-
}
|
|
32738
|
-
}
|
|
32739
|
-
}, null, null, null, "seconds");
|
|
32740
|
-
}
|
|
32741
|
-
|
|
32742
|
-
function scrollDown(target, dropScrollSpeed) {
|
|
32743
|
-
if (target.scrollInt) target.scrollInt.clear();
|
|
32744
|
-
target.scrollInt = zim.interval(.01, function() {
|
|
32745
|
-
if (target.dropReticle.parent) target.dropReticle.removeFrom();
|
|
32746
|
-
if (target.vertical) {
|
|
32747
|
-
target.scrollY -= dropScrollSpeed;
|
|
32748
|
-
if (target.scrollY < -target.scrollYMax) {
|
|
32749
|
-
target.scrollY = -target.scrollYMax;
|
|
32750
|
-
target.scrollInt.clear();
|
|
32751
|
-
}
|
|
32752
|
-
} else {
|
|
32753
|
-
target.scrollX -= dropScrollSpeed;
|
|
32754
|
-
if (target.scrollX < -target.scrollXMax) {
|
|
32755
|
-
target.scrollX = -target.scrollXMax;
|
|
32756
|
-
target.scrollInt.clear();
|
|
32757
|
-
}
|
|
32758
|
-
}
|
|
32759
|
-
}, null, null, null, "seconds");
|
|
32760
|
-
}
|
|
32761
33276
|
|
|
32762
33277
|
that.dropMove = that.on("pressmove", function() {
|
|
32763
33278
|
if (ghost || !downPoint) return;
|
|
@@ -32774,179 +33289,86 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
32774
33289
|
) {
|
|
32775
33290
|
that.cancelCurrentDrag();
|
|
32776
33291
|
var sc = downItem.getConcatenatedDisplayProps().matrix.decompose().scaleX/F.stage.scaleX; // sigh
|
|
32777
|
-
ghost = downItem.clone().reg(itemPoint.x, itemPoint.y).sca(sc).alp(.5); //.sha("rgba(0,0,0,.3)",5,5,5);
|
|
33292
|
+
ghost = downItem.clone(true).reg(itemPoint.x, itemPoint.y).sca(sc).alp(.5); //.sha("rgba(0,0,0,.3)",5,5,5);
|
|
32778
33293
|
that.dropItem = ghost;
|
|
32779
33294
|
that.dropIndex = itemIndex;
|
|
32780
33295
|
that.dropStage = frame.stage.on("stagemousemove", function(){
|
|
32781
|
-
ghost.loc(frame.mouseX, frame.mouseY)
|
|
32782
|
-
|
|
33296
|
+
ghost.loc(frame.mouseX, frame.mouseY);
|
|
32783
33297
|
// scroll if ghost is at edges of scrollable list
|
|
32784
|
-
|
|
32785
|
-
zim.loop(dropTargets, function(target) {
|
|
32786
|
-
if (target.type != "List") return;
|
|
32787
|
-
if (onCheck) {
|
|
32788
|
-
if (target.scrollInt) target.scrollInt.clear();
|
|
32789
|
-
target.dropReticle.removeFrom();
|
|
32790
|
-
target.dropReticleIndex = null;
|
|
32791
|
-
return; // next in loop
|
|
32792
|
-
}
|
|
32793
|
-
if (target.vertical) {
|
|
32794
|
-
if (target.scrollYMax > 0) {
|
|
32795
|
-
if (ghost.x > target.zgb.x && ghost.x < target.zgb.x + target.zgb.width) {
|
|
32796
|
-
if (ghost.y < target.zgb.y) { // carefull - need to do these separately to turn off diamond
|
|
32797
|
-
if (ghost.y > target.zgbtarget.zgb.y - 50) scrollUp(target, dropScrollSpeed);
|
|
32798
|
-
else if (ghost.y > target.zgbtarget.zgb.y - 80) scrollUp(target, dropScrollSpeed*1.5);
|
|
32799
|
-
onCheck = true;
|
|
32800
|
-
} else if (ghost.y > target.zgbtarget.zgb.y + target.zgbtarget.zgb.height) {
|
|
32801
|
-
if (ghost.y < target.zgbtarget.zgb.y + target.zgbtarget.zgb.height + 50) scrollDown(target, dropScrollSpeed);
|
|
32802
|
-
else if (ghost.y < target.zgbtarget.zgb.y + target.zgbtarget.zgb.height + 80) scrollDown(target, dropScrollSpeed*1.5);
|
|
32803
|
-
onCheck = true;
|
|
32804
|
-
} else if (target.scrollInt) target.scrollInt.clear();
|
|
32805
|
-
} else {
|
|
32806
|
-
if (target.scrollInt) target.scrollInt.clear();
|
|
32807
|
-
}
|
|
32808
|
-
}
|
|
32809
|
-
} else {
|
|
32810
|
-
if (target.scrollXMax > 0) {
|
|
32811
|
-
if (ghost.y > target.zgb.y && ghost.y < target.zgb.y + target.zgb.height) {
|
|
32812
|
-
if (ghost.x < target.zgb.x) {
|
|
32813
|
-
if (ghost.x > target.zgb.x - 50) scrollUp(target, dropScrollSpeed);
|
|
32814
|
-
else if (ghost.x > target.zgb.x - 80) scrollUp(target, dropScrollSpeed*1.5);
|
|
32815
|
-
onCheck = true;
|
|
32816
|
-
} else if (ghost.x > target.zgb.x + target.zgb.width) {
|
|
32817
|
-
if (ghost.x < target.zgb.x + target.zgb.width + 50) scrollDown(target, dropScrollSpeed);
|
|
32818
|
-
else if (ghost.x < target.zgb.x + target.zgb.width + 80) scrollDown(target, dropScrollSpeed*1.5);
|
|
32819
|
-
onCheck = true;
|
|
32820
|
-
} else if (target.scrollInt) target.scrollInt.clear();
|
|
32821
|
-
} else {
|
|
32822
|
-
if (target.scrollInt) target.scrollInt.clear();
|
|
32823
|
-
}
|
|
32824
|
-
}
|
|
32825
|
-
}
|
|
32826
|
-
|
|
32827
|
-
// place reticle
|
|
32828
|
-
if (target.hitTestReg(ghost)) {
|
|
32829
|
-
onCheck = true;
|
|
32830
|
-
var point = target.tabs.globalToLocal(ghost.x, ghost.y);
|
|
32831
|
-
var item = target.tabs.getObjectUnderPoint(point.x, point.y, 1);
|
|
32832
|
-
var yy;
|
|
32833
|
-
var xx;
|
|
32834
|
-
var bounds;
|
|
32835
|
-
if (item) {
|
|
32836
|
-
checkItem = item;
|
|
32837
|
-
var good = target.items.includes(checkItem);
|
|
32838
|
-
if (zot(item.znum)) {
|
|
32839
|
-
while(checkItem.parent) {
|
|
32840
|
-
if (target.items.includes(checkItem.parent)) {
|
|
32841
|
-
good = true;
|
|
32842
|
-
item = checkItem.parent;
|
|
32843
|
-
break;
|
|
32844
|
-
}
|
|
32845
|
-
checkItem = checkItem.parent;
|
|
32846
|
-
}
|
|
32847
|
-
}
|
|
32848
|
-
if (!good) return;
|
|
32849
|
-
bounds = item.boundsToGlobal();
|
|
32850
|
-
|
|
32851
|
-
// target.dropReticle.visible = true;
|
|
32852
|
-
// if (checkItem == downItem) target.dropReticle.visible = false;
|
|
32853
|
-
|
|
32854
|
-
if (target.vertical) {
|
|
32855
|
-
if (ghost.y > bounds.y + bounds.height/2) {
|
|
32856
|
-
yy = bounds.y + bounds.height + target.spacing*target.zgs/2;
|
|
32857
|
-
if (yy > target.zgb.y && yy < target.zgb.y + target.zgb.height) {
|
|
32858
|
-
target.dropReticle.loc(bounds.x + bounds.width/2, yy);
|
|
32859
|
-
target.dropReticleIndex = item.znum + 1;
|
|
32860
|
-
}
|
|
32861
|
-
} else {
|
|
32862
|
-
yy = bounds.y - target.spacing*target.zgs/2;
|
|
32863
|
-
if (yy > target.zgb.y && yy < target.zgb.y + target.zgb.height) {
|
|
32864
|
-
target.dropReticle.loc(bounds.x + bounds.width/2, yy);
|
|
32865
|
-
target.dropReticleIndex = item.znum;
|
|
32866
|
-
}
|
|
32867
|
-
}
|
|
32868
|
-
} else {
|
|
32869
|
-
if (ghost.x > bounds.x + bounds.width/2) {
|
|
32870
|
-
xx = bounds.x + bounds.width + target.spacing*target.zgs/2;
|
|
32871
|
-
if (xx > target.zgb.x && xx < target.zgb.x + target.zgb.width) {
|
|
32872
|
-
target.dropReticle.loc(xx, bounds.y + bounds.height/2);
|
|
32873
|
-
target.dropReticleIndex = item.znum + 1;
|
|
32874
|
-
}
|
|
32875
|
-
} else {
|
|
32876
|
-
xx = bounds.x - target.spacing*target.zgs/2;
|
|
32877
|
-
if (xx > target.zgb.x && xx < target.zgb.x + target.zgb.width) {
|
|
32878
|
-
target.dropReticle.loc(xx, bounds.y + bounds.height/2);
|
|
32879
|
-
target.dropReticleIndex = item.znum;
|
|
32880
|
-
}
|
|
32881
|
-
}
|
|
32882
|
-
}
|
|
32883
|
-
} else {
|
|
32884
|
-
if (target.items.length > 0) {
|
|
32885
|
-
bounds = target.items[target.items.length-1].boundsToGlobal();
|
|
32886
|
-
if (target.vertical) {
|
|
32887
|
-
if (ghost.y > bounds.y + bounds.height) {
|
|
32888
|
-
yy = bounds.y + bounds.height + target.spacing*target.zgs/2;
|
|
32889
|
-
target.dropReticle.loc(target.zgb.x + target.zgb.width/2, yy);
|
|
32890
|
-
target.dropReticleIndex = target.items.length;
|
|
32891
|
-
} else {
|
|
32892
|
-
target.dropReticle.removeFrom();
|
|
32893
|
-
target.dropReticleIndex = null;
|
|
32894
|
-
}
|
|
32895
|
-
} else {
|
|
32896
|
-
if (ghost.x > bounds.x + bounds.width) {
|
|
32897
|
-
xx = bounds.x + bounds.width + target.spacing*target.zgs/2;
|
|
32898
|
-
target.dropReticle.loc(xx, target.zgb.y + target.zgb.height/2);
|
|
32899
|
-
target.dropReticleIndex = target.items.length;
|
|
32900
|
-
} else {
|
|
32901
|
-
target.dropReticle.removeFrom();
|
|
32902
|
-
target.dropReticleIndex = null;
|
|
32903
|
-
}
|
|
32904
|
-
}
|
|
32905
|
-
} else {
|
|
32906
|
-
if (target.vertical) {
|
|
32907
|
-
yy = target.zgb.y + target.spacing*target.zgs/2;
|
|
32908
|
-
target.dropReticle.loc(target.zgb.x + target.zgb.width/2, yy);
|
|
32909
|
-
target.dropReticleIndex = 0;
|
|
32910
|
-
} else {
|
|
32911
|
-
xx = target.zgb.x + target.spacing*target.zgs/2;
|
|
32912
|
-
target.dropReticle.loc(xx, target.zgb.y + target.zgb.height/2);
|
|
32913
|
-
target.dropReticleIndex = 0;
|
|
32914
|
-
}
|
|
32915
|
-
}
|
|
32916
|
-
}
|
|
32917
|
-
} else {
|
|
32918
|
-
target.dropReticle.removeFrom();
|
|
32919
|
-
target.dropReticleIndex = null;
|
|
32920
|
-
}
|
|
32921
|
-
});
|
|
33298
|
+
zim.List.doDropOver(dropTargets, ghost, checkItem, dropScrollSpeed);
|
|
32922
33299
|
});
|
|
32923
33300
|
|
|
32924
33301
|
that.dispatchEvent("dropdown");
|
|
32925
33302
|
|
|
32926
33303
|
// frame.on("mouseupplus", smu, null, true); // once - but does not work with touch
|
|
32927
|
-
|
|
32928
|
-
frame.stage.on("stagemouseup", smu, null, true); // once - seems to be working on iframes, etc.
|
|
33304
|
+
that.pointerUpEvent = frame.on("pointerup", smu); // pointer does not have a once!
|
|
33305
|
+
// frame.stage.on("stagemouseup", smu, null, true); // once - seems to be working on iframes, etc.
|
|
32929
33306
|
function smu() {
|
|
32930
33307
|
frame.off("pointerup", that.pointerUpEvent)
|
|
32931
33308
|
frame.stage.off("stagemousemove", that.dropStage);
|
|
32932
33309
|
|
|
32933
33310
|
var empty = zim.loop(dropTargets, function(target) {
|
|
32934
|
-
if (target.type != "List")
|
|
33311
|
+
if (target.type != "List") {
|
|
33312
|
+
|
|
33313
|
+
// DROPPING OUTSIDE LIST
|
|
33314
|
+
|
|
33315
|
+
if (ghost["hitTest"+String(dropHitTest).charAt(0).toUpperCase() + String(dropHitTest).slice(1)](target)) {
|
|
33316
|
+
|
|
33317
|
+
if (!dropFull || !target.dropFull) {
|
|
33318
|
+
downItem.alpha = itemAlpha;
|
|
33319
|
+
if (!dropCopy) that.removeAt(1,itemIndex);
|
|
33320
|
+
ghost.reg(downItem.regX, downItem.regY, true);
|
|
33321
|
+
if (dropSnap) ghost.loc(target);
|
|
33322
|
+
if (dropScale) ghost.sca(dropScale);
|
|
33323
|
+
if (dropWidth || dropHeight) ghost.siz(dropWidth, dropHeight);
|
|
33324
|
+
if (dropEnd) ghost.noMouse();
|
|
33325
|
+
if (dropFull) target.dropFull = true;
|
|
33326
|
+
ghost.droppedTarget = target;
|
|
33327
|
+
ghost.dropClone = true;
|
|
33328
|
+
ghost.dropList = that;
|
|
33329
|
+
ghost.dropTarget = target;
|
|
33330
|
+
ghost.alpha = itemAlpha;
|
|
33331
|
+
|
|
33332
|
+
ghost.dropStartX = downItem.dropStartX;
|
|
33333
|
+
ghost.dropStartY = downItem.dropStartY;
|
|
33334
|
+
ghost.dropStartS = downItem.dropStartS;
|
|
33335
|
+
|
|
33336
|
+
that.dropItem = ghost;
|
|
33337
|
+
that.dropTarget = target;
|
|
33338
|
+
ghost = null;
|
|
33339
|
+
downPoint = null;
|
|
33340
|
+
downItem = null;
|
|
33341
|
+
return false;
|
|
33342
|
+
}
|
|
33343
|
+
}
|
|
33344
|
+
return;
|
|
33345
|
+
}
|
|
32935
33346
|
if (target.scrollInt) target.scrollInt.clear();
|
|
32936
33347
|
if (!zot(target.dropReticleIndex)) {
|
|
32937
33348
|
target.dropReticle.removeFrom();
|
|
32938
|
-
that.removeAt(1,itemIndex);
|
|
33349
|
+
if (!dropCopy) that.removeAt(1,itemIndex);
|
|
32939
33350
|
|
|
32940
33351
|
if (itemIndex < target.dropReticleIndex && that == target) target.dropReticleIndex--;
|
|
32941
|
-
|
|
33352
|
+
|
|
33353
|
+
if (dropCopy) {
|
|
33354
|
+
target.addAt(ghost, target.dropReticleIndex);
|
|
33355
|
+
ghost.alpha = itemAlpha;
|
|
33356
|
+
ghost.dropList = that;
|
|
33357
|
+
ghost.dropTarget = target;
|
|
33358
|
+
that.dropItem = ghost;
|
|
33359
|
+
} else {
|
|
33360
|
+
target.addAt(downItem, target.dropReticleIndex);
|
|
33361
|
+
downItem.dropList = that;
|
|
33362
|
+
downItem.dropTarget = target;
|
|
33363
|
+
that.dropItem = downItem;
|
|
33364
|
+
ghost.dispose();
|
|
33365
|
+
}
|
|
33366
|
+
ghost = null;
|
|
32942
33367
|
|
|
32943
|
-
ghost.dispose();
|
|
32944
33368
|
downItem.alpha = itemAlpha;
|
|
32945
|
-
ghost = null;
|
|
32946
33369
|
downPoint = null;
|
|
32947
|
-
|
|
32948
|
-
that.
|
|
32949
|
-
that.dropList = target;
|
|
33370
|
+
|
|
33371
|
+
that.dropTarget = target;
|
|
32950
33372
|
that.dropNewIndex = target.dropReticleIndex;
|
|
32951
33373
|
target.dropReticleIndex = null;
|
|
32952
33374
|
downItem = null;
|
|
@@ -32967,10 +33389,11 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
32967
33389
|
})
|
|
32968
33390
|
that.dropItem = downItem;
|
|
32969
33391
|
that.dropList = that;
|
|
33392
|
+
that.dropTarget = null;
|
|
32970
33393
|
that.dropNewIndex = that.dropIndex;
|
|
32971
33394
|
}
|
|
32972
33395
|
that.dispatchEvent("dropup");
|
|
32973
|
-
|
|
33396
|
+
that.stage.update();
|
|
32974
33397
|
|
|
32975
33398
|
}
|
|
32976
33399
|
downItem.alp(.5);
|
|
@@ -33339,7 +33762,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
33339
33762
|
|
|
33340
33763
|
if (style!==false) zim.styleTransforms(this, DS);
|
|
33341
33764
|
this.clone = function() {
|
|
33342
|
-
return that.cloneProps(new zim.List(width, originalHeight, zim.copy(that.originalList, true), viewNum, vertical, currentSelected, align, valign, labelAlign, labelValign, labelIndent, labelIndentH, labelIndentV, indent, spacing, backgroundColor, rollBackgroundColor, downBackgroundColor, selectedBackgroundColor, selectedRollBackgroundColor, backdropColor, color, rollColor, downColor, selectedColor, selectedRollColor, originalBorderColor, originalBorderWidth, padding, zim.copy(corner), swipe, scrollBarActive, scrollBarDrag, scrollBarColor, scrollBarAlpha, scrollBarFade, scrollBarH, scrollBarV, scrollBarOverlay, slide, slideFactor, slideSnap, slideSnapDamp, shadowColor, shadowBlur, paddingH, paddingV, scrollWheel, damp, titleBar, titleBarColor, titleBarBackgroundColor, titleBarHeight, draggable, boundary, onTop, close, closeColor, collapse, collapseColor, collapsed, excludeCustomTap, organizer, checkBox, pulldown, clone, cancelCurrentDrag, index, noScale, pulldownToggle, optimize, keyEnabled, resizeHandle, resizeBoundary, resizeVisible, continuous, closeOthers, drop, dropTargets, dropColor, dropThickness, dropScrollSpeed, dropReticleAlpha, selectedIndex, style, this.group, inherit));
|
|
33765
|
+
return that.cloneProps(new zim.List(width, originalHeight, zim.copy(that.originalList, true), viewNum, vertical, currentSelected, align, valign, labelAlign, labelValign, labelIndent, labelIndentH, labelIndentV, indent, spacing, backgroundColor, rollBackgroundColor, downBackgroundColor, selectedBackgroundColor, selectedRollBackgroundColor, backdropColor, color, rollColor, downColor, selectedColor, selectedRollColor, originalBorderColor, originalBorderWidth, padding, zim.copy(corner), swipe, scrollBarActive, scrollBarDrag, scrollBarColor, scrollBarAlpha, scrollBarFade, scrollBarH, scrollBarV, scrollBarOverlay, slide, slideFactor, slideSnap, slideSnapDamp, shadowColor, shadowBlur, paddingH, paddingV, scrollWheel, damp, titleBar, titleBarColor, titleBarBackgroundColor, titleBarHeight, draggable, boundary, onTop, close, closeColor, collapse, collapseColor, collapsed, excludeCustomTap, organizer, checkBox, pulldown, clone, cancelCurrentDrag, index, noScale, pulldownToggle, optimize, keyEnabled, resizeHandle, resizeBoundary, resizeVisible, continuous, closeOthers, drop, dropTargets, dropSelf, dropCopy, dropColor, dropThickness, dropScrollSpeed, dropReticleAlpha, dropHitTest, dropFull, dropSnap, dropEnd, dropScale, dropWidth, dropHeight, selectedIndex, style, this.group, inherit));
|
|
33343
33766
|
};
|
|
33344
33767
|
this.dispose = function(a,b,disposing) {
|
|
33345
33768
|
if (!disposing) {
|
|
@@ -33353,6 +33776,188 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
33353
33776
|
};
|
|
33354
33777
|
zim.extend(zim.List, zim.Window, ["clone","dispose"], "zimWindow", false);
|
|
33355
33778
|
|
|
33779
|
+
|
|
33780
|
+
zim.List.scrollUp = function(target, dropScrollSpeed) {
|
|
33781
|
+
if (target.scrollInt) target.scrollInt.clear();
|
|
33782
|
+
target.scrollInt = zim.interval(.01, function() {
|
|
33783
|
+
if (target.dropReticle.parent) target.dropReticle.removeFrom();
|
|
33784
|
+
if (target.vertical) {
|
|
33785
|
+
target.scrollY += dropScrollSpeed;
|
|
33786
|
+
if (target.scrollY > 0) {
|
|
33787
|
+
target.scrollY = 0;
|
|
33788
|
+
target.scrollInt.clear();
|
|
33789
|
+
}
|
|
33790
|
+
} else {
|
|
33791
|
+
target.scrollX += dropScrollSpeed;
|
|
33792
|
+
if (target.scrollX > 0) {
|
|
33793
|
+
target.scrollX = 0;
|
|
33794
|
+
target.scrollInt.clear();
|
|
33795
|
+
}
|
|
33796
|
+
}
|
|
33797
|
+
}, null, null, null, "seconds");
|
|
33798
|
+
}
|
|
33799
|
+
|
|
33800
|
+
zim.List.scrollDown = function(target, dropScrollSpeed) {
|
|
33801
|
+
if (target.scrollInt) target.scrollInt.clear();
|
|
33802
|
+
target.scrollInt = zim.interval(.01, function() {
|
|
33803
|
+
if (target.dropReticle.parent) target.dropReticle.removeFrom();
|
|
33804
|
+
if (target.vertical) {
|
|
33805
|
+
target.scrollY -= dropScrollSpeed;
|
|
33806
|
+
if (target.scrollY < -target.scrollYMax) {
|
|
33807
|
+
target.scrollY = -target.scrollYMax;
|
|
33808
|
+
target.scrollInt.clear();
|
|
33809
|
+
}
|
|
33810
|
+
} else {
|
|
33811
|
+
target.scrollX -= dropScrollSpeed;
|
|
33812
|
+
if (target.scrollX < -target.scrollXMax) {
|
|
33813
|
+
target.scrollX = -target.scrollXMax;
|
|
33814
|
+
target.scrollInt.clear();
|
|
33815
|
+
}
|
|
33816
|
+
}
|
|
33817
|
+
}, null, null, null, "seconds");
|
|
33818
|
+
}
|
|
33819
|
+
|
|
33820
|
+
zim.List.doDropOver = function(dropTargets, ghost, checkItem, dropScrollSpeed) {
|
|
33821
|
+
var onCheck;
|
|
33822
|
+
zim.loop(dropTargets, function(target) {
|
|
33823
|
+
if (target.type != "List") return;
|
|
33824
|
+
if (onCheck) {
|
|
33825
|
+
if (target.scrollInt) target.scrollInt.clear();
|
|
33826
|
+
target.dropReticle.removeFrom();
|
|
33827
|
+
target.dropReticleIndex = null;
|
|
33828
|
+
return; // next in loop
|
|
33829
|
+
}
|
|
33830
|
+
if (target.vertical) {
|
|
33831
|
+
if (target.scrollYMax > 0) {
|
|
33832
|
+
if (ghost.x > target.zgb.x && ghost.x < target.zgb.x + target.zgb.width) {
|
|
33833
|
+
if (ghost.y < target.zgb.y) { // carefull - need to do these separately to turn off diamond
|
|
33834
|
+
if (ghost.y > target.zgb.y - 50) zim.List.scrollUp(target, dropScrollSpeed);
|
|
33835
|
+
else if (ghost.y > target.zgb.y - 80) zim.List.scrollUp(target, dropScrollSpeed*1.5);
|
|
33836
|
+
onCheck = true;
|
|
33837
|
+
} else if (ghost.y > target.zgb.y + target.zgb.height) {
|
|
33838
|
+
if (ghost.y < target.zgb.y + target.zgb.height + 50) zim.List.scrollDown(target, dropScrollSpeed);
|
|
33839
|
+
else if (ghost.y < target.zgb.y + target.zgb.height + 80) zim.List.scrollDown(target, dropScrollSpeed*1.5);
|
|
33840
|
+
onCheck = true;
|
|
33841
|
+
} else if (target.scrollInt) target.scrollInt.clear();
|
|
33842
|
+
} else {
|
|
33843
|
+
if (target.scrollInt) target.scrollInt.clear();
|
|
33844
|
+
}
|
|
33845
|
+
}
|
|
33846
|
+
} else {
|
|
33847
|
+
if (target.scrollXMax > 0) {
|
|
33848
|
+
if (ghost.y > target.zgb.y && ghost.y < target.zgb.y + target.zgb.height) {
|
|
33849
|
+
if (ghost.x < target.zgb.x) {
|
|
33850
|
+
if (ghost.x > target.zgb.x - 50) zim.List.scrollUp(target, dropScrollSpeed);
|
|
33851
|
+
else if (ghost.x > target.zgb.x - 80) zim.List.scrollUp(target, dropScrollSpeed*1.5);
|
|
33852
|
+
onCheck = true;
|
|
33853
|
+
} else if (ghost.x > target.zgb.x + target.zgb.width) {
|
|
33854
|
+
if (ghost.x < target.zgb.x + target.zgb.width + 50) zim.List.scrollDown(target, dropScrollSpeed);
|
|
33855
|
+
else if (ghost.x < target.zgb.x + target.zgb.width + 80) zim.List.scrollDown(target, dropScrollSpeed*1.5);
|
|
33856
|
+
onCheck = true;
|
|
33857
|
+
} else if (target.scrollInt) target.scrollInt.clear();
|
|
33858
|
+
} else {
|
|
33859
|
+
if (target.scrollInt) target.scrollInt.clear();
|
|
33860
|
+
}
|
|
33861
|
+
}
|
|
33862
|
+
}
|
|
33863
|
+
|
|
33864
|
+
// place reticle
|
|
33865
|
+
if (target.hitTestReg(ghost)) {
|
|
33866
|
+
onCheck = true;
|
|
33867
|
+
var point = target.tabs.globalToLocal(ghost.x, ghost.y);
|
|
33868
|
+
var item = target.tabs.getObjectUnderPoint(point.x, point.y, 1);
|
|
33869
|
+
var yy;
|
|
33870
|
+
var xx;
|
|
33871
|
+
var bounds;
|
|
33872
|
+
if (item) {
|
|
33873
|
+
checkItem = item;
|
|
33874
|
+
var good = target.items.includes(checkItem);
|
|
33875
|
+
if (zot(item.znum)) {
|
|
33876
|
+
while(checkItem.parent) {
|
|
33877
|
+
if (target.items.includes(checkItem.parent)) {
|
|
33878
|
+
good = true;
|
|
33879
|
+
item = checkItem.parent;
|
|
33880
|
+
break;
|
|
33881
|
+
}
|
|
33882
|
+
checkItem = checkItem.parent;
|
|
33883
|
+
}
|
|
33884
|
+
}
|
|
33885
|
+
if (!good) return;
|
|
33886
|
+
bounds = item.boundsToGlobal();
|
|
33887
|
+
|
|
33888
|
+
// target.dropReticle.visible = true;
|
|
33889
|
+
// if (checkItem == downItem) target.dropReticle.visible = false;
|
|
33890
|
+
|
|
33891
|
+
if (target.vertical) {
|
|
33892
|
+
if (ghost.y > bounds.y + bounds.height/2) {
|
|
33893
|
+
yy = bounds.y + bounds.height + target.spacing*target.zgs/2;
|
|
33894
|
+
if (yy > target.zgb.y && yy < target.zgb.y + target.zgb.height) {
|
|
33895
|
+
target.dropReticle.loc(bounds.x + bounds.width/2, yy);
|
|
33896
|
+
target.dropReticleIndex = item.znum + 1;
|
|
33897
|
+
}
|
|
33898
|
+
} else {
|
|
33899
|
+
yy = bounds.y - target.spacing*target.zgs/2;
|
|
33900
|
+
if (yy > target.zgb.y && yy < target.zgb.y + target.zgb.height) {
|
|
33901
|
+
target.dropReticle.loc(bounds.x + bounds.width/2, yy);
|
|
33902
|
+
target.dropReticleIndex = item.znum;
|
|
33903
|
+
}
|
|
33904
|
+
}
|
|
33905
|
+
} else {
|
|
33906
|
+
if (ghost.x > bounds.x + bounds.width/2) {
|
|
33907
|
+
xx = bounds.x + bounds.width + target.spacing*target.zgs/2;
|
|
33908
|
+
if (xx > target.zgb.x && xx < target.zgb.x + target.zgb.width) {
|
|
33909
|
+
target.dropReticle.loc(xx, bounds.y + bounds.height/2);
|
|
33910
|
+
target.dropReticleIndex = item.znum + 1;
|
|
33911
|
+
}
|
|
33912
|
+
} else {
|
|
33913
|
+
xx = bounds.x - target.spacing*target.zgs/2;
|
|
33914
|
+
if (xx > target.zgb.x && xx < target.zgb.x + target.zgb.width) {
|
|
33915
|
+
target.dropReticle.loc(xx, bounds.y + bounds.height/2);
|
|
33916
|
+
target.dropReticleIndex = item.znum;
|
|
33917
|
+
}
|
|
33918
|
+
}
|
|
33919
|
+
}
|
|
33920
|
+
} else {
|
|
33921
|
+
if (target.items.length > 0) {
|
|
33922
|
+
bounds = target.items[target.items.length-1].boundsToGlobal();
|
|
33923
|
+
if (target.vertical) {
|
|
33924
|
+
if (ghost.y > bounds.y + bounds.height) {
|
|
33925
|
+
yy = bounds.y + bounds.height + target.spacing*target.zgs/2;
|
|
33926
|
+
target.dropReticle.loc(target.zgb.x + target.zgb.width/2, yy);
|
|
33927
|
+
target.dropReticleIndex = target.items.length;
|
|
33928
|
+
} else {
|
|
33929
|
+
target.dropReticle.removeFrom();
|
|
33930
|
+
target.dropReticleIndex = null;
|
|
33931
|
+
}
|
|
33932
|
+
} else {
|
|
33933
|
+
if (ghost.x > bounds.x + bounds.width) {
|
|
33934
|
+
xx = bounds.x + bounds.width + target.spacing*target.zgs/2;
|
|
33935
|
+
target.dropReticle.loc(xx, target.zgb.y + target.zgb.height/2);
|
|
33936
|
+
target.dropReticleIndex = target.items.length;
|
|
33937
|
+
} else {
|
|
33938
|
+
target.dropReticle.removeFrom();
|
|
33939
|
+
target.dropReticleIndex = null;
|
|
33940
|
+
}
|
|
33941
|
+
}
|
|
33942
|
+
} else {
|
|
33943
|
+
if (target.vertical) {
|
|
33944
|
+
yy = target.zgb.y + target.spacing*target.zgs/2;
|
|
33945
|
+
target.dropReticle.loc(target.zgb.x + target.zgb.width/2, yy);
|
|
33946
|
+
target.dropReticleIndex = 0;
|
|
33947
|
+
} else {
|
|
33948
|
+
xx = target.zgb.x + target.spacing*target.zgs/2;
|
|
33949
|
+
target.dropReticle.loc(xx, target.zgb.y + target.zgb.height/2);
|
|
33950
|
+
target.dropReticleIndex = 0;
|
|
33951
|
+
}
|
|
33952
|
+
}
|
|
33953
|
+
}
|
|
33954
|
+
} else {
|
|
33955
|
+
target.dropReticle.removeFrom();
|
|
33956
|
+
target.dropReticleIndex = null;
|
|
33957
|
+
}
|
|
33958
|
+
});
|
|
33959
|
+
}
|
|
33960
|
+
|
|
33356
33961
|
zim.List.makeBase = function(c, label, paddingLeft, backgroundColor) {
|
|
33357
33962
|
if (zot(backgroundColor)) backgroundColor = zim.dark;
|
|
33358
33963
|
c.backing = new zim.Rectangle(c.width, c.height, backgroundColor).center(c);
|
|
@@ -35784,6 +36389,988 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
35784
36389
|
zim.extend(zim.Selector, zim.Container, ["clone","dispose"], "zimContainer", false);
|
|
35785
36390
|
//-62.5
|
|
35786
36391
|
|
|
36392
|
+
/*--
|
|
36393
|
+
zim.Slicer = function(obj, objScale, slices, types, titleBar, remember, upload, selection, multiple, proportion, resize, style, group, inherit);
|
|
36394
|
+
|
|
36395
|
+
Slicer
|
|
36396
|
+
zim class - extends a zim.Window which extends a zim.Container which extends a createjs.Container
|
|
36397
|
+
|
|
36398
|
+
DESCRIPTION
|
|
36399
|
+
A Slicer provides a tool to break a DisplayObject such as a Pic() into horizontal and vertical regions.
|
|
36400
|
+
|
|
36401
|
+
See: https://zimjs.com/slicer which shows how a Slicer can be used to create data for a ZIM SlicedBitmap
|
|
36402
|
+
|
|
36403
|
+
The component has a horizontal track at the top which can be pressed to make editable vertical lines
|
|
36404
|
+
and a vertical track at the left that can be pressed to make editable horizontal lines.
|
|
36405
|
+
The sections can be selected or multiple selected and properties applied.
|
|
36406
|
+
The lines can be dragged and deleted and their percentages retrieved with the slices property.
|
|
36407
|
+
A new picture can be uploaded with the pic icon at the bottom right.
|
|
36408
|
+
The interface can be hidden, the window resized at bottom right and collapsed at top right.
|
|
36409
|
+
|
|
36410
|
+
NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
|
|
36411
|
+
|
|
36412
|
+
EXAMPLE
|
|
36413
|
+
// slice a pic in four at 25% from the edges, scale the middle and keep the sides and corners not scaled.
|
|
36414
|
+
const pic = new Pic("car.png"); // preload this in Frame() or loadAssets()
|
|
36415
|
+
const slicer = new Slicer({
|
|
36416
|
+
obj:pic.clone(), // slicer will adjust obj so clone the pic so can use it unaffected later
|
|
36417
|
+
scale:.5,
|
|
36418
|
+
upload:false
|
|
36419
|
+
})
|
|
36420
|
+
.pos(30,50)
|
|
36421
|
+
.change(()=>{preview.exchange = slicer.exchange;); // this will update the picture below
|
|
36422
|
+
|
|
36423
|
+
slicer.on("loaded", ()=>{
|
|
36424
|
+
if (preview) preview.dispose();
|
|
36425
|
+
preview = new zim.SlicedBitmap(1600, 600, slicer.obj.clone(), slicer.slices, slicer.types, 2, .5)
|
|
36426
|
+
.pos(0,100,CENTER,BOTTOM)
|
|
36427
|
+
.transform({minScaleX:.05, minScaleY:.05});
|
|
36428
|
+
});
|
|
36429
|
+
|
|
36430
|
+
// this will provide slice type options
|
|
36431
|
+
new SlicerTypes(slicer).pos(30,120,RIGHT,TOP);
|
|
36432
|
+
|
|
36433
|
+
// slice a pic in four at 25% from the edges, scale the middle and keep the sides and corners not scaled.
|
|
36434
|
+
let preview = new SlicedBitmap(1600, pic.height, pic)
|
|
36435
|
+
.center()
|
|
36436
|
+
.transform({minScaleX:.05, minScaleY:.05});
|
|
36437
|
+
END EXAMPLE
|
|
36438
|
+
|
|
36439
|
+
PARAMETERS
|
|
36440
|
+
** supports DUO - parameters or single object with properties below
|
|
36441
|
+
** supports OCT - parameter defaults can be set with STYLE control (like CSS)
|
|
36442
|
+
obj - (default new Tile()) a DisplayObject to slice
|
|
36443
|
+
objScale - (default 1) set the scale of the object in the Slicer
|
|
36444
|
+
slices - (default null) an array of horizontal and vertical arrays holding slice percentage
|
|
36445
|
+
[[.25,.75], [.1,.4,.5,.9]]
|
|
36446
|
+
three horizontal regions made from two vertical lines placed at 1/4 and 3/4 the width
|
|
36447
|
+
five vertical regions made from four horizontal lines with 1/10 the picture at left, middle and right
|
|
36448
|
+
types - (default null) an array of horizontal and vertical arrays holding slice types
|
|
36449
|
+
0 - fix - keeps the original width and height of the region. Usually, good for corners.
|
|
36450
|
+
1 - stretch - stretch the region to fill space as an object is stretched
|
|
36451
|
+
2 - tile - tile the region at original scale - currently, will match the first side and sometimes the second side
|
|
36452
|
+
titleBar - (default "Slicer") the title of the window as a String or ZIM Label
|
|
36453
|
+
remember - (default true) use localStorage(zimSlicer) to store the last settings of the lines - see clear() method
|
|
36454
|
+
upload - (default true) provide a pic button at bottom right to upload a pic
|
|
36455
|
+
selection - (default true) let the sliced regions be selected
|
|
36456
|
+
multiple - (default true) if selection then let shift or the multiple button be used to select multiple regions - set to false for single selection
|
|
36457
|
+
proportion - (default true) when resized (or on upload) keep the percentages - set to false to keep lines at pixel setting
|
|
36458
|
+
resize - (default true) roll over bottom right corner to resize - set to false to not provide resizing - also can use resizeVisible as STYLE to keep visible
|
|
36459
|
+
style - (default true) set to false to ignore styles set with the STYLE - will receive original parameter defaults
|
|
36460
|
+
group - (default null) set to String (or comma delimited String) so STYLE can set default styles to the group(s) (like a CSS class)
|
|
36461
|
+
inherit - (default null) used internally but can receive an {} of styles directly
|
|
36462
|
+
|
|
36463
|
+
METHODS
|
|
36464
|
+
hasProp(property as String) - returns true if property exists on object else returns false
|
|
36465
|
+
setObject(newObj, scale) - change the object in the slicer and set the scale of the object
|
|
36466
|
+
updateLines(slices) - remake lines with slices data - see slices parameter
|
|
36467
|
+
setSlicerTypes(slicerTypes) - add a ZIM SlicerTypes object to control slicer types
|
|
36468
|
+
clearSelection() - clears all highlights - not the line selections but the region selections
|
|
36469
|
+
clear() - clears remembered data stored in localStorage(zimSlicer)
|
|
36470
|
+
clone() - makes a copy with properties such as x, y, etc. also copied
|
|
36471
|
+
dispose() - removes from parent, removes event listeners - must still set outside references to null for garbage collection
|
|
36472
|
+
|
|
36473
|
+
ALSO: All Window methods such as resize()
|
|
36474
|
+
|
|
36475
|
+
ALSO: ZIM 4TH adds all the methods listed under Container (see above), such as:
|
|
36476
|
+
drag(), hitTestRect(), animate(), sca(), reg(), mov(), center(), centerReg(),
|
|
36477
|
+
addTo(), removeFrom(), loop(), outline(), place(), pos(), alp(), rot(), setMask(), etc.
|
|
36478
|
+
ALSO: see the CreateJS Easel Docs for Container methods, such as:
|
|
36479
|
+
on(), off(), getBounds(), setBounds(), cache(), uncache(), updateCache(), dispatchEvent(),
|
|
36480
|
+
addChild(), removeChild(), addChildAt(), getChildAt(), contains(), removeAllChildren(), etc.
|
|
36481
|
+
|
|
36482
|
+
PROPERTIES
|
|
36483
|
+
type - holds the class name as a String
|
|
36484
|
+
obj - get a reference to the object being sliced - see setObject() to set the object
|
|
36485
|
+
slices - get or set the slices array - see the slices parameter
|
|
36486
|
+
types - get or set the types array - see the types parameter
|
|
36487
|
+
exchange - get or set [slices, types] as a single array - used to set a SlicedBitmap
|
|
36488
|
+
selectedIndexH - get the selected index of the current horizontal slice
|
|
36489
|
+
selectedIndexV - get the selected index of the current vertical slice
|
|
36490
|
+
currentLineH - get the selected horizontal slice line (a vertical line)
|
|
36491
|
+
currentLineV - get the selected vertical slice line (a horizontal line)
|
|
36492
|
+
selection - get an array of currently highlighted regions - also see highLightContainer
|
|
36493
|
+
box - a reference to the box Rectangle that directly surrounds the obj
|
|
36494
|
+
trackH - a reference to the top track Rectangle
|
|
36495
|
+
trackV - a reference to the left track Rectangle
|
|
36496
|
+
deleteH - a reference to the delete Button at top right
|
|
36497
|
+
deleteV - a reference to the delete Button at bottom left
|
|
36498
|
+
hide - a reference to the hide Button at top left
|
|
36499
|
+
loader - a reference to the Loader button at bottom right
|
|
36500
|
+
linesHContainer - a reference to the Container of horizontal slice lines (vertical lines)
|
|
36501
|
+
linesVContainer - a reference to the Container of vertical slice lines (vertical lines)
|
|
36502
|
+
highlightContainer - a reference to the left track Rectangle
|
|
36503
|
+
|
|
36504
|
+
ALSO: see ZIM Window for properties - like titleBar, titleBarLabel, resizeHandle, etc.
|
|
36505
|
+
|
|
36506
|
+
ALSO: see ZIM Container for properties such as:
|
|
36507
|
+
width, height, widthOnly, heightOnly, draggable, level, depth, group
|
|
36508
|
+
blendMode, hue, saturation, brightness, contrast, etc.
|
|
36509
|
+
|
|
36510
|
+
ALSO: see the CreateJS Easel Docs for Container properties, such as:
|
|
36511
|
+
x, y, rotation, scaleX, scaleY, regX, regY, skewX, skewY,
|
|
36512
|
+
alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, etc.
|
|
36513
|
+
|
|
36514
|
+
EVENTS
|
|
36515
|
+
change - dispatched when a line is added, deleted or moved
|
|
36516
|
+
selection - dispatched when a region is selected or deselected
|
|
36517
|
+
delete - dispatched when a line is deleted
|
|
36518
|
+
loaded - dispatched when an image is loaded
|
|
36519
|
+
|
|
36520
|
+
ALSO: all Window events including "collapse", "expand", "resize"
|
|
36521
|
+
|
|
36522
|
+
ALSO: see the CreateJS Easel Docs for Container events such as:
|
|
36523
|
+
added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmove, pressup, removed, rollout, rollover
|
|
36524
|
+
--*///+62.7
|
|
36525
|
+
zim.Slicer = function(obj, objScale, slices, types, titleBar, remember, upload, selection, multiple, proportion, resize, style, group, inherit) {
|
|
36526
|
+
var sig = "obj, objScale, slices, types, titleBar, remember, upload, selection, multiple, proportion, resize, style, group, inherit";
|
|
36527
|
+
var duo; if (duo = zob(zim.Slicer, arguments, sig, this)) return duo;
|
|
36528
|
+
z_d("62.7");
|
|
36529
|
+
this.group = group;
|
|
36530
|
+
var DS = style===false?{}:zim.getStyle("Slicer", this.group, inherit);
|
|
36531
|
+
|
|
36532
|
+
if (zot(obj)) obj = DS.obj!=null?DS.obj:new zim.Tile();
|
|
36533
|
+
if (zot(objScale)) objScale = DS.objScale!=null?DS.objScale:1;
|
|
36534
|
+
var scale = objScale;
|
|
36535
|
+
var empty = slices;
|
|
36536
|
+
if (zot(slices)) slices = DS.slices!=null?DS.slices:[[0,1],[0,1]];
|
|
36537
|
+
var defaults = [[1],[1]];
|
|
36538
|
+
zim.loop(slices,function(s,i) {
|
|
36539
|
+
zim.loop(s,function() {
|
|
36540
|
+
defaults[i].push(1);
|
|
36541
|
+
});
|
|
36542
|
+
});
|
|
36543
|
+
slices = zim.copy(slices);
|
|
36544
|
+
if (zot(types)) types = DS.slices!=null?DS.slices:defaults;
|
|
36545
|
+
types = zim.copy(types);
|
|
36546
|
+
if (zot(titleBar)) titleBar = DS.titleBar!=null?DS.titleBar:"Slicer";
|
|
36547
|
+
if (zot(remember)) remember = DS.remember!=null?DS.remember:true;
|
|
36548
|
+
if (zot(upload)) upload = DS.upload!=null?DS.upload:true;
|
|
36549
|
+
if (zot(selection)) selection = DS.selection!=null?DS.selection:true;
|
|
36550
|
+
if (zot(multiple)) multiple = DS.multiple!=null?DS.multiple:true;
|
|
36551
|
+
if (zot(proportion)) proportion = DS.proportion!=null?DS.proportion:true;
|
|
36552
|
+
if (zot(resize)) resize = DS.resize!=null?DS.resize:true;
|
|
36553
|
+
|
|
36554
|
+
// WINDOW
|
|
36555
|
+
var wW = obj.width*scale+60;
|
|
36556
|
+
var wH = obj.height*scale+60+(titleBar?30:0);
|
|
36557
|
+
var oWW = wW;
|
|
36558
|
+
var oWH = wH;
|
|
36559
|
+
this.zimWindow_constructor(wW, wH,
|
|
36560
|
+
null, null, null, null, null, null, false, null, null, null, null, null, false, false, false, null, null, null, null, null, null, null, null, null, null,
|
|
36561
|
+
titleBar, dark, moon, null, true, null, null, null, null, null, null, null, resize, true
|
|
36562
|
+
);
|
|
36563
|
+
this.type = "Slicer";
|
|
36564
|
+
var that = this;
|
|
36565
|
+
if (that.collapseIcon) that.collapseIcon.mov(2);
|
|
36566
|
+
if (that.titleBar) {
|
|
36567
|
+
that.titleBarLabel.mov(26,1);
|
|
36568
|
+
zdf.makeIcon(tin, clear, [tin, tin, tin, tin, tin]).scaleTo(that.titleBar,87,87).loc(5,2,that.titleBar);
|
|
36569
|
+
}
|
|
36570
|
+
|
|
36571
|
+
that.obj = obj;
|
|
36572
|
+
that.data = slices;
|
|
36573
|
+
that.dataTypes = types;
|
|
36574
|
+
// CONTAINERS
|
|
36575
|
+
var hh = that.height-(titleBar?30:0);
|
|
36576
|
+
var content = new zim.Container(that.width, hh);
|
|
36577
|
+
var sc = that.splitterContent = new zim.Container(that.width-60, hh-60).pos(30,30,LEFT,TOP,content);
|
|
36578
|
+
|
|
36579
|
+
// OBJECT
|
|
36580
|
+
var w = obj.width*scale;
|
|
36581
|
+
var h = obj.height*scale;
|
|
36582
|
+
obj.sca(scale).addTo(sc);
|
|
36583
|
+
|
|
36584
|
+
|
|
36585
|
+
// CONTENT
|
|
36586
|
+
var box = that.box = new zim.Rectangle({width:w, height:h, borderColor:black, scaleDimensions:false}).alp(.5).pos(30,30,LEFT,TOP,content).expand(0)
|
|
36587
|
+
box.on("mousedown", doClear);
|
|
36588
|
+
function doClear() {
|
|
36589
|
+
linesH.loop(function(l) {
|
|
36590
|
+
l.triangle.color = faint;
|
|
36591
|
+
});
|
|
36592
|
+
currentH = null;
|
|
36593
|
+
linesV.loop(function(l) {
|
|
36594
|
+
l.triangle.color = faint;
|
|
36595
|
+
});
|
|
36596
|
+
currentV = null;
|
|
36597
|
+
that.stage.update();
|
|
36598
|
+
}
|
|
36599
|
+
|
|
36600
|
+
var hide = that.hide = new zim.Button({width:30, height:30, label:"-", toggle:"+", color:silver, backgroundColor:darker, rollBackgroundColor:lighter, rollColor:granite, corner:0, shadowColor:-1, style:false}).sca(1).loc(0,0,content);
|
|
36601
|
+
hide.label.mov(0,-2)
|
|
36602
|
+
hide.on("click", function(){
|
|
36603
|
+
if (hide.toggled) {
|
|
36604
|
+
hide.label.mov(0,3);
|
|
36605
|
+
box.visible = trackH.visible = trackV.visible = linesH.visible = linesV.visible = deleteH.visible = deleteV.visible = highlights.visible = false;
|
|
36606
|
+
if (multi) multi.vis(false);
|
|
36607
|
+
if (upload) loader.removeFrom();
|
|
36608
|
+
} else {
|
|
36609
|
+
hide.label.mov(0,-3);
|
|
36610
|
+
box.visible = trackH.visible = trackV.visible = linesH.visible = linesV.visible = deleteH.visible = deleteV.visible = highlights.visible = true;
|
|
36611
|
+
if (multi) multi.vis(true);
|
|
36612
|
+
if (upload) loader.addTo(that.contentContainer);
|
|
36613
|
+
}
|
|
36614
|
+
});
|
|
36615
|
+
|
|
36616
|
+
var trackH = that.trackH = new zim.Rectangle(w, 30, white).alp(.1).loc(box.x, box.y-30, content).cur();
|
|
36617
|
+
var trackV = that.trackV = new zim.Rectangle(30, h, white).alp(.1).loc(box.x-30, box.y, content).cur();
|
|
36618
|
+
var deleteH = that.deleteH = new zim.Button({width:60, height:60, label:"X", backgroundColor:red, corner:0, shadowColor:-1, style:false}).sca(.5).pos(0,0,RIGHT,TOP,content);
|
|
36619
|
+
var deleteV = that.deleteV = deleteH.clone().pos(0,0,LEFT,BOTTOM,content);
|
|
36620
|
+
|
|
36621
|
+
if (selection && multiple) var multi = that.toggle = new zim.Toggle({height:18, width:30, backgroundColor:grey, corner:9, label:"multiple", color:tin})
|
|
36622
|
+
.loc(deleteV.x + 45, deleteV.y+6, content);
|
|
36623
|
+
|
|
36624
|
+
if (upload) {
|
|
36625
|
+
var icon1 = new zim.Circle(6,silver).reg(CENTER,3);
|
|
36626
|
+
new zim.Circle({radius:9, color:silver, percent:40}).center(icon1).mov(0,8);
|
|
36627
|
+
var icon2 = new zim.Circle(6,grey).reg(CENTER,3);
|
|
36628
|
+
new zim.Circle({radius:9, color:grey, percent:40}).center(icon2).mov(0,8);
|
|
36629
|
+
var loader = that.loader = new zim.Loader({
|
|
36630
|
+
width:30,
|
|
36631
|
+
height:30,
|
|
36632
|
+
backgroundColor:darker,
|
|
36633
|
+
rollBackgroundColor:lighter,
|
|
36634
|
+
corner:3,
|
|
36635
|
+
borderColor:-1,
|
|
36636
|
+
label:"",
|
|
36637
|
+
icon:icon1,
|
|
36638
|
+
rollIcon:icon2
|
|
36639
|
+
});
|
|
36640
|
+
loader.on("loaded", function(e) {
|
|
36641
|
+
obj.dispose();
|
|
36642
|
+
loader.removeRoll();
|
|
36643
|
+
var f = e.bitmap.fit(0,0,oWW-60, oWH-60-(titleBar?30:0));
|
|
36644
|
+
scale = f.scale;
|
|
36645
|
+
e.bitmap.sca(1);
|
|
36646
|
+
wW = e.bitmap.width*scale+60;
|
|
36647
|
+
wH = e.bitmap.height*scale+60;
|
|
36648
|
+
that.resize(wW, wH);
|
|
36649
|
+
obj = e.bitmap.sca(scale).loc(0,0,sc,0);
|
|
36650
|
+
that.obj = obj;
|
|
36651
|
+
doResize();
|
|
36652
|
+
that.dispatchEvent("loaded");
|
|
36653
|
+
});
|
|
36654
|
+
}
|
|
36655
|
+
|
|
36656
|
+
var instruct = that.instruct = new zim.Container(content.width, content.height).addTo(content).animate({
|
|
36657
|
+
wait:1,
|
|
36658
|
+
from:true,
|
|
36659
|
+
props:{alpha:0},
|
|
36660
|
+
rewind:true,
|
|
36661
|
+
rewindWait:2,
|
|
36662
|
+
call:function(){instruct.dispose(); instruct=null;}
|
|
36663
|
+
}).noMouse();
|
|
36664
|
+
new zim.Label("Add slices here", 15, null, blue).pos(0,8,CENTER,TOP,instruct);
|
|
36665
|
+
new zim.Label("Add slices here", 15, null, blue).rot(-90).pos(8,0,LEFT,CENTER,instruct);
|
|
36666
|
+
|
|
36667
|
+
// ADD CONTENT TO WINDOW
|
|
36668
|
+
that.add(content);
|
|
36669
|
+
that.add(loader, null, true);
|
|
36670
|
+
loader.pos(0,0,RIGHT,BOTTOM)
|
|
36671
|
+
|
|
36672
|
+
|
|
36673
|
+
// LINES
|
|
36674
|
+
var linesH = that.linesHContainer = new zim.Container(w,h).loc(box, null, content);
|
|
36675
|
+
var linesV = that.linesVContainer = new zim.Container(w,h).loc(box, null, content);
|
|
36676
|
+
var currentH;
|
|
36677
|
+
var currentV;
|
|
36678
|
+
|
|
36679
|
+
// axis is direction of line, so VERTICAL will use linesH, etc.
|
|
36680
|
+
that.makeLine = function(axis, ratio, selected) {
|
|
36681
|
+
if (ratio > 1) ratio /= 100;
|
|
36682
|
+
var line;
|
|
36683
|
+
if (axis == "vertical") {
|
|
36684
|
+
var x = ratio*box.width;
|
|
36685
|
+
line = new zim.Container(30,h+30).reg(15,30).loc(x, 0, linesH);
|
|
36686
|
+
line.triangle = new zim.Triangle(30,30,30,selected?blue:faint,blue).rot(180).pos(0,4,CENTER,TOP,line);
|
|
36687
|
+
line.line = new zim.Rectangle(1,box.height,red).ble().expand(3).reg(0,0).pos(0,30,CENTER,TOP,line);
|
|
36688
|
+
line.drag({all:true, boundary:new zim.Boundary(0,0,box.width,0), localBoundary:true});
|
|
36689
|
+
line.on("mousedown", function() {
|
|
36690
|
+
linesH.loop(function(l) {
|
|
36691
|
+
if (l==line) l.triangle.color = blue;
|
|
36692
|
+
else l.triangle.color = faint;
|
|
36693
|
+
});
|
|
36694
|
+
currentH = that.currentLineH = line;
|
|
36695
|
+
that.stage.update();
|
|
36696
|
+
});
|
|
36697
|
+
line.on("pressmove", dataLinesH);
|
|
36698
|
+
} else {
|
|
36699
|
+
var y = ratio*box.height;
|
|
36700
|
+
line = new zim.Container(w+30,30).reg(30,15).loc(0, y, linesV);
|
|
36701
|
+
line.triangle = new zim.Triangle(30,30,30,selected?blue:faint,blue).rot(90).pos(4,0,LEFT,CENTER,line);
|
|
36702
|
+
line.line = new zim.Rectangle(box.width,1,red).ble().expand(3).reg(0,0).pos(30,0,LEFT,CENTER,line);
|
|
36703
|
+
line.drag({all:true, boundary:new zim.Boundary(0,0,0,box.height), localBoundary:true});
|
|
36704
|
+
line.on("mousedown", function() {
|
|
36705
|
+
linesV.loop(function(l) {
|
|
36706
|
+
if (l==line) l.triangle.color = blue;
|
|
36707
|
+
else l.triangle.color = faint;
|
|
36708
|
+
});
|
|
36709
|
+
currentV = that.currentLineV = line;
|
|
36710
|
+
that.stage.update();
|
|
36711
|
+
});
|
|
36712
|
+
line.on("pressmove", dataLinesV);
|
|
36713
|
+
}
|
|
36714
|
+
return line;
|
|
36715
|
+
}
|
|
36716
|
+
|
|
36717
|
+
// HORIZONTAL
|
|
36718
|
+
// across the top - will make vertical lines but slices into horizontal regions
|
|
36719
|
+
trackH.on("mousedown", function() {
|
|
36720
|
+
if (instruct) instruct.dispose();
|
|
36721
|
+
linesH.loop(function(l) {
|
|
36722
|
+
l.triangle.color = faint;
|
|
36723
|
+
});
|
|
36724
|
+
var point = linesH.globalToLocal(F.mouseX, F.mouseY);
|
|
36725
|
+
that.currentLineH = currentH = that.makeLine(VERTICAL, point.x/box.width, true);
|
|
36726
|
+
|
|
36727
|
+
// move any selections past the line forward one
|
|
36728
|
+
var c = that.selectedIndexH = getIndexH(currentH);
|
|
36729
|
+
selected.sort(function (a, b) {
|
|
36730
|
+
return a[0] - b[0];
|
|
36731
|
+
});
|
|
36732
|
+
loop(selected, function (s, i) {
|
|
36733
|
+
if (s[0] >= c) s[0]++;
|
|
36734
|
+
}, true); // true for backwards
|
|
36735
|
+
|
|
36736
|
+
// adding dataTypes to columns in each row
|
|
36737
|
+
if (that.dataTypes) {
|
|
36738
|
+
that.dataTypes[0].splice(c-1, 0, that.dataTypes[0][c-1]); // take types from next door
|
|
36739
|
+
// zim.loop(that.dataTypes, function(row,j){
|
|
36740
|
+
// row.splice(c-1, 0, [row[c-1][0], row[c-1][1]]); // take types from next door
|
|
36741
|
+
// });
|
|
36742
|
+
}
|
|
36743
|
+
|
|
36744
|
+
dataLinesH();
|
|
36745
|
+
that.stage.update();
|
|
36746
|
+
})
|
|
36747
|
+
|
|
36748
|
+
deleteH.on("click", function(){
|
|
36749
|
+
if (currentH) {
|
|
36750
|
+
|
|
36751
|
+
// move any selections past the line including the line back one
|
|
36752
|
+
var c = getIndexH(currentH);
|
|
36753
|
+
selected.sort(function (a, b) {
|
|
36754
|
+
return a[0] - b[0];
|
|
36755
|
+
});
|
|
36756
|
+
loop(selected, function (s, i) {
|
|
36757
|
+
if (s[0] >= c - 1) s[0]--;
|
|
36758
|
+
}, true); // true for backwards
|
|
36759
|
+
|
|
36760
|
+
// remove duplicates of one less than c
|
|
36761
|
+
var already = [];
|
|
36762
|
+
loop(selected, function(s, i) {
|
|
36763
|
+
if (s[0] == c-2 && already.indexOf(JSON.stringify(s)) >= 0) selected.splice(i,1);
|
|
36764
|
+
else already.push(JSON.stringify(s));
|
|
36765
|
+
}, true);
|
|
36766
|
+
already = null;
|
|
36767
|
+
|
|
36768
|
+
// remove data from types
|
|
36769
|
+
if (that.dataTypes) that.dataTypes[0].splice(c-1, 1);
|
|
36770
|
+
|
|
36771
|
+
currentH.dispose();
|
|
36772
|
+
that.currentLineH = currentH = null;
|
|
36773
|
+
|
|
36774
|
+
dataLinesH();
|
|
36775
|
+
that.dispatchEvent("delete");
|
|
36776
|
+
that.stage.update();
|
|
36777
|
+
}
|
|
36778
|
+
});
|
|
36779
|
+
|
|
36780
|
+
function dataLinesH() {
|
|
36781
|
+
that.data[0] = [0,1];
|
|
36782
|
+
linesH.loop(function(l) {
|
|
36783
|
+
that.data[0].push(zim.decimals(l.x/box.width,3));
|
|
36784
|
+
})
|
|
36785
|
+
that.data[0].sort(function(a, b){return a-b});
|
|
36786
|
+
adjustBoxes();
|
|
36787
|
+
}
|
|
36788
|
+
|
|
36789
|
+
function getIndexH(line) {
|
|
36790
|
+
var c = zim.loop(that.data[0], function(x,i) {
|
|
36791
|
+
if (zim.decimals(line.x/box.width,3) < x) return i;
|
|
36792
|
+
});
|
|
36793
|
+
return c;
|
|
36794
|
+
}
|
|
36795
|
+
|
|
36796
|
+
// VERTICAL
|
|
36797
|
+
// same as horizontal but along left will make vertical lines but slices into vertical regions
|
|
36798
|
+
trackV.on("mousedown", function() {
|
|
36799
|
+
if (instruct) instruct.dispose();
|
|
36800
|
+
linesV.loop(function(l) {
|
|
36801
|
+
l.triangle.color = faint;
|
|
36802
|
+
});
|
|
36803
|
+
var point = linesV.globalToLocal(F.mouseX, F.mouseY);
|
|
36804
|
+
|
|
36805
|
+
var point = linesH.globalToLocal(F.mouseX, F.mouseY);
|
|
36806
|
+
that.currentLineV = currentV = that.makeLine(HORIZONTAL, point.y/box.height, true);
|
|
36807
|
+
|
|
36808
|
+
// move any selections past the line forward one
|
|
36809
|
+
var r = that.selectedIndexV = getIndexV(currentV);
|
|
36810
|
+
selected.sort(function (a, b) {
|
|
36811
|
+
return a[1] - b[1];
|
|
36812
|
+
});
|
|
36813
|
+
loop(selected, function (s, i) {
|
|
36814
|
+
if (s[1] >= r) s[1]++;
|
|
36815
|
+
}, true); // true for backwards
|
|
36816
|
+
|
|
36817
|
+
// adding row with columns
|
|
36818
|
+
if (that.dataTypes) that.dataTypes[1].splice(r-1, 0, that.dataTypes[1][r-1]); // take types from next door
|
|
36819
|
+
|
|
36820
|
+
dataLinesV();
|
|
36821
|
+
that.stage.update();
|
|
36822
|
+
})
|
|
36823
|
+
|
|
36824
|
+
deleteV.on("click", function(){
|
|
36825
|
+
if (currentV) {
|
|
36826
|
+
// move any selections past the line including the line back one
|
|
36827
|
+
var r = getIndexV(currentV);
|
|
36828
|
+
selected.sort(function (a, b) {
|
|
36829
|
+
return a[1] - b[1];
|
|
36830
|
+
});
|
|
36831
|
+
loop(selected, function (s, i) {
|
|
36832
|
+
if (s[1] >= r - 1) s[1]--;
|
|
36833
|
+
}, true); // true for backwards
|
|
36834
|
+
|
|
36835
|
+
// remove duplicates of less than r
|
|
36836
|
+
var already = [];
|
|
36837
|
+
loop(selected, function(s, i) {
|
|
36838
|
+
if (s[1] == r-2 && already.indexOf(JSON.stringify(s)) >= 0) selected.splice(i,1);
|
|
36839
|
+
else already.push(JSON.stringify(s));
|
|
36840
|
+
}, true);
|
|
36841
|
+
already = null;
|
|
36842
|
+
|
|
36843
|
+
// remove data from types
|
|
36844
|
+
if (that.dataTypes) that.dataTypes[1].splice(r-1, 1);
|
|
36845
|
+
|
|
36846
|
+
currentV.dispose();
|
|
36847
|
+
that.currentLineV = currentV = null;
|
|
36848
|
+
|
|
36849
|
+
dataLinesV();
|
|
36850
|
+
that.dispatchEvent("delete");
|
|
36851
|
+
that.stage.update();
|
|
36852
|
+
}
|
|
36853
|
+
});
|
|
36854
|
+
|
|
36855
|
+
function dataLinesV() {
|
|
36856
|
+
that.data[1] = [0,1];
|
|
36857
|
+
linesV.loop(function(l) {
|
|
36858
|
+
that.data[1].push(zim.decimals(l.y/box.height,3));
|
|
36859
|
+
})
|
|
36860
|
+
that.data[1].sort(function(a, b){return a-b});
|
|
36861
|
+
adjustBoxes();
|
|
36862
|
+
}
|
|
36863
|
+
|
|
36864
|
+
function getIndexV(line) {
|
|
36865
|
+
var r = zim.loop(that.data[1], function(y,i) {
|
|
36866
|
+
if (zim.decimals(line.y/box.height,3) < y) return i;
|
|
36867
|
+
});
|
|
36868
|
+
return r;
|
|
36869
|
+
}
|
|
36870
|
+
|
|
36871
|
+
// HIGHLIGHTS
|
|
36872
|
+
function adjustBoxes(dispatch) {
|
|
36873
|
+
if (zot(dispatch)) dispatch = true;
|
|
36874
|
+
highlights.disposeAllChildren();
|
|
36875
|
+
zim.loop(selected, function(s) {
|
|
36876
|
+
that.selectTile(s[0],s[1]);
|
|
36877
|
+
});
|
|
36878
|
+
if (dispatch) that.dispatchEvent("change");
|
|
36879
|
+
if (localStorage) localStorage.zimSlicer = JSON.stringify(that.exchange);
|
|
36880
|
+
}
|
|
36881
|
+
|
|
36882
|
+
var selected = that.selected = [];
|
|
36883
|
+
|
|
36884
|
+
var highlights = that.highlightsContainer = new zim.Container(W,H).loc(box, null, content).noMouse();
|
|
36885
|
+
var gap = 5;
|
|
36886
|
+
that.selectTile = function(c,r,d) {
|
|
36887
|
+
if (d) highlights.disposeAllChildren();
|
|
36888
|
+
c = zim.constrain(c,0,that.data[0].length-1);
|
|
36889
|
+
r = zim.constrain(r,0,that.data[1].length-1);
|
|
36890
|
+
that.selection = new zim.Rectangle(that.data[0][c+1]*box.width-that.data[0][c]*box.width-gap*2, that.data[1][r+1]*box.height-that.data[1][r]*box.height-gap*2, white.toAlpha(.2), white, 2, 0, true)
|
|
36891
|
+
.loc(that.data[0][c]*box.width+gap, that.data[1][r]*box.height+gap, highlights)
|
|
36892
|
+
.ble();
|
|
36893
|
+
}
|
|
36894
|
+
|
|
36895
|
+
if (selection) {
|
|
36896
|
+
box.cur();
|
|
36897
|
+
box.on("mousedown", function(){
|
|
36898
|
+
var point = box.globalToLocal(that.stage.frame.mouseX, that.stage.frame.mouseY);
|
|
36899
|
+
var c = zim.loop(that.data[0], function(x,i) {
|
|
36900
|
+
if (point.x < x*box.width) return i-1;
|
|
36901
|
+
});
|
|
36902
|
+
var r = zim.loop(that.data[1], function(y,i) {
|
|
36903
|
+
if (point.y < y*box.height) return i-1;
|
|
36904
|
+
});
|
|
36905
|
+
|
|
36906
|
+
var empty = zim.loop(selected, function(s,i) {
|
|
36907
|
+
if (JSON.stringify(s) == JSON.stringify([c,r])) {
|
|
36908
|
+
if (selected.length > 1 && multiple && !F.shiftKey && !multi.toggled) return true; // if others just clear others
|
|
36909
|
+
selected.splice(i,1); // else toggling a selected
|
|
36910
|
+
return false;
|
|
36911
|
+
}
|
|
36912
|
+
});
|
|
36913
|
+
|
|
36914
|
+
if (!multiple || (!F.shiftKey && !multi.toggled)) selected = that.selected = [];
|
|
36915
|
+
if (empty) {
|
|
36916
|
+
selected.push([c,r]); // could put the above like in this conditional
|
|
36917
|
+
}
|
|
36918
|
+
|
|
36919
|
+
adjustBoxes(false);
|
|
36920
|
+
that.dispatchEvent("selection");
|
|
36921
|
+
});
|
|
36922
|
+
}
|
|
36923
|
+
|
|
36924
|
+
// RESIZE
|
|
36925
|
+
that.on("resize", doResize);
|
|
36926
|
+
function doResize() {
|
|
36927
|
+
hh = that.height-(titleBar?30:0);
|
|
36928
|
+
var boxH = box.width;
|
|
36929
|
+
var boxV = box.height;
|
|
36930
|
+
that.box.siz(that.width-60, hh-60).expand(0);
|
|
36931
|
+
deleteH.loc(box.x+box.width,box.y-30);
|
|
36932
|
+
deleteV.loc(box.x-30,box.y+box.height);
|
|
36933
|
+
trackH.widthOnly = box.width;
|
|
36934
|
+
trackV.heightOnly = box.height;
|
|
36935
|
+
linesH.loop(function(line, i) {
|
|
36936
|
+
line.line.heightOnly = box.height;
|
|
36937
|
+
if (proportion) line.x = line.x*box.width/boxH;
|
|
36938
|
+
line.dragBoundary(new zim.Boundary(0,0,box.width,0));
|
|
36939
|
+
});
|
|
36940
|
+
linesV.loop(function(line) {
|
|
36941
|
+
line.line.widthOnly = box.width;
|
|
36942
|
+
if (proportion) line.y = line.y*box.height/boxV;
|
|
36943
|
+
line.dragBoundary(new zim.Boundary(0,0,0,box.height));
|
|
36944
|
+
});
|
|
36945
|
+
if (multi) multi.loc(deleteV.x + 45, deleteV.y+6, content);
|
|
36946
|
+
if (upload) {
|
|
36947
|
+
loader.loc(that.box.width+30,that.box.height+30);
|
|
36948
|
+
loader.resize();
|
|
36949
|
+
}
|
|
36950
|
+
adjustBoxes();
|
|
36951
|
+
setTimeout(function(){
|
|
36952
|
+
obj.scaleTo(that.box,100,100).loc(0,0,sc,0);
|
|
36953
|
+
that.stage.update();
|
|
36954
|
+
},20);
|
|
36955
|
+
}
|
|
36956
|
+
if (resize) {
|
|
36957
|
+
that.resizeHandle.on("pressup", function() {
|
|
36958
|
+
var wW = obj.width+60;
|
|
36959
|
+
var wH = obj.height+60;
|
|
36960
|
+
that.resize(wW,wH);
|
|
36961
|
+
that.stage.update()
|
|
36962
|
+
});
|
|
36963
|
+
}
|
|
36964
|
+
|
|
36965
|
+
|
|
36966
|
+
|
|
36967
|
+
// METHODS
|
|
36968
|
+
that.setObject = function(newObj, scale) {
|
|
36969
|
+
obj.dispose();
|
|
36970
|
+
obj = newObj;
|
|
36971
|
+
if (zot(scale)) {
|
|
36972
|
+
var f = e.bitmap.fit(0,0,oWW-60, oWH-60-(titleBar?30:0));
|
|
36973
|
+
scale = f.scale;
|
|
36974
|
+
}
|
|
36975
|
+
obj.sca(1);
|
|
36976
|
+
wW = obj.width*scale+60;
|
|
36977
|
+
wH = obj.height*scale+60;
|
|
36978
|
+
that.resize(wW, wH);
|
|
36979
|
+
obj = obj.sca(scale).loc(0,0,sc,0);
|
|
36980
|
+
that.obj = obj;
|
|
36981
|
+
doResize();
|
|
36982
|
+
that.dispatchEvent("loaded");
|
|
36983
|
+
return that;
|
|
36984
|
+
}
|
|
36985
|
+
|
|
36986
|
+
that.updateLines = function(slices) {
|
|
36987
|
+
that.data = slices;
|
|
36988
|
+
// clear all lines and remake them to the data
|
|
36989
|
+
linesH.disposeAllChildren();
|
|
36990
|
+
linesV.disposeAllChildren();
|
|
36991
|
+
zim.loop(slices[0], function(x,i,t) {if (i!=0 && i!=t-1) {that.makeLine(VERTICAL, x)};});
|
|
36992
|
+
zim.loop(slices[1], function(y,i,t) {if (i!=0 && i!=t-1) {that.makeLine(HORIZONTAL, y)};});
|
|
36993
|
+
that.selectedIndexH = that.selectedIndexV = that.currentLineH = that.currentLineV = null;
|
|
36994
|
+
if (that.stage) that.stage.update();
|
|
36995
|
+
return that;
|
|
36996
|
+
}
|
|
36997
|
+
|
|
36998
|
+
that.setSlicerTypes = function(slicerTypes) {
|
|
36999
|
+
if (!that.dataTypes) that.dataTypes = [[1],[1]];
|
|
37000
|
+
var st = that.slicerTypes = slicerTypes;
|
|
37001
|
+
that.on("select", function() {
|
|
37002
|
+
if (selected.length > 0) {
|
|
37003
|
+
st.shield.vis(false);
|
|
37004
|
+
|
|
37005
|
+
// loop through all selected and if the same types
|
|
37006
|
+
var lastH;
|
|
37007
|
+
var lastV;
|
|
37008
|
+
zim.loop(selected, function(s) {
|
|
37009
|
+
var type = that.dataTypes[0][s[0]];
|
|
37010
|
+
if (lastH != "bad" && (lastH==null || lastH==type)) lastH = type;
|
|
37011
|
+
else lastH = "bad";
|
|
37012
|
+
type = that.dataTypes[1][s[1]];
|
|
37013
|
+
if (lastV != "bad" && (lastV==null || lastV==type)) lastV = type;
|
|
37014
|
+
else lastV = "bad";
|
|
37015
|
+
if (lastH == "bad" && lastV == "bad") return false; // exits loop
|
|
37016
|
+
});
|
|
37017
|
+
|
|
37018
|
+
// if not the same types then yellow the box and remove selection
|
|
37019
|
+
if (lastH == "bad") {
|
|
37020
|
+
st.radioH.selectedIndex = -1;
|
|
37021
|
+
st.tile.backgrounds[1].color = brown;
|
|
37022
|
+
} else {
|
|
37023
|
+
st.radioH.selectedIndex = lastH;
|
|
37024
|
+
st.tile.backgrounds[1].color = light;
|
|
37025
|
+
}
|
|
37026
|
+
|
|
37027
|
+
if (lastV == "bad") {
|
|
37028
|
+
st.radioV.selectedIndex = -1;
|
|
37029
|
+
st.tile.backgrounds[3].color = brown;
|
|
37030
|
+
} else {
|
|
37031
|
+
st.radioV.selectedIndex = lastV;
|
|
37032
|
+
st.tile.backgrounds[3].color = light;
|
|
37033
|
+
}
|
|
37034
|
+
|
|
37035
|
+
} else {
|
|
37036
|
+
st.radioH.selectedIndex = -1;
|
|
37037
|
+
st.radioV.selectedIndex = -1;
|
|
37038
|
+
st.shield.vis(true);
|
|
37039
|
+
}
|
|
37040
|
+
});
|
|
37041
|
+
that.stage.update();
|
|
37042
|
+
return that;
|
|
37043
|
+
}
|
|
37044
|
+
|
|
37045
|
+
that.clearSelection = function() {
|
|
37046
|
+
selected = that.selected = [];
|
|
37047
|
+
highlights.disposeAllChildren();
|
|
37048
|
+
if (that.slicerTypes) {
|
|
37049
|
+
var st = that.slicerTypes;
|
|
37050
|
+
st.radioH.selectedIndex = -1;
|
|
37051
|
+
st.radioV.selectedIndex = -1;
|
|
37052
|
+
st.shield.vis(true);
|
|
37053
|
+
}
|
|
37054
|
+
that.stage.update();
|
|
37055
|
+
return that;
|
|
37056
|
+
}
|
|
37057
|
+
|
|
37058
|
+
that.clear = function() {
|
|
37059
|
+
if (localStorage) localStorage.removeItem("zimSlicer");
|
|
37060
|
+
that.exchange = [[[],[]],[[1],[1]]];
|
|
37061
|
+
that.clearSelection();
|
|
37062
|
+
that.dispatchEvent("change");
|
|
37063
|
+
return that;
|
|
37064
|
+
}
|
|
37065
|
+
|
|
37066
|
+
|
|
37067
|
+
// PROPERTIES
|
|
37068
|
+
Object.defineProperty(that, 'slices', {
|
|
37069
|
+
get: function() {
|
|
37070
|
+
var temp = zim.copy(that.data);
|
|
37071
|
+
temp[0].shift();
|
|
37072
|
+
temp[0].pop();
|
|
37073
|
+
temp[1].shift();
|
|
37074
|
+
temp[1].pop();
|
|
37075
|
+
return temp;
|
|
37076
|
+
},
|
|
37077
|
+
set: function(value) {
|
|
37078
|
+
var slices = zim.copy(value);
|
|
37079
|
+
slices[0].unshift(0);
|
|
37080
|
+
slices[0].push(1);
|
|
37081
|
+
slices[1].unshift(0);
|
|
37082
|
+
slices[1].push(1);
|
|
37083
|
+
that.updateLines(slices);
|
|
37084
|
+
}
|
|
37085
|
+
});
|
|
37086
|
+
|
|
37087
|
+
Object.defineProperty(that, 'types', {
|
|
37088
|
+
get: function() {
|
|
37089
|
+
return zim.copy(that.dataTypes);
|
|
37090
|
+
},
|
|
37091
|
+
set: function(value) {
|
|
37092
|
+
that.dataTypes = zim.copy(value);
|
|
37093
|
+
}
|
|
37094
|
+
});
|
|
37095
|
+
|
|
37096
|
+
Object.defineProperty(that, 'exchange', {
|
|
37097
|
+
get: function() {
|
|
37098
|
+
var temp = zim.copy(that.data);
|
|
37099
|
+
temp[0].shift();
|
|
37100
|
+
temp[0].pop();
|
|
37101
|
+
temp[1].shift();
|
|
37102
|
+
temp[1].pop();
|
|
37103
|
+
return [temp, zim.copy(that.dataTypes)];
|
|
37104
|
+
},
|
|
37105
|
+
set: function(value) {
|
|
37106
|
+
var slices = zim.copy(value[0]);
|
|
37107
|
+
var types = zim.copy(value[1]);
|
|
37108
|
+
slices[0].unshift(0);
|
|
37109
|
+
slices[0].push(1);
|
|
37110
|
+
slices[1].unshift(0);
|
|
37111
|
+
slices[1].push(1);
|
|
37112
|
+
that.updateLines(slices);
|
|
37113
|
+
that.dataTypes = types;
|
|
37114
|
+
}
|
|
37115
|
+
});
|
|
37116
|
+
|
|
37117
|
+
// MEMORY
|
|
37118
|
+
if (remember && localStorage && localStorage.zimSlicer) {
|
|
37119
|
+
that.exchange = JSON.parse(localStorage.zimSlicer);
|
|
37120
|
+
instruct.dispose();
|
|
37121
|
+
} else if (empty) {
|
|
37122
|
+
that.exchange =[slices, types];
|
|
37123
|
+
instruct.dispose();
|
|
37124
|
+
}
|
|
37125
|
+
setTimeout(function(){that.dispatchEvent("change");},20);
|
|
37126
|
+
|
|
37127
|
+
if (style!==false) zim.styleTransforms(this, DS);
|
|
37128
|
+
this.clone = function() {
|
|
37129
|
+
return that.cloneProps(new zim.Slicer(obj.clone(), objScale, zim.copy(slices), zim.copy(types), titleBar, remember, upload, selection, multiple, proportion, resize, style, this.group, inherit));
|
|
37130
|
+
};
|
|
37131
|
+
|
|
37132
|
+
}
|
|
37133
|
+
zim.extend(zim.Slicer, zim.Window, ["clone"], "zimWindow", false);
|
|
37134
|
+
//-62.7
|
|
37135
|
+
|
|
37136
|
+
//
|
|
37137
|
+
/*--
|
|
37138
|
+
zim.SlicerTypes = function(slicer, titleBar, sliceType, style, group, inherit);
|
|
37139
|
+
|
|
37140
|
+
SlicerTypes
|
|
37141
|
+
zim class - extends a zim.Window which extends a zim.Container which extends a createjs.Container
|
|
37142
|
+
|
|
37143
|
+
DESCRIPTION
|
|
37144
|
+
SlicerTypes works with ZIM Slicer to provide slice types for ZIM SlicedBitmap.
|
|
37145
|
+
The component is not to be used on its own.
|
|
37146
|
+
Pass a ZIM Slicer object to the slicer parameter - the Slicer should be made first.
|
|
37147
|
+
There are fixed, stretch and tile radio buttons for horizontal and vertical
|
|
37148
|
+
and import and export buttons to work with [slices, types] used in Slicer and SlicedBitmap parameters and exchange property.
|
|
37149
|
+
|
|
37150
|
+
See: https://zimjs.com/slicer which shows how a Slicer can be used to create data for a ZIM SlicedBitmap
|
|
37151
|
+
|
|
37152
|
+
NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
|
|
37153
|
+
|
|
37154
|
+
EXAMPLE
|
|
37155
|
+
// slice a pic in four at 25% from the edges, scale the middle and keep the sides and corners not scaled.
|
|
37156
|
+
const pic = new Pic("car.png"); // preload this in Frame() or loadAssets()
|
|
37157
|
+
const slicer = new Slicer({
|
|
37158
|
+
obj:pic.clone(), // slicer will adjust obj so clone the pic so can use it unaffected later
|
|
37159
|
+
scale:.5,
|
|
37160
|
+
upload:false
|
|
37161
|
+
})
|
|
37162
|
+
.pos(30,50)
|
|
37163
|
+
.change(()=>{preview.exchange = slicer.exchange;); // this will update the picture below
|
|
37164
|
+
|
|
37165
|
+
slicer.on("loaded", ()=>{
|
|
37166
|
+
if (preview) preview.dispose();
|
|
37167
|
+
preview = new zim.SlicedBitmap(1600, 600, slicer.obj.clone(), slicer.slices, slicer.types, 2, .5)
|
|
37168
|
+
.pos(0,100,CENTER,BOTTOM)
|
|
37169
|
+
.transform({minScaleX:.05, minScaleY:.05});
|
|
37170
|
+
});
|
|
37171
|
+
|
|
37172
|
+
// this will provide slice type options
|
|
37173
|
+
new SlicerTypes(slicer).pos(30,120,RIGHT,TOP);
|
|
37174
|
+
|
|
37175
|
+
// slice a pic in four at 25% from the edges, scale the middle and keep the sides and corners not scaled.
|
|
37176
|
+
let preview = new SlicedBitmap(1600, pic.height, pic)
|
|
37177
|
+
.center()
|
|
37178
|
+
.transform({minScaleX:.05, minScaleY:.05});
|
|
37179
|
+
END EXAMPLE
|
|
37180
|
+
|
|
37181
|
+
PARAMETERS
|
|
37182
|
+
** supports DUO - parameters or single object with properties below
|
|
37183
|
+
** supports OCT - parameter defaults can be set with STYLE control (like CSS)
|
|
37184
|
+
slicer - (default null) pass in the ZIM Slicer object to work with - required
|
|
37185
|
+
titleBar - (default "Slicer Types") string or Label for slicerTypes
|
|
37186
|
+
sliceType - (default "stretch") set the default slice type - fixed, stretch, tile
|
|
37187
|
+
style - (default true) set to false to ignore styles set with the STYLE - will receive original parameter defaults
|
|
37188
|
+
group - (default null) set to String (or comma delimited String) so STYLE can set default styles to the group(s) (like a CSS class)
|
|
37189
|
+
inherit - (default null) used internally but can receive an {} of styles directly
|
|
37190
|
+
|
|
37191
|
+
METHODS
|
|
37192
|
+
hasProp(property as String) - returns true if property exists on object else returns false
|
|
37193
|
+
clone() - makes a copy with properties such as x, y, etc. also copied
|
|
37194
|
+
dispose() - removes from parent, removes event listeners - must still set outside references to null for garbage collection
|
|
37195
|
+
|
|
37196
|
+
ALSO: All Window methods such as resize()
|
|
37197
|
+
|
|
37198
|
+
ALSO: ZIM 4TH adds all the methods listed under Container (see above), such as:
|
|
37199
|
+
drag(), hitTestRect(), animate(), sca(), reg(), mov(), center(), centerReg(),
|
|
37200
|
+
addTo(), removeFrom(), loop(), outline(), place(), pos(), alp(), rot(), setMask(), etc.
|
|
37201
|
+
ALSO: see the CreateJS Easel Docs for Container methods, such as:
|
|
37202
|
+
on(), off(), getBounds(), setBounds(), cache(), uncache(), updateCache(), dispatchEvent(),
|
|
37203
|
+
addChild(), removeChild(), addChildAt(), getChildAt(), contains(), removeAllChildren(), etc.
|
|
37204
|
+
|
|
37205
|
+
PROPERTIES
|
|
37206
|
+
type - holds the class name as a String
|
|
37207
|
+
slicer - read slicer used
|
|
37208
|
+
sliceType - get or set default slice type - fixed, stretch, tile
|
|
37209
|
+
radioH - access RadioButtons for horizontal
|
|
37210
|
+
radioV - access RadioButtons for horizontal
|
|
37211
|
+
importButton - access import Button
|
|
37212
|
+
exportButton - access export Button
|
|
37213
|
+
importPane - access import Pane
|
|
37214
|
+
exportPane - access export Pane
|
|
37215
|
+
submitButton - access import pane submit Button
|
|
37216
|
+
shield - access shield that darkens radio buttons
|
|
37217
|
+
|
|
37218
|
+
ALSO: see ZIM Window for properties - like titleBar, titleBarLabel, resizeHandle, etc.
|
|
37219
|
+
|
|
37220
|
+
ALSO: see ZIM Container for properties such as:
|
|
37221
|
+
width, height, widthOnly, heightOnly, draggable, level, depth, group
|
|
37222
|
+
blendMode, hue, saturation, brightness, contrast, etc.
|
|
37223
|
+
|
|
37224
|
+
ALSO: see the CreateJS Easel Docs for Container properties, such as:
|
|
37225
|
+
x, y, rotation, scaleX, scaleY, regX, regY, skewX, skewY,
|
|
37226
|
+
alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, etc.
|
|
37227
|
+
|
|
37228
|
+
EVENTS
|
|
37229
|
+
ALSO: all Window events including "collapse", "expand", "resize"
|
|
37230
|
+
|
|
37231
|
+
ALSO: see the CreateJS Easel Docs for Container events such as:
|
|
37232
|
+
added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmove, pressup, removed, rollout, rollover
|
|
37233
|
+
--*///+62.75
|
|
37234
|
+
zim.SlicerTypes = function(slicer, titleBar, sliceType, style, group, inherit) {
|
|
37235
|
+
var sig = "slicer, titleBar, sliceType, style, group, inherit";
|
|
37236
|
+
var duo; if (duo = zob(zim.SlicerTypes, arguments, sig, this)) return duo;
|
|
37237
|
+
z_d("62.75");
|
|
37238
|
+
this.group = group;
|
|
37239
|
+
var DS = style===false?{}:zim.getStyle("SlicerTypes", this.group, inherit);
|
|
37240
|
+
|
|
37241
|
+
if (zot(slicer)) slicer = DS.slicer!=null?DS.slicer:null;
|
|
37242
|
+
if (zot(slicer)) {zogy("ZIM SlicerTypes - needs a Slicer Object"); return;}
|
|
37243
|
+
|
|
37244
|
+
if (zot(titleBar)) titleBar = DS.titleBar!=null?DS.titleBar:"Slicer Types";
|
|
37245
|
+
if (zot(sliceType)) sliceType = DS.sliceType!=null?DS.sliceType:"stretch";
|
|
37246
|
+
|
|
37247
|
+
var types = ["fixed", "stretch", "tile"];
|
|
37248
|
+
if (types.indexOf(sliceType) < 0) sliceType = "stretch";
|
|
37249
|
+
|
|
37250
|
+
this.zimWindow_constructor(470,150, null, null, null, null, null, null, false, null, null, null, null, null, false, false, null, null, null, null, null, null, null, null, null, null, null,
|
|
37251
|
+
titleBar, dark, moon, null, true, null, null, null, null, null, null, null, null, true);
|
|
37252
|
+
var that = this;
|
|
37253
|
+
that.collapseIcon.mov(2);
|
|
37254
|
+
that.titleBarLabel.mov(25,1)
|
|
37255
|
+
zdf.makeIcon(tin, clear, [tin, tin, tin, tin, tin]).scaleTo(that.titleBar,87,87).loc(5,2,that.titleBar);
|
|
37256
|
+
|
|
37257
|
+
that.slicer = slicer;
|
|
37258
|
+
that.sliceType = sliceType;
|
|
37259
|
+
that.defaultIndex = types.indexOf(sliceType);
|
|
37260
|
+
|
|
37261
|
+
var holder = new zim.Container();
|
|
37262
|
+
var radioH = that.radioH = new zim.RadioButtons({size:20, buttons:["fixed","stretch","tile"], vertical:false, selectedIndex:-1}).change(doChangeH);
|
|
37263
|
+
var radioV = that.radioV = radioH.clone().change(doChangeV);
|
|
37264
|
+
Style.remember("slicer");
|
|
37265
|
+
STYLE = {align:CENTER, valign:CENTER, backgroundColor:light, backgroundPaddingH:5};
|
|
37266
|
+
var tile = that.tile = new zim.Tile([new Label("Horizontal", 20).alp(.5), radioH, new Label("Vertical", 20).alp(.5),radioV], 2,2, 5,5, true)
|
|
37267
|
+
.sca(.8)
|
|
37268
|
+
.addTo(holder);
|
|
37269
|
+
Style.recall("slicer");
|
|
37270
|
+
|
|
37271
|
+
function doChangeH() {
|
|
37272
|
+
zim.loop(slicer.selected, function(s) {
|
|
37273
|
+
slicer.dataTypes[0][s[0]] = radioH.selectedIndex;
|
|
37274
|
+
});
|
|
37275
|
+
slicer.dispatchEvent("change");
|
|
37276
|
+
tile.backgrounds[1].color = light;
|
|
37277
|
+
that.stage.update();
|
|
37278
|
+
if (localStorage) localStorage.zimSlicer = JSON.stringify(slicer.exchange);
|
|
37279
|
+
}
|
|
37280
|
+
function doChangeV() {
|
|
37281
|
+
zim.loop(slicer.selected, function(s) {
|
|
37282
|
+
slicer.dataTypes[1][s[1]] = radioV.selectedIndex;
|
|
37283
|
+
});
|
|
37284
|
+
slicer.dispatchEvent("change");
|
|
37285
|
+
tile.backgrounds[3].color = light;
|
|
37286
|
+
that.stage.update();
|
|
37287
|
+
if (localStorage) localStorage.zimSlicer = JSON.stringify(slicer.exchange);
|
|
37288
|
+
}
|
|
37289
|
+
|
|
37290
|
+
var importText = new zim.TextArea({width:600, height:300, wrap:true, spellCheck:false})
|
|
37291
|
+
var importPane = that.importPane = new zim.Pane({content:importText, close:true, closeColor:red});
|
|
37292
|
+
importPane.content.mov(0,-20);
|
|
37293
|
+
var submit = that.submitButton = new zim.Button({
|
|
37294
|
+
width:220,
|
|
37295
|
+
label:"IMPORT",
|
|
37296
|
+
wait:"CONFIRM",
|
|
37297
|
+
waitTime:2,
|
|
37298
|
+
waitBackgroundColor:red,
|
|
37299
|
+
rollWaitBackgroundColor:red
|
|
37300
|
+
}).sca(.6).pos(0,-60,CENTER,BOTTOM,importPane.content);
|
|
37301
|
+
submit.on("mousedown", function(){
|
|
37302
|
+
if (submit.waiting) {
|
|
37303
|
+
importPane.hide();
|
|
37304
|
+
submit.clearWait();
|
|
37305
|
+
slicer.clearSelection();
|
|
37306
|
+
var data = importText.text.trim().split("\n");
|
|
37307
|
+
// JSON does not accept decimals without a leading 0 - sigh
|
|
37308
|
+
data = data.pop().replace(/([^0])\./g, "$10."); // $1 is the match of whatever is before the .
|
|
37309
|
+
data = JSON.parse("[" + data + "]");
|
|
37310
|
+
that.updateData(data[0], data[1]);
|
|
37311
|
+
}
|
|
37312
|
+
});
|
|
37313
|
+
submit.on("close", function() {
|
|
37314
|
+
submit.clearWait();
|
|
37315
|
+
});
|
|
37316
|
+
|
|
37317
|
+
var exportText = new zim.TextArea({width:600, height:300, wrap:true, spellCheck:false});
|
|
37318
|
+
var exportPane = that.exportPane = new zim.Pane({content:exportText, close:true, closeColor:red});
|
|
37319
|
+
|
|
37320
|
+
var importButton = that.importButton = new zim.Button({width:220, label:"IMPORT"}).tap(function() {
|
|
37321
|
+
var temp = zim.copy(slicer.data);
|
|
37322
|
+
temp[0].shift();
|
|
37323
|
+
temp[0].pop();
|
|
37324
|
+
temp[1].shift();
|
|
37325
|
+
temp[1].pop();
|
|
37326
|
+
importText.text = "// replace this current data with desired slices, types data:\n\n" + JSON.stringify(temp) +", "+ JSON.stringify(slicer.dataTypes);
|
|
37327
|
+
importPane.show();
|
|
37328
|
+
});
|
|
37329
|
+
var exportButton = that.exportButton = new zim.Button({width:220, label:"EXPORT"}).tap(function() {
|
|
37330
|
+
var temp = zim.copy(slicer.data);
|
|
37331
|
+
temp[0].shift();
|
|
37332
|
+
temp[0].pop();
|
|
37333
|
+
temp[1].shift();
|
|
37334
|
+
temp[1].pop();
|
|
37335
|
+
exportText.text = "// use as slices, types parameters in ZIM SlicedBitmap()\n// can also modify and IMPORT into Slicer Types tool\n\n" + JSON.stringify(temp) +", "+ JSON.stringify(slicer.dataTypes);
|
|
37336
|
+
exportPane.show();
|
|
37337
|
+
})
|
|
37338
|
+
new zim.Tile([importButton,exportButton],1,2,0,20,true).siz(null,tile.height).loc(tile.width+4*5+20, 0, holder);
|
|
37339
|
+
that.add(holder, 0, true);
|
|
37340
|
+
|
|
37341
|
+
that.shield = new zim.Rectangle(tile.width+20, tile.height, dark).alp(.7).loc(tile, null, tile.parent);
|
|
37342
|
+
|
|
37343
|
+
Object.defineProperty(that, 'sliceType', {
|
|
37344
|
+
get: function() {
|
|
37345
|
+
return sliceType;
|
|
37346
|
+
},
|
|
37347
|
+
set: function(value) {
|
|
37348
|
+
sliceType = value;
|
|
37349
|
+
if (types.indexOf(sliceType) < 0) sliceType = "stretch";
|
|
37350
|
+
that.defaultIndex = types.indexOf(sliceType);
|
|
37351
|
+
}
|
|
37352
|
+
});
|
|
37353
|
+
|
|
37354
|
+
if (slicer) slicer.setSlicerTypes(that);
|
|
37355
|
+
|
|
37356
|
+
that.updateData = function(slices, types) {
|
|
37357
|
+
slices[0].unshift(0);
|
|
37358
|
+
slices[0].push(1);
|
|
37359
|
+
slices[1].unshift(0);
|
|
37360
|
+
slices[1].push(1);
|
|
37361
|
+
slicer.updateLines(slices);
|
|
37362
|
+
slicer.dataTypes = types;
|
|
37363
|
+
}
|
|
37364
|
+
|
|
37365
|
+
if (style!==false) zim.styleTransforms(this, DS);
|
|
37366
|
+
this.clone = function() {
|
|
37367
|
+
return that.cloneProps(new zim.SlicerTypes(slicer, titleBar, sliceType, style, this.group, inherit));
|
|
37368
|
+
};
|
|
37369
|
+
|
|
37370
|
+
}
|
|
37371
|
+
zim.extend(zim.SlicerTypes, zim.Window, ["clone"], "zimWindow", false);
|
|
37372
|
+
//-62.75
|
|
37373
|
+
|
|
35787
37374
|
/*--
|
|
35788
37375
|
zim.Dial = function(min, max, step, width, backgroundColor, indicatorColor, indicatorScale, indicatorType, useTicks, innerTicks, tickColor, tickStep, semiTicks, tickScale, semiTickScale, innerCircle, innerScale, innerColor, inner2Color, accentSize, accentOffset, accentColor, accentBackgroundColor, accentDifference, sound, linear, gap, limit, keyArrows, keyArrowsStep, keyArrowsH, keyArrowsV, continuous, continuousMin, continuousMax, damp, value, useLabels, labelMargin, addZero, currentValue, style, group, inherit);
|
|
35789
37376
|
|
|
@@ -37071,7 +38658,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
37071
38658
|
if (b && currentSelected) {
|
|
37072
38659
|
var ti = b.tabInfo;
|
|
37073
38660
|
if (ti && zot(ti.wait)) {
|
|
37074
|
-
// should be rollBackgroundColor but
|
|
38661
|
+
// should be rollBackgroundColor but setting it seems to stick after rolloff
|
|
37075
38662
|
if (ti.selectedBackgroundColor) b.backgroundColor = that.selected==b?ti.selectedBackgroundColor:ti.backgroundColor
|
|
37076
38663
|
if (ti.selectedColor && b.label) b.color = that.selected==b?ti.selectedColor:ti.color;
|
|
37077
38664
|
}
|
|
@@ -40243,8 +41830,8 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
40243
41830
|
if (zot(collapseColor)) collapseColor = DS.collapseColor!=null?DS.collapseColor:!zot(titleBarColor)?titleBarColor:zim.grey;
|
|
40244
41831
|
if (zot(collapsed)) collapsed=DS.collapsed!=null?DS.collapsed:false;
|
|
40245
41832
|
|
|
40246
|
-
// width, height, content, backgroundColor, borderColor, borderWidth, padding, corner, swipe, scrollBarActive, scrollBarDrag, scrollBarColor, scrollBarAlpha, scrollBarFade, scrollBarH, scrollBarV, slide, slideFactor, slideSnap, slideSnapDamp, interactive, shadowColor, shadowBlur, paddingH, paddingV, scrollWheel, damp, titleBar, titleBarColor, titleBarBackgroundColor, titleBarHeight, draggable, boundary, onTop, close, closeColor, cancelCurrentDrag, fullSize, fullSizeColor, resizeHandle, collapse, collapseColor, collapsed, optimize, resizeBoundary, resizeVisible, continuous,
|
|
40247
|
-
this.zimWindow_constructor(width, height, null, backgroundColor, null, DS.borderWidth!=null?DS.borderWidth:2, DS.padding!=null?DS.padding:10, DS.corner!=null?DS.corner:10, null, DS.scrollBarActive!=null?DS.scrollBarActive:true, DS.scrollBarDrag!=null?DS.scrollBarDrag:true, null, null, null, false, null, null, null, null, null, true, null, null, null, null, null, null, titleBar, titleBarColor, titleBarBackgroundColor, titleBarHeight, DS.draggable!=null?DS.draggable:true, null, null, DS.close!=null?DS.close:true, null, null, DS.fullSize!=null?DS.fullSize:false, null, DS.resizeHandle!=null?DS.resizeHandle:false, collapse, collapseColor, collapsed, null, null, style, group, zim.copy(DS));
|
|
41833
|
+
// width, height, content, backgroundColor, borderColor, borderWidth, padding, corner, swipe, scrollBarActive, scrollBarDrag, scrollBarColor, scrollBarAlpha, scrollBarFade, scrollBarH, scrollBarV, slide, slideFactor, slideSnap, slideSnapDamp, interactive, shadowColor, shadowBlur, paddingH, paddingV, scrollWheel, damp, titleBar, titleBarColor, titleBarBackgroundColor, titleBarHeight, draggable, boundary, onTop, close, closeColor, cancelCurrentDrag, fullSize, fullSizeColor, resizeHandle, collapse, collapseColor, collapsed, optimize, resizeBoundary, resizeVisible, continuous, style, group, inherit
|
|
41834
|
+
this.zimWindow_constructor(width, height, null, backgroundColor, null, DS.borderWidth!=null?DS.borderWidth:2, DS.padding!=null?DS.padding:10, DS.corner!=null?DS.corner:10, null, DS.scrollBarActive!=null?DS.scrollBarActive:true, DS.scrollBarDrag!=null?DS.scrollBarDrag:true, null, null, null, false, null, null, null, null, null, true, null, null, null, null, null, null, titleBar, titleBarColor, titleBarBackgroundColor, titleBarHeight, DS.draggable!=null?DS.draggable:true, null, null, DS.close!=null?DS.close:true, null, null, DS.fullSize!=null?DS.fullSize:false, null, DS.resizeHandle!=null?DS.resizeHandle:false, collapse, collapseColor, collapsed, null, null, null, null, style, group, zim.copy(DS));
|
|
40248
41835
|
this.type = "EmojiPicker";
|
|
40249
41836
|
var that = this;
|
|
40250
41837
|
|
|
@@ -45287,7 +46874,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
45287
46874
|
if (accept) uploadTag.setAttribute("accept", accept);
|
|
45288
46875
|
uploadTag.hidden = true;
|
|
45289
46876
|
uploadTag.zimDisplay = uploadTag.style.display || "inline-block";
|
|
45290
|
-
uploadTag.style.cssText = "border:thin solid grey; z-index:2; width:" +
|
|
46877
|
+
uploadTag.style.cssText = "border:thin solid grey; z-index:2; width:" + 0 + "px; height:" + 0 + "px; overflow:hidden; outline:none;"
|
|
45291
46878
|
+ "position:absolute; left:0px; top:0px; display:none; cursor:pointer; opacity: 0; filter: alpha(opacity=0);";
|
|
45292
46879
|
|
|
45293
46880
|
this.addEventListener('mousedown', function() { // added for zim.Accessibility
|
|
@@ -45677,10 +47264,12 @@ only if the TextArea is directly in the Pane or the page (not nested in further
|
|
|
45677
47264
|
|
|
45678
47265
|
NOTE: rotation and skewing of TextArea is not supported - although might work with custom CSS transformations
|
|
45679
47266
|
|
|
45680
|
-
NOTE: because of these limitations, consider the TextEditor as a solution.
|
|
47267
|
+
NOTE: because of these limitations, consider the TextEditor or TextInput as a solution.
|
|
45681
47268
|
The TextEditor allows you to use a Label which is a proper part of the Canvas
|
|
45682
47269
|
and then change the label with a pop-up editor that includes a TextArea.
|
|
45683
47270
|
SEE: https://zimjs.com/cat/texteditor.html
|
|
47271
|
+
TextInput is a one line input text field that is actually part of the canvas
|
|
47272
|
+
SEE https://zimjs.com/explore/textinput.html
|
|
45684
47273
|
|
|
45685
47274
|
NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
|
|
45686
47275
|
|
|
@@ -45878,19 +47467,48 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
45878
47467
|
}
|
|
45879
47468
|
var lastText = that.text;
|
|
45880
47469
|
var sYO = that.y;
|
|
47470
|
+
var lastHeight;
|
|
47471
|
+
that.taBlur = function() {
|
|
47472
|
+
if (WW.M && keyboardShift) {
|
|
47473
|
+
if (that.stage) {
|
|
47474
|
+
if (that.re) that.stage.frame.off("resize", that.re);
|
|
47475
|
+
that.stage.y = sYO;
|
|
47476
|
+
textareaTag.blur();
|
|
47477
|
+
that.resize();
|
|
47478
|
+
that.stage.update();
|
|
47479
|
+
}
|
|
47480
|
+
}
|
|
47481
|
+
if (that.stage) frame = that.stage.frame;
|
|
47482
|
+
if (frame.zil) WW.addEventListener("keydown", frame.zil[0]);
|
|
47483
|
+
that.dispatchEvent("blur");
|
|
47484
|
+
if (that.text != lastText) that.dispatchEvent("change");
|
|
47485
|
+
}
|
|
47486
|
+
function vvp() {
|
|
47487
|
+
if (M && !zot(lastHeight) && WW.visualViewport.height > lastHeight) {
|
|
47488
|
+
that.taBlur();
|
|
47489
|
+
WW.visualViewport.removeEventListener('resize', vvp);
|
|
47490
|
+
}
|
|
47491
|
+
lastHeight = WW.visualViewport.height;
|
|
47492
|
+
}
|
|
45881
47493
|
that.taFocus = function() {
|
|
45882
|
-
lastText = that.text;
|
|
47494
|
+
lastText = that.text;
|
|
45883
47495
|
if (WW.M && keyboardShift) {
|
|
45884
47496
|
if (that.re) that.stage.frame.off("resize", that.re);
|
|
45885
47497
|
that.re = that.stage.frame.on("resize", function(){
|
|
45886
47498
|
if (that.stage && h>that.stage.height/4) {
|
|
45887
47499
|
that.stage.y = that.stage.scaleY*(that.stage.height/4-h);
|
|
47500
|
+
that.resize();
|
|
45888
47501
|
that.stage.update();
|
|
45889
47502
|
}
|
|
45890
|
-
});
|
|
47503
|
+
});
|
|
47504
|
+
if (WW.visualViewport) {
|
|
47505
|
+
WW.visualViewport.removeEventListener('resize', vvp);
|
|
47506
|
+
WW.visualViewport.addEventListener('resize', vvp);
|
|
47507
|
+
}
|
|
45891
47508
|
var h = that.localToGlobal(0,0).y;
|
|
45892
47509
|
if (that.stage && h>that.stage.height/4) {
|
|
45893
47510
|
that.stage.y = that.stage.scaleY*(that.stage.height/4-h);
|
|
47511
|
+
that.resize();
|
|
45894
47512
|
that.stage.update();
|
|
45895
47513
|
}
|
|
45896
47514
|
}
|
|
@@ -45898,19 +47516,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
45898
47516
|
if (frame.zil) WW.removeEventListener("keydown", frame.zil[0]);
|
|
45899
47517
|
that.dispatchEvent("focus");
|
|
45900
47518
|
}
|
|
45901
|
-
|
|
45902
|
-
if (WW.M && keyboardShift) {
|
|
45903
|
-
if (that.stage) {
|
|
45904
|
-
if (that.re) that.stage.frame.off("resize", that.re);
|
|
45905
|
-
that.stage.y = sYO;
|
|
45906
|
-
that.stage.update();
|
|
45907
|
-
}
|
|
45908
|
-
}
|
|
45909
|
-
if (that.stage) frame = that.stage.frame;
|
|
45910
|
-
if (frame.zil) WW.addEventListener("keydown", frame.zil[0]);
|
|
45911
|
-
that.dispatchEvent("blur");
|
|
45912
|
-
if (that.text != lastText) that.dispatchEvent("change");
|
|
45913
|
-
}
|
|
47519
|
+
|
|
45914
47520
|
textareaTag.addEventListener('input', that.taInput);
|
|
45915
47521
|
textareaTag.addEventListener('focus', that.taFocus);
|
|
45916
47522
|
textareaTag.addEventListener('blur', that.taBlur);
|
|
@@ -45944,13 +47550,15 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
|
|
|
45944
47550
|
var displayProps = that.getConcatenatedMatrix().decompose();
|
|
45945
47551
|
var point = that.localToGlobal(padding, padding);
|
|
45946
47552
|
if (frame.retina) {
|
|
45947
|
-
var sc = zim.browserZoom();
|
|
47553
|
+
var sc = zim.browserZoom();
|
|
45948
47554
|
if (frame.tag) {
|
|
45949
47555
|
textarea.x = point.x/pRatio/sc;
|
|
45950
47556
|
textarea.y = point.y/pRatio/sc;
|
|
45951
47557
|
} else {
|
|
45952
|
-
|
|
45953
|
-
|
|
47558
|
+
var shiftX = (stage.x-stage.x/pRatio/sc)/frame.scale;
|
|
47559
|
+
var shiftY = (stage.y-stage.y/pRatio/sc)/frame.scale;
|
|
47560
|
+
textarea.x = frame.x/stage.scaleX + point.x/pRatio/sc - shiftX;
|
|
47561
|
+
textarea.y = frame.y/stage.scaleY + point.y/pRatio/sc - shiftY;
|
|
45954
47562
|
}
|
|
45955
47563
|
// CreateJS DOMElement is scaling tag as stage scales
|
|
45956
47564
|
zim.sca(textarea, displayProps.scaleX/pRatio/stage.scaleX/sc, displayProps.scaleY/pRatio/stage.scaleY/sc);
|
|
@@ -48857,7 +50465,7 @@ RETURNS obj for chaining
|
|
|
48857
50465
|
};//-47.95
|
|
48858
50466
|
|
|
48859
50467
|
/*--
|
|
48860
|
-
obj.drag = function(boundary, axis, overCursor, dragCursor, all, swipe, localBoundary, onTop, surround, slide, slideFactor, slideSnap, slideSnapDamp, reg, removeTweens, startBounds, rect, currentTarget, offStage, immediateBoundary, singleTouch)
|
|
50468
|
+
obj.drag = function(boundary, axis, overCursor, dragCursor, all, swipe, localBoundary, onTop, surround, slide, slideFactor, slideSnap, slideSnapDamp, reg, removeTweens, startBounds, rect, currentTarget, offStage, immediateBoundary, singleTouch, dropTargets, dropCopy, dropSnap, dropBack, dropEnd, dropFull, dropHitTest, dropScale, dropWidth, dropHeight)
|
|
48861
50469
|
|
|
48862
50470
|
drag
|
|
48863
50471
|
zim DisplayObject method
|
|
@@ -48868,6 +50476,12 @@ Handles scaled, rotated nested objects.
|
|
|
48868
50476
|
Also see draggable property for setting a default drag() and noDrag()
|
|
48869
50477
|
and to indicate whether a drag has been set.
|
|
48870
50478
|
|
|
50479
|
+
DROP
|
|
50480
|
+
As if ZIM 017, drop parameters and properties have been added.
|
|
50481
|
+
These allow List items to be dragged and dropped on targets and ZIM Lists
|
|
50482
|
+
Also see ZIM List drop parameters
|
|
50483
|
+
See https://zimjs.com/017/dropping.html
|
|
50484
|
+
|
|
48871
50485
|
NOTE: drag() will stop ZIM Swipe() from triggering a swipe event.
|
|
48872
50486
|
Set the overridNoSwipe parameter of ZIM Swipe() to true to capture swipe events.
|
|
48873
50487
|
|
|
@@ -48916,6 +50530,18 @@ circle.on("mousedown", ()=>{
|
|
|
48916
50530
|
circle.on("pressup", ()=>{circle.dragBoundary()});
|
|
48917
50531
|
END EXAMPLE
|
|
48918
50532
|
|
|
50533
|
+
EXAMPLE
|
|
50534
|
+
// Dropping on targets
|
|
50535
|
+
// see also https://zimjs.com/017/dropping.html
|
|
50536
|
+
const rectangles = new Tile(new Rectangle(130,130).reg(CENTER),3,1,50,0).pos(0,100,CENTER,CENTER);
|
|
50537
|
+
new Tile(new Circle(50,series(red,blue,pink)),3,1,70,0).pos(0,-100,CENTER,CENTER).drag({
|
|
50538
|
+
dropTargets:rectangles.items,
|
|
50539
|
+
// dropEnd:false,
|
|
50540
|
+
// dropCopy:true,
|
|
50541
|
+
// dropBack:false // and more!
|
|
50542
|
+
});
|
|
50543
|
+
END EXAMPLE
|
|
50544
|
+
|
|
48919
50545
|
PARAMETERS supports DUO - parameters or single object with properties below
|
|
48920
50546
|
boundary - (default null) a ZIM Boundary object for the drag boundary
|
|
48921
50547
|
or a ZIM DisplayObject including stage
|
|
@@ -48967,6 +50593,21 @@ immediateBoundary - (default false) set to true to add bounds immediately when d
|
|
|
48967
50593
|
this is normally set to false for a .05 second delay to allow objects to be added to Container before setting bounds.
|
|
48968
50594
|
singleTouch - (default false) set to true to let only one touch operate the drag
|
|
48969
50595
|
also see Frame() singleTouch setting - but setting on drag will only affect that object's drag
|
|
50596
|
+
dropTargets - an object or an array of objects that can receive a drop
|
|
50597
|
+
this can be a List or a Container or a single object
|
|
50598
|
+
if it is a list see the dropListProps as well to set reticle properties and scroll speed
|
|
50599
|
+
dropCopy - (default false) make a copy of the object as it is being dragged
|
|
50600
|
+
dropSnap - (default true) snap to the target object
|
|
50601
|
+
dropBack - (default true) go back to start if not dropped on a target
|
|
50602
|
+
dropEnd - (default true) once dropped on a target a noMouse() is set on the object
|
|
50603
|
+
dropFull - (default true) do not drop on a full target
|
|
50604
|
+
note - if the object is removed from the target then a drop can occur again on that target
|
|
50605
|
+
dropHitTest - (default "bounds") can also be "reg", "circles", "circle", "rect" - see ZIM HitTests
|
|
50606
|
+
dropScale - set a scale for the dropped object
|
|
50607
|
+
dropWidth - set a width for the dropped object - overrides scale
|
|
50608
|
+
height will keep aspect ratio unless dropHeight is provided
|
|
50609
|
+
dropHeight - set a height for the dropped object - overrides scale
|
|
50610
|
+
width will keep aspect ratio unless dropWidth is provided
|
|
48970
50611
|
|
|
48971
50612
|
note: will not update stage if OPTIMIZE is set to true
|
|
48972
50613
|
unless Ticker.update is set to true or you run Ticker.always(stage) see zim.Ticker
|
|
@@ -48974,6 +50615,19 @@ unless Ticker.update is set to true or you run Ticker.always(stage) see zim.Tick
|
|
|
48974
50615
|
PROPERTIES
|
|
48975
50616
|
adds a dragPaused property to get or set the pause of the drag - which allows setting to be kept
|
|
48976
50617
|
see also noDrag() where settings will be removed
|
|
50618
|
+
*** if dropTargets is set then drag() adds the following properties to the dragged object:
|
|
50619
|
+
dropTarget - on pressup, what target the object is dropped on (or null)
|
|
50620
|
+
dropList - which List if any a dropped object has
|
|
50621
|
+
dropListProps - to be used if planning on dropping object into a List
|
|
50622
|
+
The dropListProps have the following default values
|
|
50623
|
+
{
|
|
50624
|
+
color:white,
|
|
50625
|
+
thickness:1,
|
|
50626
|
+
alpha:1,
|
|
50627
|
+
speed:5
|
|
50628
|
+
}
|
|
50629
|
+
These can be changed to set List reticle properties and drop speed
|
|
50630
|
+
See the ZIM List drop parameters for more information
|
|
48977
50631
|
|
|
48978
50632
|
EVENTS
|
|
48979
50633
|
Adds a "slidestart" event to the drag object that is dispatched when the object starts sliding - if slide is true
|
|
@@ -48981,8 +50635,8 @@ Adds a "slidestop" event to the drag object that is dispatched when the object c
|
|
|
48981
50635
|
|
|
48982
50636
|
RETURNS obj for chaining
|
|
48983
50637
|
--*///+31
|
|
48984
|
-
zim.drag = function(obj, boundary, axis, overCursor, dragCursor, all, swipe, localBoundary, onTop, surround, slide, slideFactor, slideSnap, slideSnapDamp, reg, removeTweens, startBounds, rect, currentTarget, offStage, immediateBoundary, singleTouch) {
|
|
48985
|
-
var sig = "obj, boundary, axis, overCursor, dragCursor, all, swipe, localBoundary, onTop, surround, slide, slideFactor, slideSnap, slideSnapDamp, reg, removeTweens, startBounds, rect, currentTarget, offStage, immediateBoundary, singleTouch";
|
|
50638
|
+
zim.drag = function(obj, boundary, axis, overCursor, dragCursor, all, swipe, localBoundary, onTop, surround, slide, slideFactor, slideSnap, slideSnapDamp, reg, removeTweens, startBounds, rect, currentTarget, offStage, immediateBoundary, singleTouch, dropTargets, dropCopy, dropSnap, dropBack, dropEnd, dropFull, dropHitTest, dropScale, dropWidth, dropHeight) {
|
|
50639
|
+
var sig = "obj, boundary, axis, overCursor, dragCursor, all, swipe, localBoundary, onTop, surround, slide, slideFactor, slideSnap, slideSnapDamp, reg, removeTweens, startBounds, rect, currentTarget, offStage, immediateBoundary, singleTouch, dropTargets, dropCopy, dropSnap, dropBack, dropEnd, dropFull, dropHitTest, dropScale, dropWidth, dropHeight";
|
|
48986
50640
|
var duo; if (duo = zob(zim.drag, arguments, sig)) return duo;
|
|
48987
50641
|
if (obj.type=="AC"&&WW.zdf) {WW.zdf.ac("drag", arguments); return obj;}
|
|
48988
50642
|
z_d("31");
|
|
@@ -49033,7 +50687,20 @@ RETURNS obj for chaining
|
|
|
49033
50687
|
if (zot(startBounds)) startBounds = true;
|
|
49034
50688
|
if (zot(boundary) && !zot(rect)) boundary = rect;
|
|
49035
50689
|
if (zot(singleTouch)) singleTouch = false;
|
|
49036
|
-
|
|
50690
|
+
|
|
50691
|
+
if (dropTargets) {
|
|
50692
|
+
slide = false;
|
|
50693
|
+
obj.dropTargets = dropTargets;
|
|
50694
|
+
}
|
|
50695
|
+
if (zot(dropBack)) dropBack = true;
|
|
50696
|
+
if (zot(dropSnap)) dropSnap = true;
|
|
50697
|
+
if (zot(dropEnd)) dropEnd = true;
|
|
50698
|
+
if (zot(dropFull)) dropFull = true;
|
|
50699
|
+
var hitTypes = ["reg", "circles", "rect", "circle"];
|
|
50700
|
+
if (dropHitTest) dropHitTest.toLowerCase();
|
|
50701
|
+
if (!hitTypes.includes(dropHitTest)) dropHitTest = null;
|
|
50702
|
+
if (zot(dropHitTest)) dropHitTest = "bounds";
|
|
50703
|
+
|
|
49037
50704
|
obj.dragPaused = false;
|
|
49038
50705
|
|
|
49039
50706
|
if (slide) {
|
|
@@ -49174,6 +50841,7 @@ RETURNS obj for chaining
|
|
|
49174
50841
|
var stage;
|
|
49175
50842
|
obj.pointers = {};
|
|
49176
50843
|
var stCheck = false;
|
|
50844
|
+
var dropListCheck;
|
|
49177
50845
|
obj.zimDown = obj.on("mousedown", function(e) {
|
|
49178
50846
|
if (!obj.stage || obj.dragPaused) return;
|
|
49179
50847
|
if (singleTouch && stCheck) {
|
|
@@ -49185,6 +50853,7 @@ RETURNS obj for chaining
|
|
|
49185
50853
|
// obj.zimMove = obj.on("pressmove", obj.zimMove); // for some reason causing squiggle drag problems
|
|
49186
50854
|
|
|
49187
50855
|
stCheck = true;
|
|
50856
|
+
dropListCheck = false;
|
|
49188
50857
|
stage = obj.stage;
|
|
49189
50858
|
if (!obj.zmu) obj.zmu = stage.frame.on("mouseupplus", function(e) {
|
|
49190
50859
|
if (obj.downCheck) {
|
|
@@ -49192,6 +50861,7 @@ RETURNS obj for chaining
|
|
|
49192
50861
|
doUp(e, true); // true for cancel slide
|
|
49193
50862
|
}
|
|
49194
50863
|
});
|
|
50864
|
+
|
|
49195
50865
|
obj.dragMouseX = Math.round(e.stageX/zim.scaX)+stage.x;
|
|
49196
50866
|
obj.dragMouseY = Math.round(e.stageY/zim.scaY)+stage.y;
|
|
49197
50867
|
var id = "id"+Math.abs(e.pointerID+1);
|
|
@@ -49201,6 +50871,8 @@ RETURNS obj for chaining
|
|
|
49201
50871
|
// bring stageX and stageY into the parent's frame of reference
|
|
49202
50872
|
// could use e.localX and e.localY but might be dragging container or contents
|
|
49203
50873
|
dragObject = (currentTarget)?e.currentTarget:e.target;
|
|
50874
|
+
|
|
50875
|
+
|
|
49204
50876
|
if (obj.zimBoundary && !dragObject.getBounds()) {zogy("zim.drag() - drag object needs bounds set"); return;}
|
|
49205
50877
|
obj.downCheck = true;
|
|
49206
50878
|
obj.stage.mouseMoveOutside = true;
|
|
@@ -49268,6 +50940,44 @@ RETURNS obj for chaining
|
|
|
49268
50940
|
moveCheck = false;
|
|
49269
50941
|
}
|
|
49270
50942
|
|
|
50943
|
+
// DROP - added ZIM 017 Patch
|
|
50944
|
+
if (zot(dragObject.dropStartS)) {
|
|
50945
|
+
dragObject.dropStartX = dragObject.x;
|
|
50946
|
+
dragObject.dropStartY = dragObject.y;
|
|
50947
|
+
dragObject.dropStartS = dragObject.scale;
|
|
50948
|
+
}
|
|
50949
|
+
if (obj.dropTargets && dropCopy && !dragObject.dropClone) {
|
|
50950
|
+
if (dragObject.clone) {
|
|
50951
|
+
dragObject.dropCopy = dragObject.clone(true).addTo(dragObject.parent, dragObject.parent.getChildIndex(dragObject));
|
|
50952
|
+
dragObject.dropCopy.dropClone = true;
|
|
50953
|
+
dragObject.dropCopy.dropStartX = dragObject.dropStartX;
|
|
50954
|
+
dragObject.dropCopy.dropStartY = dragObject.dropStartY;
|
|
50955
|
+
dragObject.dropCopy.dropStartS = dragObject.dropStartS;
|
|
50956
|
+
dragObject.dropCopy.noMouse();
|
|
50957
|
+
}
|
|
50958
|
+
}
|
|
50959
|
+
// HANDLE DROP ON LIST
|
|
50960
|
+
if (obj.dropTargets) {
|
|
50961
|
+
var notList = true;
|
|
50962
|
+
zim.loop(obj.dropTargets, function(target){
|
|
50963
|
+
if (target.type == "List") {
|
|
50964
|
+
if (!obj.dropListProps) obj.dropListProps = {
|
|
50965
|
+
color:white,
|
|
50966
|
+
thickness:1,
|
|
50967
|
+
alpha:1,
|
|
50968
|
+
speed:5
|
|
50969
|
+
};
|
|
50970
|
+
if (!target.dropReticle) {
|
|
50971
|
+
target.dropReticle = new zim.Rectangle(20,20,clear,obj.dropListProps.color,obj.dropListProps.thickness).reg(CENTER).rot(45).alp(obj.dropListProps.alpha);
|
|
50972
|
+
target.dropReticleIndex = null;
|
|
50973
|
+
target.zgb = target.boundsToGlobal();
|
|
50974
|
+
target.zgs = target.getConcatenatedDisplayProps().matrix.decompose().scaleX/stage.scaleX;
|
|
50975
|
+
}
|
|
50976
|
+
notList = false;
|
|
50977
|
+
}
|
|
50978
|
+
});
|
|
50979
|
+
dropListCheck = !notList;
|
|
50980
|
+
}
|
|
49271
50981
|
}, true);
|
|
49272
50982
|
|
|
49273
50983
|
obj.zimMove = obj.on("pressmove", function(e) {
|
|
@@ -49289,8 +50999,18 @@ RETURNS obj for chaining
|
|
|
49289
50999
|
if (dragObject.ZIMoutlineShape) dragObject.outline();
|
|
49290
51000
|
if (obj.type == "Pen" && !moveCheck && obj.drawing) moveCheck = true;
|
|
49291
51001
|
else if (obj.type == "Tag" || obj.type == "TextArea" || obj.type == "Loader") obj.resize();
|
|
51002
|
+
|
|
51003
|
+
// DROP ON LIST - added ZIM 017
|
|
51004
|
+
if (dropListCheck) {
|
|
51005
|
+
// scroll if ghost is at edges of scrollable list
|
|
51006
|
+
var ghost = dragObject;
|
|
51007
|
+
var checkItem;
|
|
51008
|
+
var dropScrollSpeed = obj.dropListProps.speed;
|
|
51009
|
+
zim.List.doDropOver(dropTargets, ghost, checkItem, dropScrollSpeed);
|
|
51010
|
+
}
|
|
49292
51011
|
}, true);
|
|
49293
51012
|
|
|
51013
|
+
|
|
49294
51014
|
// obj.off("pressmove",obj.zimMove); // for some reason causing squiggle drag problems
|
|
49295
51015
|
|
|
49296
51016
|
function positionObject(o, x, y) {
|
|
@@ -49369,6 +51089,7 @@ RETURNS obj for chaining
|
|
|
49369
51089
|
}
|
|
49370
51090
|
}
|
|
49371
51091
|
|
|
51092
|
+
|
|
49372
51093
|
obj.zimPosition = positionObject;
|
|
49373
51094
|
|
|
49374
51095
|
obj.zimUp = obj.on("pressup", function(e){doUp(e);}, true);
|
|
@@ -49456,9 +51177,96 @@ RETURNS obj for chaining
|
|
|
49456
51177
|
// if (moveCheck) obj.stopCheck();
|
|
49457
51178
|
}
|
|
49458
51179
|
}
|
|
51180
|
+
|
|
51181
|
+
// DROP - added ZIM 017 patch
|
|
51182
|
+
|
|
51183
|
+
if (obj.dropTargets) {
|
|
51184
|
+
if (!Array.isArray(obj.dropTargets)) obj.dropTargets = [obj.dropTargets];
|
|
51185
|
+
// watch - could drop from one target to another
|
|
51186
|
+
if (dragObject.droppedTarget) {
|
|
51187
|
+
dragObject.droppedTarget.dropFull = false;
|
|
51188
|
+
dragObject.droppedTarget = null;
|
|
51189
|
+
}
|
|
51190
|
+
var miss = zim.loop(obj.dropTargets, function(target) {
|
|
51191
|
+
|
|
51192
|
+
if (target.type == "List") {
|
|
51193
|
+
if (target.scrollInt) target.scrollInt.clear();
|
|
51194
|
+
if (!zot(target.dropReticleIndex)) {
|
|
51195
|
+
target.dropReticle.removeFrom();
|
|
51196
|
+
var placeObject = dragObject;
|
|
51197
|
+
if (dropCopy) {
|
|
51198
|
+
// need to do the swap on one of these
|
|
51199
|
+
if (dropCopy && dragObject.dropCopy) {
|
|
51200
|
+
placeObject = dragObject.dropCopy;
|
|
51201
|
+
swapProperties("x", dragObject, placeObject);
|
|
51202
|
+
swapProperties("y", dragObject, placeObject);
|
|
51203
|
+
}
|
|
51204
|
+
}
|
|
51205
|
+
if (dropScale) placeObject.sca(dropScale);
|
|
51206
|
+
if (dropWidth || dropHeight) placeObject.siz(dropWidth, dropHeight);
|
|
51207
|
+
if (dropEnd) placeObject.noMouse();
|
|
51208
|
+
else placeObject.mouse();
|
|
51209
|
+
placeObject.droppedTarget = target;
|
|
51210
|
+
target.addAt(placeObject, target.dropReticleIndex);
|
|
51211
|
+
|
|
51212
|
+
target.dropItem = dragObject;
|
|
51213
|
+
target.dropList = target;
|
|
51214
|
+
target.dropNewIndex = target.dropReticleIndex;
|
|
51215
|
+
target.dropReticleIndex = null;
|
|
51216
|
+
return false
|
|
51217
|
+
}
|
|
51218
|
+
return;
|
|
51219
|
+
}
|
|
51220
|
+
|
|
51221
|
+
if (dragObject["hitTest"+String(dropHitTest).charAt(0).toUpperCase() + String(dropHitTest).slice(1)](target)) {
|
|
51222
|
+
if (!dropFull || !target.dropFull) {
|
|
51223
|
+
var placeObject = dragObject;
|
|
51224
|
+
if (dropCopy && dragObject.dropCopy) {
|
|
51225
|
+
placeObject = dragObject.dropCopy;
|
|
51226
|
+
swapProperties("x", dragObject, placeObject);
|
|
51227
|
+
swapProperties("y", dragObject, placeObject);
|
|
51228
|
+
}
|
|
51229
|
+
// clone gets all these things
|
|
51230
|
+
if (dropSnap) placeObject.loc(target);
|
|
51231
|
+
if (dropScale) placeObject.sca(dropScale);
|
|
51232
|
+
if (dropWidth || dropHeight) placeObject.siz(dropWidth, dropHeight);
|
|
51233
|
+
if (dropEnd) placeObject.noMouse();
|
|
51234
|
+
else placeObject.mouse();
|
|
51235
|
+
if (dropFull) target.dropFull = true;
|
|
51236
|
+
placeObject.droppedTarget = target;
|
|
51237
|
+
return false;
|
|
51238
|
+
}
|
|
51239
|
+
}
|
|
51240
|
+
});
|
|
51241
|
+
if (miss) {
|
|
51242
|
+
if (dropBack) {
|
|
51243
|
+
dragObject.animate({
|
|
51244
|
+
props:{x:dragObject.dropStartX, y:dragObject.dropStartY, scale:dragObject.dropStartS},
|
|
51245
|
+
time:.2,
|
|
51246
|
+
timeUnit:"s",
|
|
51247
|
+
call:function(target) {
|
|
51248
|
+
if (dropCopy) {
|
|
51249
|
+
if (target.dropCopy) target.dropCopy.dispose();
|
|
51250
|
+
else target.dispose();
|
|
51251
|
+
}
|
|
51252
|
+
}
|
|
51253
|
+
});
|
|
51254
|
+
} else {
|
|
51255
|
+
dragObject.sca(dragObject.dropStartS);
|
|
51256
|
+
if (dropCopy && dragObject.dropCopy) {
|
|
51257
|
+
swapProperties("x", dragObject, dragObject.dropCopy);
|
|
51258
|
+
swapProperties("y", dragObject, dragObject.dropCopy);
|
|
51259
|
+
dragObject.dropCopy.mouse();
|
|
51260
|
+
}
|
|
51261
|
+
}
|
|
51262
|
+
|
|
51263
|
+
}
|
|
51264
|
+
}
|
|
49459
51265
|
if (obj.stage) obj.stage.update();
|
|
49460
51266
|
}
|
|
49461
51267
|
|
|
51268
|
+
|
|
51269
|
+
|
|
49462
51270
|
// the bounds check for registration inside the bounds
|
|
49463
51271
|
// or if surround is set for the whole object staying outside the bounds
|
|
49464
51272
|
function checkBounds(o, x, y) {
|
|
@@ -50249,7 +52057,7 @@ RETURNS obj for chaining
|
|
|
50249
52057
|
};//-33.18
|
|
50250
52058
|
|
|
50251
52059
|
/*--
|
|
50252
|
-
obj.transform = function(move, stretchX, stretchY, scale, rotate, allowToggle, visible, onTop, showStretch, showRotate, showScale, showReg, showBorder, borderColor, borderWidth, dashed, customCursors, handleSize, regSize, snapDistance, snapRotation, cache, events, ghostColor, ghostWidth, ghostDashed, ghostHidden, frame, container)
|
|
52060
|
+
obj.transform = function(move, stretchX, stretchY, scale, rotate, allowToggle, visible, onTop, showStretch, showRotate, showScale, showReg, showBorder, borderColor, borderWidth, dashed, customCursors, handleSize, regSize, snapDistance, snapRotation, cache, events, ghostColor, ghostWidth, ghostDashed, ghostHidden, frame, container, minScaleX, maxScaleX, minScaleY, maxScaleY, sliceX, sliceY)
|
|
50253
52061
|
|
|
50254
52062
|
transform
|
|
50255
52063
|
zim DisplayObject method
|
|
@@ -50342,6 +52150,12 @@ container (default stage) - set to a container to keep transforms within that co
|
|
|
50342
52150
|
normally leave as default so transforms will stay above other objects
|
|
50343
52151
|
but on occasion such as when using with ZIM TextureActives, a container is required
|
|
50344
52152
|
as the container is cached and used on a texture
|
|
52153
|
+
minScaleX (default null) - set a min scale in the x for the transform
|
|
52154
|
+
maxScaleX (default null) - set a max scale in the x for the transform
|
|
52155
|
+
minScaleY (default null) - set a min scale in the y for the transform
|
|
52156
|
+
maxScaleY (default null) - set a max scale in the y for the transform
|
|
52157
|
+
sliceX (default true) - this is for transforming ScaledBitmap objects in x - to use slicesWidth on edges. Set to false to use width.
|
|
52158
|
+
sliceY (default true) - this is for transforming ScaledBitmap objects in y - to use slicesWidth on edges. Set to false to use width.
|
|
50345
52159
|
|
|
50346
52160
|
PROPERTIES
|
|
50347
52161
|
toggled - adds a read-only Boolean to the object that is true if controls are showing otherwise false
|
|
@@ -50401,8 +52215,8 @@ If TransformManager() is used there are more events available such as "persistse
|
|
|
50401
52215
|
|
|
50402
52216
|
RETURNS obj for chaining
|
|
50403
52217
|
--*///+33.5
|
|
50404
|
-
zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowToggle, visible, onTop, showStretch, showRotate, showScale, showReg, showBorder, borderColor, borderWidth, dashed, customCursors, handleSize, regSize, snapDistance, snapRotation, cache, events, ghostColor, ghostWidth, ghostDashed, ghostHidden, frame, container) {
|
|
50405
|
-
var sig = "obj, move, stretchX, stretchY, scale, rotate, allowToggle, visible, onTop, showStretch, showRotate, showScale, showReg, showBorder, borderColor, borderWidth, dashed, customCursors, handleSize, regSize, snapDistance, snapRotation, cache, events, ghostColor, ghostWidth, ghostDashed, ghostHidden, frame, container";
|
|
52218
|
+
zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowToggle, visible, onTop, showStretch, showRotate, showScale, showReg, showBorder, borderColor, borderWidth, dashed, customCursors, handleSize, regSize, snapDistance, snapRotation, cache, events, ghostColor, ghostWidth, ghostDashed, ghostHidden, frame, container, minScaleX, maxScaleX, minScaleY, maxScaleY, sliceX, sliceY) {
|
|
52219
|
+
var sig = "obj, move, stretchX, stretchY, scale, rotate, allowToggle, visible, onTop, showStretch, showRotate, showScale, showReg, showBorder, borderColor, borderWidth, dashed, customCursors, handleSize, regSize, snapDistance, snapRotation, cache, events, ghostColor, ghostWidth, ghostDashed, ghostHidden, frame, container, minScaleX, maxScaleX, minScaleY, maxScaleY, sliceX, sliceY";
|
|
50406
52220
|
var duo; if (duo = zob(zim.transform, arguments, sig)) return duo;
|
|
50407
52221
|
if (obj.type=="AC"&&WW.zdf) {WW.zdf.ac("transform", arguments); return obj;}
|
|
50408
52222
|
z_d("33.5");
|
|
@@ -50448,6 +52262,14 @@ zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowTogg
|
|
|
50448
52262
|
if (zot(events)) events = false;
|
|
50449
52263
|
if (obj.type == "Tag" || obj.type == "TextArea" || obj.type == "Loader") events = true;
|
|
50450
52264
|
|
|
52265
|
+
if (zot(minScaleX)) minScaleX = -Number.MAX_VALUE;
|
|
52266
|
+
if (zot(maxScaleX)) maxScaleX = Number.MAX_VALUE;
|
|
52267
|
+
if (zot(minScaleY)) minScaleY = -Number.MAX_VALUE;
|
|
52268
|
+
if (zot(maxScaleY)) maxScaleY = Number.MAX_VALUE;
|
|
52269
|
+
|
|
52270
|
+
if (zot(sliceX)) sliceX = true;
|
|
52271
|
+
if (zot(sliceY)) sliceY = true;
|
|
52272
|
+
|
|
50451
52273
|
obj.zimMCO = obj.mouseChildren;
|
|
50452
52274
|
obj.mouseChildren = false;
|
|
50453
52275
|
var con = obj.getConcatenatedMatrix().decompose();
|
|
@@ -50737,6 +52559,10 @@ zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowTogg
|
|
|
50737
52559
|
if (frame.ctrlKey && obj.transformControls.visible) {
|
|
50738
52560
|
obj.scaleX = 1;
|
|
50739
52561
|
obj.scaleY = 1;
|
|
52562
|
+
if (obj.type=="SlicedBitmap") {
|
|
52563
|
+
if (sliceX) obj.slicesScaleX = 1;
|
|
52564
|
+
if (sliceY) obj.slicesScaleY = 1;
|
|
52565
|
+
}
|
|
50740
52566
|
obj.rotation = 0;
|
|
50741
52567
|
// if (customCursors) moveCursor.rot(obj.rotation);
|
|
50742
52568
|
makeControls();
|
|
@@ -50793,6 +52619,8 @@ zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowTogg
|
|
|
50793
52619
|
var startY; // target start y
|
|
50794
52620
|
var startSX;
|
|
50795
52621
|
var startSY;
|
|
52622
|
+
var startSSX; // for SlicedBitmap
|
|
52623
|
+
var startSSY;
|
|
50796
52624
|
var startR; // rotation of object to start
|
|
50797
52625
|
var startAngle; // angle of mouse down to x axis
|
|
50798
52626
|
var diffX;
|
|
@@ -50915,6 +52743,10 @@ zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowTogg
|
|
|
50915
52743
|
objStartY = obj.y;
|
|
50916
52744
|
startSX = obj.scaleX;
|
|
50917
52745
|
startSY = obj.scaleY;
|
|
52746
|
+
if (obj.type=="SlicedBitmap") {
|
|
52747
|
+
startSSX = obj.slicesScaleX;
|
|
52748
|
+
startSSY = obj.slicesScaleY;
|
|
52749
|
+
}
|
|
50918
52750
|
var pp = container.globalToLocal(e.stageX/zim.scaX, e.stageY/zim.scaY);
|
|
50919
52751
|
if (e.target.controlType == "rotate") {
|
|
50920
52752
|
rotateCheck = true;
|
|
@@ -50967,11 +52799,13 @@ zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowTogg
|
|
|
50967
52799
|
}
|
|
50968
52800
|
|
|
50969
52801
|
if (e.target.controlType == "corner") {
|
|
50970
|
-
obj.scaleX = scale * startSX;
|
|
50971
|
-
obj.scaleY = scale * startSY;
|
|
52802
|
+
obj.scaleX = zim.constrain(scale * startSX, minScaleX, maxScaleX);
|
|
52803
|
+
obj.scaleY = zim.constrain(scale * startSY, minScaleY, maxScaleY);
|
|
50972
52804
|
} else {
|
|
50973
|
-
obj.scaleX = (e.target.cu == "e-resize") ? scale * startSX : startSX;
|
|
50974
|
-
obj.
|
|
52805
|
+
if (obj.type != "SlicedBitmap" || !sliceX) obj.scaleX = zim.constrain((e.target.cu == "e-resize") ? scale * startSX : startSX, minScaleX, maxScaleX);
|
|
52806
|
+
else obj.ssX = zim.constrain((e.target.cu == "e-resize") ? scale * startSSX : startSSX, minScaleX, maxScaleX);
|
|
52807
|
+
if (obj.type != "SlicedBitmap" || !sliceY) obj.scaleY = zim.constrain((e.target.cu == "n-resize") ? scale * startSY : startSY, minScaleY, maxScaleY);
|
|
52808
|
+
else obj.ssY = zim.constrain((e.target.cu == "n-resize") ? scale * startSSY : startSSY, minScaleY, maxScaleY);
|
|
50975
52809
|
}
|
|
50976
52810
|
makeControls();
|
|
50977
52811
|
var pp = container.globalToLocal(e.stageX/zim.scaX, e.stageY/zim.scaY);
|
|
@@ -51046,7 +52880,12 @@ zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowTogg
|
|
|
51046
52880
|
}
|
|
51047
52881
|
if (cursors) tCheck = squares.hitTestPoint(pp.x, pp.y);
|
|
51048
52882
|
} else if (type == "side") {
|
|
51049
|
-
if (
|
|
52883
|
+
if (
|
|
52884
|
+
obj.scaleX != startProperties.scaleX ||
|
|
52885
|
+
obj.scaleY != startProperties.scaleY ||
|
|
52886
|
+
(sliceX && obj.type=="SlicedBitmap" && obj.slicesScaleX != startProperties.slicesScaleX) ||
|
|
52887
|
+
(sliceY && obj.type=="SlicedBitmap" && obj.slicesScaleY != startProperties.slicesScaleY)
|
|
52888
|
+
) {
|
|
51050
52889
|
transformEvent = new createjs.Event("transformed");
|
|
51051
52890
|
transformEvent.transformType = "stretch";
|
|
51052
52891
|
}
|
|
@@ -51276,6 +53115,10 @@ zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowTogg
|
|
|
51276
53115
|
|
|
51277
53116
|
function getStartProperies() {
|
|
51278
53117
|
startProperties = {x:obj.x, y:obj.y, rotation:obj.rotation, regX:obj.regX, regY:obj.regY, scaleX:obj.scaleX, scaleY:obj.scaleY};
|
|
53118
|
+
if (obj.type=="SlicedBitmap") {
|
|
53119
|
+
if (sliceX) startProperties.slicesScaleX = obj.slicesScaleX;
|
|
53120
|
+
if (sliceY) startProperties.slicesScaleY = obj.slicesScaleY;
|
|
53121
|
+
}
|
|
51279
53122
|
}
|
|
51280
53123
|
var startProperties;
|
|
51281
53124
|
getStartProperies();
|
|
@@ -51413,6 +53256,10 @@ zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowTogg
|
|
|
51413
53256
|
regY:obj.regY,
|
|
51414
53257
|
controls:obj.transformControls.visible
|
|
51415
53258
|
};
|
|
53259
|
+
if (obj.type=="SlicedBitmap") {
|
|
53260
|
+
if (sliceX) data.slicesScaleX = obj.slicesScaleX;
|
|
53261
|
+
if (sliceY) data.slicesScaleY = obj.slicesScaleY;
|
|
53262
|
+
}
|
|
51416
53263
|
return toJSON ? JSON.stringify(data) : data;
|
|
51417
53264
|
},
|
|
51418
53265
|
setData:function(data, fromJSON) {
|
|
@@ -51473,7 +53320,7 @@ zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowTogg
|
|
|
51473
53320
|
makeControls();
|
|
51474
53321
|
drawDragger();
|
|
51475
53322
|
setRotators();
|
|
51476
|
-
if (visible) obj.transformControls.show(); // bring on top
|
|
53323
|
+
if (obj.transformControls.visible) obj.transformControls.show(); // bring on top
|
|
51477
53324
|
if (dispatch) {
|
|
51478
53325
|
var transformEvent = new createjs.Event("transformed");
|
|
51479
53326
|
transformEvent.pressup = true;
|
|
@@ -53892,6 +55739,11 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
|
|
|
53892
55739
|
}
|
|
53893
55740
|
sequenceTarget = target;
|
|
53894
55741
|
target = newTarget;
|
|
55742
|
+
sequenceTarget.animating = true;
|
|
55743
|
+
}
|
|
55744
|
+
function sequenceDone() {
|
|
55745
|
+
sequenceTarget.animating = false;
|
|
55746
|
+
if (call) call(params||sequenceTarget);
|
|
53895
55747
|
}
|
|
53896
55748
|
|
|
53897
55749
|
// PREPARE ZIK RANDOM VALUES PASSED IN AS ARRAY OR RAND OBJECT {min, max, integer, negative}
|
|
@@ -53935,8 +55787,10 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
|
|
|
53935
55787
|
rrr = rate + (tar.ratio?tar.ratio:0);
|
|
53936
55788
|
}
|
|
53937
55789
|
var seqTime = i*sequence;
|
|
53938
|
-
if (i==0 && sequence!=0) seqTime = timeType=="s"?.02:20; // patched in 10.7.0 and 10.7.1
|
|
53939
|
-
|
|
55790
|
+
if (i==0 && sequence!=0) seqTime = timeType=="s"?.02:20; // patched in 10.7.0 and 10.7.1
|
|
55791
|
+
|
|
55792
|
+
// zim.animate(tar, tar.zimObj, time, ease, (i==target.length-1?call:null), (i==target.length-1?params:null)
|
|
55793
|
+
zim.animate(tar, tar.zimObj, time, ease, (i==target.length-1?sequenceDone:null), null, wait, waitedCall, waitedParams, null, null, null, null, null, null, null, loopPick, null, null, null, null, null, null, rewindTime, rewindEase, startCall, startParams, animateCall, animateParams, null, sequenceCall, sequenceParams, null, null, ticker, zim.copy(cjsProps), css, protect, override, null, set, id, events, sequenceTarget, dynamic, drag, clamp, startPaused, clean, obj, seriesWait, seqTime, rrr, pauseOnBlur, easeAmount, easeFrequency, timeUnit, timeCheck, noAnimateCall, pathDamp); // do not send from!
|
|
53940
55794
|
|
|
53941
55795
|
}
|
|
53942
55796
|
return sequenceTarget;
|
|
@@ -54348,7 +56202,7 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
|
|
|
54348
56202
|
if (typeof target.zimLastObj[o] == "string" && o != "transform") {
|
|
54349
56203
|
target.zimLastObj[o] = target[o] + Number(target.zimLastObj[o].replace(/\s/g,""));
|
|
54350
56204
|
}
|
|
54351
|
-
setValue(target, o, target.zimLastObj[o]);
|
|
56205
|
+
setValue(target, o, target.zimLastObj[o]);
|
|
54352
56206
|
});
|
|
54353
56207
|
// zim.loop(obj, function (o) {
|
|
54354
56208
|
// if (typeof obj[o] == "string") {
|
|
@@ -54473,6 +56327,22 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
|
|
|
54473
56327
|
}
|
|
54474
56328
|
}
|
|
54475
56329
|
|
|
56330
|
+
|
|
56331
|
+
// moved these to before protect (to catch scale convert) - ZIM Cat
|
|
56332
|
+
// PREPARE ZIK RANDOM VALUES PASSED IN AS ARRAY OR RAND OBJECT {min, max, integer, negative}
|
|
56333
|
+
// moved to before color code - ZIM 017
|
|
56334
|
+
var savedPicks = {};
|
|
56335
|
+
for (i in obj) {
|
|
56336
|
+
// zogb(i)
|
|
56337
|
+
if (extraTypes.indexOf(i) >= 0) continue; // skip for extras
|
|
56338
|
+
savedPicks[i] = zim.copy(obj[i]); // store pre picked to use if loopPick is true
|
|
56339
|
+
obj[i] = zim.Pick.choose(obj[i], null, target);
|
|
56340
|
+
}
|
|
56341
|
+
if (!zot(obj.scale)) {
|
|
56342
|
+
obj.scaleX = obj.scaleY = zim.Pick.choose(obj.scale, null, target);
|
|
56343
|
+
delete obj.scale;
|
|
56344
|
+
}
|
|
56345
|
+
|
|
54476
56346
|
// convert color tween - added protect for colorRange in ZIM 016
|
|
54477
56347
|
var colorBusy = target.zimBusy && target.zimBusy.colorRange;
|
|
54478
56348
|
if (!colorBusy) {
|
|
@@ -54525,19 +56395,6 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
|
|
|
54525
56395
|
}
|
|
54526
56396
|
|
|
54527
56397
|
|
|
54528
|
-
// moved these to before protect (to catch scale convert) - ZIM Cat
|
|
54529
|
-
// PREPARE ZIK RANDOM VALUES PASSED IN AS ARRAY OR RAND OBJECT {min, max, integer, negative}
|
|
54530
|
-
var savedPicks = {};
|
|
54531
|
-
for (i in obj) {
|
|
54532
|
-
// zogb(i)
|
|
54533
|
-
if (extraTypes.indexOf(i) >= 0) continue; // skip for extras
|
|
54534
|
-
savedPicks[i] = zim.copy(obj[i]); // store pre picked to use if loopPick is true
|
|
54535
|
-
obj[i] = zim.Pick.choose(obj[i], null, target);
|
|
54536
|
-
}
|
|
54537
|
-
if (!zot(obj.scale)) {
|
|
54538
|
-
obj.scaleX = obj.scaleY = zim.Pick.choose(obj.scale, null, target);
|
|
54539
|
-
delete obj.scale;
|
|
54540
|
-
}
|
|
54541
56398
|
|
|
54542
56399
|
|
|
54543
56400
|
// PROTECT LOOPS AND REWINDS WITH BUSY
|
|
@@ -55968,18 +57825,24 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
|
|
|
55968
57825
|
return;
|
|
55969
57826
|
} else {
|
|
55970
57827
|
if (rewind) {
|
|
55971
|
-
if (target.set) target.set(startObj);
|
|
57828
|
+
if (target.set) target.set(startObj);
|
|
55972
57829
|
} else {
|
|
55973
57830
|
if (target.set) target.set(obj);
|
|
55974
57831
|
}
|
|
55975
57832
|
}
|
|
55976
|
-
} else {
|
|
57833
|
+
} else {
|
|
55977
57834
|
if (wait3>0) target.waiting = true;
|
|
55978
57835
|
doLoopWaitCall();
|
|
55979
57836
|
return;
|
|
55980
57837
|
}
|
|
55981
|
-
}
|
|
55982
|
-
|
|
57838
|
+
} else {
|
|
57839
|
+
if (rewind) {
|
|
57840
|
+
if (target.set) target.set(startObj);
|
|
57841
|
+
} else {
|
|
57842
|
+
if (target.set) target.set(obj);
|
|
57843
|
+
}
|
|
57844
|
+
}
|
|
57845
|
+
|
|
55983
57846
|
// ZIM 015 - this was the first thing we tried to scrub a series with percentComplete
|
|
55984
57847
|
// there were lots of other things too to make it work.
|
|
55985
57848
|
// Leaving the seriesTween test in here... but probably not doing much
|
|
@@ -56002,7 +57865,7 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
|
|
|
56002
57865
|
|
|
56003
57866
|
function getStart() {
|
|
56004
57867
|
// for rewind, we need to know the start value
|
|
56005
|
-
// which could be modified by the set parameter
|
|
57868
|
+
// which could be modified by the set parameter
|
|
56006
57869
|
for (var i in obj) {
|
|
56007
57870
|
if (css && target.style) {
|
|
56008
57871
|
if (!zot(set[i]) && !from) {
|
|
@@ -56013,7 +57876,6 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
|
|
|
56013
57876
|
}
|
|
56014
57877
|
} else {
|
|
56015
57878
|
if (!zot(set[i]) && !from) {
|
|
56016
|
-
// !!!!!! maybe fix for dot plugin
|
|
56017
57879
|
startObj[i] = set[i];
|
|
56018
57880
|
} else {
|
|
56019
57881
|
if (i.substr(0,1) == ".") {
|
|
@@ -60477,13 +62339,20 @@ EXAMPLE
|
|
|
60477
62339
|
new Arrow({type:"thick"}).pos(30,30,RIGHT,BOTTOM).tap(next);
|
|
60478
62340
|
END EXAMPLE
|
|
60479
62341
|
|
|
60480
|
-
EXAMPLE
|
|
60481
|
-
|
|
60482
|
-
|
|
60483
|
-
|
|
60484
|
-
|
|
60485
|
-
|
|
60486
|
-
|
|
62342
|
+
EXAMPLE
|
|
62343
|
+
const page2 = new Page(W,H,orange);
|
|
62344
|
+
const page3 = new Page(W,H,yellow);
|
|
62345
|
+
const pages = new Pages([page1,page2,page3], "slide").addTo();
|
|
62346
|
+
|
|
62347
|
+
const left = new Arrow({
|
|
62348
|
+
pages:pages,
|
|
62349
|
+
direction:LEFT
|
|
62350
|
+
}).rot(180).pos(50,50,LEFT,BOTTOM);
|
|
62351
|
+
|
|
62352
|
+
const right = new Arrow({
|
|
62353
|
+
pages:pages,
|
|
62354
|
+
direction:RIGHT
|
|
62355
|
+
}).pos(50,50,RIGHT,BOTTOM);
|
|
60487
62356
|
END EXAMPLE
|
|
60488
62357
|
|
|
60489
62358
|
PARAMETERS supports DUO - parameters or single object with properties below
|
|
@@ -61946,10 +63815,13 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
|
|
|
61946
63815
|
return that;
|
|
61947
63816
|
};
|
|
61948
63817
|
this.remove = function(obj) {
|
|
61949
|
-
if (
|
|
61950
|
-
|
|
61951
|
-
if (
|
|
61952
|
-
|
|
63818
|
+
if (zot(obj)) that.removeAllChildren();
|
|
63819
|
+
else {
|
|
63820
|
+
if (!Array.isArray(obj)) obj = [obj];
|
|
63821
|
+
zim.loop(obj, function(o) {
|
|
63822
|
+
if (o && o.removeFrom) o.removeFrom();
|
|
63823
|
+
}, true);
|
|
63824
|
+
}
|
|
61953
63825
|
that.resize();
|
|
61954
63826
|
return that;
|
|
61955
63827
|
};
|
|
@@ -62823,7 +64695,7 @@ current2DCols ** - read only array the current order of columns each containing
|
|
|
62823
64695
|
tileNum - this property is added to each object in the tile to give its number in the tile
|
|
62824
64696
|
tileCol - this property is added to each object in the tile to give its column number in the tile
|
|
62825
64697
|
tileRow - this property is added to each object in the tile to give its row number in the tile
|
|
62826
|
-
backgrounds - an array of ZIM Rectangle objects set by the
|
|
64698
|
+
backgrounds - an array of ZIM Rectangle objects set by the backgroundColor parameter
|
|
62827
64699
|
backings - an array of DisplayObjects set by the backing parameter
|
|
62828
64700
|
backdrop - a ZIM Rectangle set by the backdropColor parameter
|
|
62829
64701
|
mat - a DisplayObject set by the mat parameter
|
|
@@ -70369,32 +72241,35 @@ new MotionController({
|
|
|
70369
72241
|
END EXAMPLE
|
|
70370
72242
|
|
|
70371
72243
|
EXAMPLE
|
|
70372
|
-
|
|
70373
|
-
|
|
70374
|
-
const
|
|
70375
|
-
const
|
|
70376
|
-
|
|
70377
|
-
|
|
70378
|
-
|
|
70379
|
-
|
|
70380
|
-
|
|
70381
|
-
|
|
70382
|
-
|
|
70383
|
-
|
|
70384
|
-
|
|
70385
|
-
|
|
70386
|
-
|
|
70387
|
-
|
|
70388
|
-
|
|
70389
|
-
|
|
72244
|
+
F.loadAssets(["beach02.jpg", "playbeachball.png"], "https://zimjs.org/assets/"); // or load in Frame()
|
|
72245
|
+
F.on("complete", ()=>{
|
|
72246
|
+
const background = new Pic("beach02.jpg").scaleTo().center();
|
|
72247
|
+
const ball = new Pic("playbeachball.png").siz(100).centerReg();
|
|
72248
|
+
const scroller = new Scroller(background);
|
|
72249
|
+
const accelerator = new Accelerator(scroller);
|
|
72250
|
+
|
|
72251
|
+
// control speed of Accelerator with MotionController
|
|
72252
|
+
new MotionController({
|
|
72253
|
+
target:accelerator,
|
|
72254
|
+
type:"mousemove", // or "pressmove"
|
|
72255
|
+
axis:HORIZONTAL,
|
|
72256
|
+
// the Scroller makes two backings - backing1 and backing2
|
|
72257
|
+
// allow pressing on both backings and ball to control scroller
|
|
72258
|
+
mousedownIncludes:[scroller.backing1, scroller.backing2, ball],
|
|
72259
|
+
speed:30,
|
|
72260
|
+
minPercentSpeed:-1000,
|
|
72261
|
+
maxPercentSpeed:1000,
|
|
72262
|
+
boundary:new Boundary(0,0,W,0) // setting a boundary and speed will balance the control
|
|
72263
|
+
});
|
|
70390
72264
|
|
|
70391
|
-
// control position of ball with MotionController
|
|
70392
|
-
new MotionController({
|
|
70393
|
-
|
|
70394
|
-
|
|
70395
|
-
|
|
70396
|
-
|
|
70397
|
-
|
|
72265
|
+
// control position of ball with MotionController
|
|
72266
|
+
new MotionController({
|
|
72267
|
+
target:ball,
|
|
72268
|
+
type:"mousemove",
|
|
72269
|
+
// allow press on Scroller backings
|
|
72270
|
+
mousedownIncludes:[scroller.backing1, scroller.backing2],
|
|
72271
|
+
speed:10
|
|
72272
|
+
});
|
|
70398
72273
|
});
|
|
70399
72274
|
END EXAMPLE
|
|
70400
72275
|
|
|
@@ -73093,6 +74968,7 @@ veeObj - an object with ZIM VEE original parameters:value allowing the ZIM VEE v
|
|
|
73093
74968
|
|
|
73094
74969
|
blurX = zik(blurX); // inherits these properties
|
|
73095
74970
|
blurY = zik(blurY);
|
|
74971
|
+
if (blurX === 0 && blurY === 0) blurX = 1;
|
|
73096
74972
|
quality = zik(quality);
|
|
73097
74973
|
|
|
73098
74974
|
color = zik(color); // will convert after setting color getter setter
|
|
@@ -75998,19 +77874,18 @@ and animate and swap the backgrounds when needed.
|
|
|
75998
77874
|
|
|
75999
77875
|
NOTE: A scroller can be added to a Accelerator object
|
|
76000
77876
|
this will allow the percentSpeed to be synched with other Scroller and Dynamo objects
|
|
76001
|
-
See https://zimjs.com/zide/
|
|
76002
|
-
See https://zimjs.com/
|
|
77877
|
+
See https://zimjs.com/zide/ - full scene
|
|
77878
|
+
See https://zimjs.com/zapp/E_EPRSP - Flinstones
|
|
77879
|
+
See https://zimjs.com/zapp/Z_6EEB5 - beach
|
|
77880
|
+
See https://zimjs.com/zapp/Z_ZCDQN - spaceguy
|
|
77881
|
+
See https://zimjs.com/zapp/Z_UC7DN - keyboard
|
|
76003
77882
|
|
|
76004
77883
|
NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
|
|
76005
77884
|
|
|
76006
77885
|
EXAMPLE
|
|
76007
|
-
const one = new Rectangle(
|
|
77886
|
+
const one = new Rectangle(1100, 400, red).center();
|
|
76008
77887
|
F.makeCircles().center(one);
|
|
76009
|
-
|
|
76010
|
-
|
|
76011
|
-
const scroller = new Scroller(one);
|
|
76012
|
-
|
|
76013
|
-
S.update();
|
|
77888
|
+
const scroller = new Scroller(one,20);
|
|
76014
77889
|
END EXAMPLE
|
|
76015
77890
|
|
|
76016
77891
|
PARAMETERS
|
|
@@ -83519,7 +85394,6 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
83519
85394
|
canvas.releasePointerCapture(e.pointerId);
|
|
83520
85395
|
that.dispatchEvent(e);
|
|
83521
85396
|
});
|
|
83522
|
-
|
|
83523
85397
|
canvas.addEventListener("pointermove", function(e) {
|
|
83524
85398
|
that.dispatchEvent(e);
|
|
83525
85399
|
});
|
|
@@ -83547,10 +85421,10 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
|
|
|
83547
85421
|
}
|
|
83548
85422
|
WW.removeEventListener("mousedown", leftEvent, true);
|
|
83549
85423
|
WW.removeEventListener("mousemove", leftEvent, true);
|
|
83550
|
-
WW.removeEventListener("
|
|
85424
|
+
WW.removeEventListener("mouseup", leftEvent);
|
|
83551
85425
|
WW.addEventListener("mousedown", leftEvent, true);
|
|
83552
85426
|
WW.addEventListener("mousemove", leftEvent, true); // tell actual mousemove there was a mouseup
|
|
83553
|
-
WW.addEventListener("
|
|
85427
|
+
WW.addEventListener("mouseup", leftEvent); // give actual mouseup a chance to act
|
|
83554
85428
|
}
|
|
83555
85429
|
|
|
83556
85430
|
function makeStage() {
|
|
@@ -88119,9 +89993,9 @@ function zimify(obj, a, b, c, d, list) {
|
|
|
88119
89993
|
dragRect:function(boundary) {
|
|
88120
89994
|
return zim.dragBoundary(this, boundary);
|
|
88121
89995
|
},
|
|
88122
|
-
transform:function(move, stretchX, stretchY, scale, rotate, allowToggle, visible, onTop, showStretch, showRotate, showScale, showReg, showBorder, borderColor, borderWidth, dashed, customCursors, handleSize, regSize, snapDistance, snapRotation, cache, events, ghostColor, ghostWidth, ghostDashed, ghostHidden, frame, container) {
|
|
89996
|
+
transform:function(move, stretchX, stretchY, scale, rotate, allowToggle, visible, onTop, showStretch, showRotate, showScale, showReg, showBorder, borderColor, borderWidth, dashed, customCursors, handleSize, regSize, snapDistance, snapRotation, cache, events, ghostColor, ghostWidth, ghostDashed, ghostHidden, frame, container, minScaleX, maxScaleX, minScaleY, maxScaleY, sliceX, sliceY) {
|
|
88123
89997
|
if (isDUO(arguments)) {arguments[0].obj = this; return zim.transform(arguments[0]);}
|
|
88124
|
-
else {return zim.transform(this, move, stretchX, stretchY, scale, rotate, allowToggle, visible, onTop, showStretch, showRotate, showScale, showReg, showBorder, borderColor, borderWidth, dashed, customCursors, handleSize, regSize, snapDistance, snapRotation, cache, events, ghostColor, ghostWidth, ghostDashed, ghostHidden, frame, container);}
|
|
89998
|
+
else {return zim.transform(this, move, stretchX, stretchY, scale, rotate, allowToggle, visible, onTop, showStretch, showRotate, showScale, showReg, showBorder, borderColor, borderWidth, dashed, customCursors, handleSize, regSize, snapDistance, snapRotation, cache, events, ghostColor, ghostWidth, ghostDashed, ghostHidden, frame, container, minScaleX, maxScaleX, minScaleY, maxScaleY, sliceX, sliceY);}
|
|
88125
89999
|
},
|
|
88126
90000
|
setSwipe:function(swipe) {
|
|
88127
90001
|
return zim.setSwipe(this, swipe);
|
|
@@ -93428,16 +95302,16 @@ for (z_i = 0; z_i < globalFunctions.length; z_i++) {
|
|
|
93428
95302
|
["RAD", zim.RAD],
|
|
93429
95303
|
["PHI", zim.PHI],
|
|
93430
95304
|
["IGNORE", zim.ignore]
|
|
93431
|
-
|
|
93432
|
-
|
|
93433
|
-
|
|
95305
|
+
];
|
|
95306
|
+
|
|
95307
|
+
for (z_i = 0; z_i < globalsConstants.length; z_i++) {
|
|
93434
95308
|
var pair = globalsConstants[z_i];
|
|
93435
95309
|
WW[pair[0]] = pair[1];
|
|
93436
|
-
|
|
93437
|
-
|
|
93438
|
-
|
|
95310
|
+
}
|
|
95311
|
+
|
|
95312
|
+
for (z_i = 0; z_i < zim.colors.length; z_i++) {
|
|
93439
95313
|
WW[zim.colors[z_i]] = zim.colorsHex[z_i];
|
|
93440
|
-
|
|
95314
|
+
}
|
|
93441
95315
|
|
|
93442
95316
|
|
|
93443
95317
|
WW.zim = zim;
|
|
@@ -93541,6 +95415,7 @@ export let StageGL = zim.StageGL;
|
|
|
93541
95415
|
export let Container = zim.Container;
|
|
93542
95416
|
export let Shape = zim.Shape;
|
|
93543
95417
|
export let Bitmap = zim.Bitmap;
|
|
95418
|
+
export let SlicedBitmap = zim.SlicedBitmap;
|
|
93544
95419
|
export let Sprite = zim.Sprite;
|
|
93545
95420
|
export let MovieClip = zim.MovieClip;
|
|
93546
95421
|
export let SVGContainer = zim.SVGContainer;
|
|
@@ -93585,6 +95460,8 @@ export let List = zim.List;
|
|
|
93585
95460
|
export let Stepper = zim.Stepper;
|
|
93586
95461
|
export let Slider = zim.Slider;
|
|
93587
95462
|
export let Selector = zim.Selector;
|
|
95463
|
+
export let Slicer = zim.Slicer;
|
|
95464
|
+
export let SlicerTypes = zim.SlicerTypes;
|
|
93588
95465
|
export let Dial = zim.Dial;
|
|
93589
95466
|
export let Tabs = zim.Tabs;
|
|
93590
95467
|
export let Pad = zim.Pad;
|