当前位置: 首页>>代码示例>>Java>>正文


Java Draggable类代码示例

本文整理汇总了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;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:32,代码来源:DragPane.java

示例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));
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:14,代码来源:DragListenerLmlAttribute.java

示例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));
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:14,代码来源:DraggedMovingInterpolationLmlAttribute.java

示例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));
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:14,代码来源:DraggedFadingInterpolationLmlAttribute.java

示例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);
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:8,代码来源:FixedSizeGridGroup.java

示例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;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:18,代码来源:DragPane.java

示例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);
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:20,代码来源:DragPane.java

示例8: getHandledType

import com.kotcrab.vis.ui.widget.Draggable; //导入依赖的package包/类
@Override
public Class<Draggable> getHandledType() {
    return Draggable.class;
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:5,代码来源:DraggedFadingTimeLmlAttribute.java

示例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));
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:6,代码来源:DraggedFadingTimeLmlAttribute.java

示例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));
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:6,代码来源:KeepDraggedWithinParentLmlAttribute.java

示例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));
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:6,代码来源:DeadzoneRadiusLmlAttribute.java

示例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));
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:6,代码来源:DraggedAlphaLmlAttribute.java

示例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));
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:6,代码来源:BlockInputLmlAttribute.java

示例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));
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:6,代码来源:InvisibleWhenDraggedLmlAttribute.java

示例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));
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:6,代码来源:DraggedMovingTimeLmlAttribute.java


注:本文中的com.kotcrab.vis.ui.widget.Draggable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。