本文整理汇总了Java中com.kotcrab.vis.ui.widget.Draggable类的典型用法代码示例。如果您正苦于以下问题:Java Draggable类的具体用法?Java Draggable怎么用?Java Draggable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Draggable类属于com.kotcrab.vis.ui.widget包,在下文中一共展示了Draggable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addToFloatingGroup
import com.kotcrab.vis.ui.widget.Draggable; //导入依赖的package包/类
/**
* @param draggable attached to dragged actor.
* @param actor is being dragged.
* @param dragPane is under the actor. Stores a {@link FloatingGroup}.
* @return true if actor was accepted by the group.
*/
protected boolean addToFloatingGroup (final Draggable draggable, final Actor actor, final DragPane dragPane) {
final FloatingGroup group = dragPane.getFloatingGroup();
dragPane.stageToLocalCoordinates(DRAG_POSITION);
float x = DRAG_POSITION.x + draggable.getOffsetX();
if (x < 0f || x + actor.getWidth() > dragPane.getWidth()) {
// Normalizing value if set to keep within parent's bounds:
if (draggable.isKeptWithinParent()) {
x = x < 0f ? 0f : dragPane.getWidth() - actor.getWidth() - 1f;
} else {
return CANCEL;
}
}
float y = DRAG_POSITION.y + draggable.getOffsetY();
if (y < 0f || y + actor.getHeight() > dragPane.getHeight()) {
if (draggable.isKeptWithinParent()) {
y = y < 0f ? 0f : dragPane.getHeight() - actor.getHeight() - 1f;
} else {
return CANCEL;
}
}
actor.remove();
actor.setPosition(x, y);
group.addActor(actor);
return APPROVE;
}
示例2: process
import com.kotcrab.vis.ui.widget.Draggable; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Draggable actor,
final String rawAttributeData) {
@SuppressWarnings("unchecked") final ActorConsumer<DragListener, Draggable> action = (ActorConsumer<DragListener, Draggable>) parser
.parseAction(rawAttributeData, actor);
if (action == null) {
parser.throwErrorIfStrict(
"Draggable listener attribute expects an action ID that references method consuming Draggable and returning DragListener. Method not found for ID: "
+ rawAttributeData);
return;
}
actor.setListener(action.consume(actor));
}
示例3: process
import com.kotcrab.vis.ui.widget.Draggable; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Draggable actor,
final String rawAttributeData) {
@SuppressWarnings("unchecked") final ActorConsumer<Interpolation, Draggable> action = (ActorConsumer<Interpolation, Draggable>) parser
.parseAction(rawAttributeData, actor);
if (action == null) {
parser.throwErrorIfStrict(
"Draggable interpolation attribute expects an action ID that references method consuming Draggable and returning Interpolation. Method not found for ID: "
+ rawAttributeData);
return;
}
actor.setMovingInterpolation(action.consume(actor));
}
示例4: process
import com.kotcrab.vis.ui.widget.Draggable; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Draggable actor,
final String rawAttributeData) {
@SuppressWarnings("unchecked") final ActorConsumer<Interpolation, Draggable> action = (ActorConsumer<Interpolation, Draggable>) parser
.parseAction(rawAttributeData, actor);
if (action == null) {
parser.throwErrorIfStrict(
"Draggable interpolation attribute expects an action ID that references method consuming Draggable and returning Interpolation. Method not found for ID: "
+ rawAttributeData);
return;
}
actor.setFadingInterpolation(action.consume(actor));
}
示例5: onStart
import com.kotcrab.vis.ui.widget.Draggable; //导入依赖的package包/类
@Override
public boolean onStart(final Draggable draggable, final Actor actor, final float stageX, final float stageY) {
if (group.isMockUp(actor)) {
return CANCEL;
}
return super.onStart(draggable, actor, stageX, stageY);
}
示例6: addDirectlyToPane
import com.kotcrab.vis.ui.widget.Draggable; //导入依赖的package包/类
/**
* @param draggable is attached to the actor.
* @param actor dragged actor.
* @param dragPane is directly under the dragged actor. If accepts the actor, it should be added to its content.
* @return true if actor was accepted.
*/
protected boolean addDirectlyToPane (final Draggable draggable, final Actor actor, final DragPane dragPane) {
if (accept(actor, dragPane)) {
if (dragPane.isFloating()) {
return addToFloatingGroup(draggable, actor, dragPane);
}
// Dragged directly to a pane. Assuming no padding, adding last:
dragPane.addActor(actor);
return APPROVE;
}
return CANCEL;
}
示例7: addActor
import com.kotcrab.vis.ui.widget.Draggable; //导入依赖的package包/类
/**
* @param draggable is attached to the actor.
* @param actor is being dragged.
* @param overActor is directly under the dragged actor.
* @param dragPane contains the actor under dragged widget.
* @return true if actor is accepted and added to the group.
*/
protected boolean addActor (final Draggable draggable, final Actor actor, final Actor overActor, final DragPane dragPane) {
final Actor directPaneChild = getActorInDragPane(overActor, dragPane);
directPaneChild.stageToLocalCoordinates(DRAG_POSITION);
if (dragPane.isVertical() || dragPane.isVerticalFlow()) {
return addToVerticalGroup(actor, dragPane, directPaneChild);
} else if (dragPane.isHorizontal() || dragPane.isHorizontalFlow()) {
return addToHorizontalGroup(actor, dragPane, directPaneChild);
} else if (dragPane.isFloating()) {
return addToFloatingGroup(draggable, actor, dragPane);
} // This is the default behavior for grid and unknown groups:
return addToOtherGroup(actor, dragPane, directPaneChild);
}
示例8: getHandledType
import com.kotcrab.vis.ui.widget.Draggable; //导入依赖的package包/类
@Override
public Class<Draggable> getHandledType() {
return Draggable.class;
}
示例9: process
import com.kotcrab.vis.ui.widget.Draggable; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Draggable actor,
final String rawAttributeData) {
actor.setFadingTime(parser.parseFloat(rawAttributeData, actor));
}
示例10: process
import com.kotcrab.vis.ui.widget.Draggable; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Draggable draggable,
final String rawAttributeData) {
draggable.setKeepWithinParent(parser.parseBoolean(rawAttributeData, draggable));
}
示例11: process
import com.kotcrab.vis.ui.widget.Draggable; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Draggable actor,
final String rawAttributeData) {
actor.setDeadzoneRadius(parser.parseFloat(rawAttributeData, actor));
}
示例12: process
import com.kotcrab.vis.ui.widget.Draggable; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Draggable actor,
final String rawAttributeData) {
actor.setAlpha(parser.parseFloat(rawAttributeData, actor));
}
示例13: process
import com.kotcrab.vis.ui.widget.Draggable; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Draggable actor,
final String rawAttributeData) {
actor.setBlockInput(parser.parseBoolean(rawAttributeData, actor));
}
示例14: process
import com.kotcrab.vis.ui.widget.Draggable; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Draggable actor,
final String rawAttributeData) {
actor.setInvisibleWhenDragged(parser.parseBoolean(rawAttributeData, actor));
}
示例15: process
import com.kotcrab.vis.ui.widget.Draggable; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Draggable actor,
final String rawAttributeData) {
actor.setMovingTime(parser.parseFloat(rawAttributeData, actor));
}