Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 11 additions & 17 deletions src/framework/components/button/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,17 @@ class ButtonComponentSystem extends ComponentSystem {

cloneComponent(entity, clone) {
const c = entity.button;
return this.addComponent(clone, {
enabled: c.enabled,
active: c.active,
imageEntity: c.imageEntity,
hitPadding: c.hitPadding,
transitionMode: c.transitionMode,
hoverTint: c.hoverTint,
pressedTint: c.pressedTint,
inactiveTint: c.inactiveTint,
fadeDuration: c.fadeDuration,
hoverSpriteAsset: c.hoverSpriteAsset,
hoverSpriteFrame: c.hoverSpriteFrame,
pressedSpriteAsset: c.pressedSpriteAsset,
pressedSpriteFrame: c.pressedSpriteFrame,
inactiveSpriteAsset: c.inactiveSpriteAsset,
inactiveSpriteFrame: c.inactiveSpriteFrame
});

const data = {
enabled: c.enabled
};

for (let i = 0; i < _properties.length; i++) {
const property = _properties[i];
data[property] = c[property];
}

return this.addComponent(clone, data);
}

onUpdate(dt) {
Expand Down
30 changes: 15 additions & 15 deletions src/framework/components/collision/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -716,22 +716,22 @@ class CollisionComponentSystem extends ComponentSystem {

cloneComponent(entity, clone) {
const c = entity.collision;
return this.addComponent(clone, {

// type is initialized outside the property list; shape is created by the type's
// implementation during initialization and must not be shared with the clone
const data = {
enabled: c.enabled,
type: c.type,
halfExtents: c.halfExtents,
linearOffset: c.linearOffset,
angularOffset: c.angularOffset,
radius: c.radius,
axis: c.axis,
height: c.height,
convexHull: c.convexHull,
asset: c.asset,
renderAsset: c.renderAsset,
model: c.model,
render: c.render,
checkVertexDuplicates: c.checkVertexDuplicates
});
type: c.type
};

for (let i = 0; i < _properties.length; i++) {
const property = _properties[i];
if (property !== 'shape') {
data[property] = c[property];
}
}

return this.addComponent(clone, data);
}

onBeforeRemove(entity, component) {
Expand Down
28 changes: 11 additions & 17 deletions src/framework/components/scroll-view/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,17 @@ class ScrollViewComponentSystem extends ComponentSystem {

cloneComponent(entity, clone) {
const c = entity.scrollview;
return this.addComponent(clone, {
enabled: c.enabled,
horizontal: c.horizontal,
vertical: c.vertical,
scrollMode: c.scrollMode,
bounceAmount: c.bounceAmount,
friction: c.friction,
dragThreshold: c.dragThreshold,
useMouseWheel: c.useMouseWheel,
mouseWheelSensitivity: c.mouseWheelSensitivity,
horizontalScrollbarVisibility: c.horizontalScrollbarVisibility,
verticalScrollbarVisibility: c.verticalScrollbarVisibility,
viewportEntity: c.viewportEntity,
contentEntity: c.contentEntity,
horizontalScrollbarEntity: c.horizontalScrollbarEntity,
verticalScrollbarEntity: c.verticalScrollbarEntity
});

const data = {
enabled: c.enabled
};

for (let i = 0; i < _properties.length; i++) {
const property = _properties[i];
data[property] = c[property];
}

return this.addComponent(clone, data);
}

onUpdate(dt) {
Expand Down
18 changes: 11 additions & 7 deletions src/framework/components/scrollbar/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,17 @@ class ScrollbarComponentSystem extends ComponentSystem {

cloneComponent(entity, clone) {
const c = entity.scrollbar;
return this.addComponent(clone, {
enabled: c.enabled,
orientation: c.orientation,
value: c.value,
handleSize: c.handleSize,
handleEntity: c.handleEntity
});

const data = {
enabled: c.enabled
};

for (let i = 0; i < _properties.length; i++) {
const property = _properties[i];
data[property] = c[property];
}

return this.addComponent(clone, data);
}

_onAddComponent(entity) {
Expand Down