Skip to content

Commit a06ff1e

Browse files
committed
Export plugins
1 parent 6742416 commit a06ff1e

File tree

100 files changed

+1315
-241
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+1315
-241
lines changed

dist/rexanchorplugin.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,8 @@
383383
o = {};
384384
}
385385

386+
var gameObject = this.parent;
387+
386388
// Position
387389
var alignX, configX;
388390
if (o.x !== undefined) {
@@ -444,13 +446,19 @@
444446
paddingHeight = (configHeight[1] === '') ? 0 : parseFloat(configHeight[1]);
445447
}
446448

449+
var aspectRatio = o.aspectRatio;
450+
if (aspectRatio === true) {
451+
aspectRatio = gameObject.displayWidth / gameObject.displayHeight;
452+
}
453+
447454
// Position
448455
this.setAlign(alignX, alignY);
449456
this.setPercentage(percentageX, percentageY);
450457
this.setOffset(offsetX, offsetY);
451458
// Size
452459
this.setSizePercentage(percentageWidth, percentageHeight);
453460
this.setSizePadding(paddingWidth, paddingHeight);
461+
this.setAspectRatio(aspectRatio);
454462

455463
var onResizeCallback = GetValue(o, 'onResizeCallback', DefaultResizeCallback);
456464
var onResizeCallbackScope = GetValue(o, 'onResizeCallbackScope');
@@ -519,6 +527,11 @@
519527
return this;
520528
}
521529

530+
setAspectRatio(aspectRatio) {
531+
this.aspectRatio = aspectRatio;
532+
return this;
533+
}
534+
522535
setResizeCallback(callback, scope) {
523536
this.onResizeCallback = callback;
524537
this.onResizeCallbackScope = scope;
@@ -549,10 +562,19 @@
549562

550563
var gameObject = this.parent;
551564
if (newWidth === undefined) {
552-
newWidth = gameObject.width;
565+
if (this.aspectRatio && newHeight) {
566+
newWidth = this.aspectRatio * newHeight;
567+
} else {
568+
newWidth = gameObject.width;
569+
}
570+
553571
}
554572
if (newHeight === undefined) {
555-
newHeight = gameObject.height;
573+
if (this.aspectRatio && newWidth) {
574+
newHeight = newWidth / this.aspectRatio;
575+
} else {
576+
newHeight = gameObject.height;
577+
}
556578
}
557579

558580
if (scope) {

dist/rexanchorplugin.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rexbadgelabel.js

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4410,6 +4410,8 @@
44104410
o = {};
44114411
}
44124412

4413+
var gameObject = this.parent;
4414+
44134415
// Position
44144416
var alignX, configX;
44154417
if (o.x !== undefined) {
@@ -4471,13 +4473,19 @@
44714473
paddingHeight = (configHeight[1] === '') ? 0 : parseFloat(configHeight[1]);
44724474
}
44734475

4476+
var aspectRatio = o.aspectRatio;
4477+
if (aspectRatio === true) {
4478+
aspectRatio = gameObject.displayWidth / gameObject.displayHeight;
4479+
}
4480+
44744481
// Position
44754482
this.setAlign(alignX, alignY);
44764483
this.setPercentage(percentageX, percentageY);
44774484
this.setOffset(offsetX, offsetY);
44784485
// Size
44794486
this.setSizePercentage(percentageWidth, percentageHeight);
44804487
this.setSizePadding(paddingWidth, paddingHeight);
4488+
this.setAspectRatio(aspectRatio);
44814489

44824490
var onResizeCallback = GetValue$z(o, 'onResizeCallback', DefaultResizeCallback);
44834491
var onResizeCallbackScope = GetValue$z(o, 'onResizeCallbackScope');
@@ -4546,6 +4554,11 @@
45464554
return this;
45474555
}
45484556

4557+
setAspectRatio(aspectRatio) {
4558+
this.aspectRatio = aspectRatio;
4559+
return this;
4560+
}
4561+
45494562
setResizeCallback(callback, scope) {
45504563
this.onResizeCallback = callback;
45514564
this.onResizeCallbackScope = scope;
@@ -4576,10 +4589,19 @@
45764589

45774590
var gameObject = this.parent;
45784591
if (newWidth === undefined) {
4579-
newWidth = gameObject.width;
4592+
if (this.aspectRatio && newHeight) {
4593+
newWidth = this.aspectRatio * newHeight;
4594+
} else {
4595+
newWidth = gameObject.width;
4596+
}
4597+
45804598
}
45814599
if (newHeight === undefined) {
4582-
newHeight = gameObject.height;
4600+
if (this.aspectRatio && newWidth) {
4601+
newHeight = newWidth / this.aspectRatio;
4602+
} else {
4603+
newHeight = gameObject.height;
4604+
}
45834605
}
45844606

45854607
if (scope) {
@@ -4657,11 +4679,11 @@
46574679
var hasOnResizeCallback = config.hasOwnProperty('onResizeCallback');
46584680
if ((hasMinWidth || hasMinHeight) && !hasOnResizeCallback) {
46594681
config.onResizeCallback = function (width, height, sizer) {
4660-
if (hasMinWidth) {
4682+
if (width !== undefined) {
46614683
sizer.setMinWidth(width);
46624684
}
46634685

4664-
if (hasMinHeight) {
4686+
if (height !== undefined) {
46654687
sizer.setMinHeight(height);
46664688
}
46674689

0 commit comments

Comments
 (0)