Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
game-stydy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
谌继荃
game-stydy
Commits
e26160b3
Commit
e26160b3
authored
Nov 04, 2021
by
wildfirecode13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
46fa1ecb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
bundle.js
dist/bundle.js
+1
-1
bundle.js
public/bundle.js
+1
-1
No files found.
dist/bundle.js
View file @
e26160b3
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
\*********************/
\*********************/
/***/
((
__unused_webpack_module
,
__webpack_exports__
,
__webpack_require__
)
=>
{
/***/
((
__unused_webpack_module
,
__webpack_exports__
,
__webpack_require__
)
=>
{
eval
(
"__webpack_require__.r(__webpack_exports__);
\n
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
\n
/* harmony export */
\"
addDragDemo
\"
: () => (/* binding */ addDragDemo)
\n
/* harmony export */ });
\n
var _this = undefined;
\n
var addDragDemo = function (stage) {
\n
var
pic = FYGE.Sprite.fromUrl('//yun.duiba.com.cn/aurora/assets/b64757cc9839c1dcc80692f6b7db9d97d269c315.png');
\n
stage.addChild(pic);
\n
//鼠标按下起始点
\n
var startPoint;
\n
//图片起始位置
\n
var picOriginPos;
\n
var onStageMove = function (event) {
\n
console.log('触发了onStageMove事件,当前时间戳=>', Date.now());
\n
//鼠标当前位置
\n
var currentPoint = { x: event.stageX, y: event.stageY };
\n
//鼠标按下点到鼠标当前点的偏移量
\n
var mouseOffsetX = currentPoint.x - startPoint.x;
\n
var mouseOffsetY = currentPoint.y - startPoint.y;
\n
pic.x = picOriginPos.x + mouseOffsetX;
\n
pic.y = picOriginPos.y + mouseOffsetY;
\n
};
\n
var onMouseUp_pic = function () {
\n
//鼠标抬起后应该移出舞台移动事件,否则会重复添加事件
\n
stage.removeEventListener(FYGE.MouseEvent.MOUSE_MOVE, onStageMove, _this);
\n
};
\n
var onMouseDown_pic = function (event) {
\n
//图片鼠标弹起事件,事件触发一次即移除,否则会重复添加鼠标弹起事件
\n
pic.once(FYGE.MouseEvent.MOUSE_UP, onMouseUp_pic, _this);
\n
//添加舞台移动事件,鼠标移动即触发
\n
//FYGE.MouseEvent.MOUSE_MOVE 会在鼠标移动过程中触发
\n
stage.addEventListener(FYGE.MouseEvent.MOUSE_MOVE, onStageMove, _this);
\n
//event事件对象
\n
//event.stageX,event.stageY当前鼠标在舞台的位置
\n
startPoint = { x: event.stageX, y: event.stageY };
\n
picOriginPos = { x: pic.x, y: pic.y };
\n
};
\n
//增加鼠标按下事件
\n
pic
.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, onMouseDown_pic, _this);
\n
};
\n\n\n
//# sourceURL=webpack:///./src/drag.ts?"
);
eval
(
"__webpack_require__.r(__webpack_exports__);
\n
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
\n
/* harmony export */
\"
addDragDemo
\"
: () => (/* binding */ addDragDemo)
\n
/* harmony export */ });
\n
var _this = undefined;
\n
var addDragDemo = function (stage) {
\n
var
PIC_SIZE = 200; //图片尺寸,单位像素s
\n
var GAP = 2; //位置间隔
\n
var picture1 = FYGE.Sprite.fromUrl('//yun.duiba.com.cn/aurora/assets/cd16134f2544202ed5676adbd5114286aec44347.png');
\n
stage.addChild(picture1);
\n
var picture2 = FYGE.Sprite.fromUrl('//yun.duiba.com.cn/aurora/assets/c55dcd277542a6c3e983278ae5835d89848b9bd9.png');
\n
stage.addChild(picture2);
\n
picture2.position.set(PIC_SIZE + GAP, 0);
\n
//鼠标按下起始点
\n
var startPoint;
\n
//图片起始位置
\n
var currentPictureOrigin;
\n
var onStageMove = function (currentPicture, event) {
\n
//鼠标当前位置
\n
var currentPoint = { x: event.stageX, y: event.stageY };
\n
//鼠标按下点到鼠标当前点的偏移量
\n
var mouseOffsetX = currentPoint.x - startPoint.x;
\n
var mouseOffsetY = currentPoint.y - startPoint.y;
\n
currentPicture.x = currentPictureOrigin.x + mouseOffsetX;
\n
currentPicture.y = currentPictureOrigin.y + mouseOffsetY;
\n
};
\n
var onMouseUp_pic = function (onStageMoveBinded) {
\n
//鼠标抬起后应该移出舞台移动事件,否则会重复添加事件
\n
stage.removeEventListener(FYGE.MouseEvent.MOUSE_MOVE, onStageMoveBinded, _this);
\n
};
\n
var onMouseDown_pic = function (event) {
\n
var currentPicture = event.target;
\n
var onStageMoveBinded = onStageMove.bind(_this, currentPicture);
\n
//图片鼠标弹起事件,事件触发一次即移除,否则会重复添加鼠标弹起事件
\n
currentPicture.once(FYGE.MouseEvent.MOUSE_UP, onMouseUp_pic.bind(_this, onStageMoveBinded), _this);
\n
//添加舞台移动事件,鼠标移动即触发
\n
//FYGE.MouseEvent.MOUSE_MOVE 会在鼠标移动过程中触发
\n
stage.addEventListener(FYGE.MouseEvent.MOUSE_MOVE, onStageMoveBinded, _this);
\n
//event事件对象
\n
//event.stageX,event.stageY当前鼠标在舞台的位置
\n
startPoint = { x: event.stageX, y: event.stageY };
\n
currentPictureOrigin = { x: currentPicture.x, y: currentPicture.y };
\n
stage.addChildAt(currentPicture, stage.children.length - 1);
\n
};
\n
//增加鼠标按下事件
\n
picture1.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, onMouseDown_pic, _this);
\n
picture2
.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, onMouseDown_pic, _this);
\n
};
\n\n\n
//# sourceURL=webpack:///./src/drag.ts?"
);
/***/
}),
/***/
}),
...
...
public/bundle.js
View file @
e26160b3
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
\*********************/
\*********************/
/***/
((
__unused_webpack_module
,
__webpack_exports__
,
__webpack_require__
)
=>
{
/***/
((
__unused_webpack_module
,
__webpack_exports__
,
__webpack_require__
)
=>
{
eval
(
"__webpack_require__.r(__webpack_exports__);
\n
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
\n
/* harmony export */
\"
addDragDemo
\"
: () => (/* binding */ addDragDemo)
\n
/* harmony export */ });
\n
var _this = undefined;
\n
var addDragDemo = function (stage) {
\n
var
pic = FYGE.Sprite.fromUrl('//yun.duiba.com.cn/aurora/assets/b64757cc9839c1dcc80692f6b7db9d97d269c315.png');
\n
stage.addChild(pic);
\n
//鼠标按下起始点
\n
var startPoint;
\n
//图片起始位置
\n
var picOriginPos;
\n
var onStageMove = function (event) {
\n
console.log('触发了onStageMove事件,当前时间戳=>', Date.now());
\n
//鼠标当前位置
\n
var currentPoint = { x: event.stageX, y: event.stageY };
\n
//鼠标按下点到鼠标当前点的偏移量
\n
var mouseOffsetX = currentPoint.x - startPoint.x;
\n
var mouseOffsetY = currentPoint.y - startPoint.y;
\n
pic.x = picOriginPos.x + mouseOffsetX;
\n
pic.y = picOriginPos.y + mouseOffsetY;
\n
};
\n
var onMouseUp_pic = function () {
\n
//鼠标抬起后应该移出舞台移动事件,否则会重复添加事件
\n
stage.removeEventListener(FYGE.MouseEvent.MOUSE_MOVE, onStageMove, _this);
\n
};
\n
var onMouseDown_pic = function (event) {
\n
//图片鼠标弹起事件,事件触发一次即移除,否则会重复添加鼠标弹起事件
\n
pic.once(FYGE.MouseEvent.MOUSE_UP, onMouseUp_pic, _this);
\n
//添加舞台移动事件,鼠标移动即触发
\n
//FYGE.MouseEvent.MOUSE_MOVE 会在鼠标移动过程中触发
\n
stage.addEventListener(FYGE.MouseEvent.MOUSE_MOVE, onStageMove, _this);
\n
//event事件对象
\n
//event.stageX,event.stageY当前鼠标在舞台的位置
\n
startPoint = { x: event.stageX, y: event.stageY };
\n
picOriginPos = { x: pic.x, y: pic.y };
\n
};
\n
//增加鼠标按下事件
\n
pic
.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, onMouseDown_pic, _this);
\n
};
\n\n\n
//# sourceURL=webpack:///./src/drag.ts?"
);
eval
(
"__webpack_require__.r(__webpack_exports__);
\n
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
\n
/* harmony export */
\"
addDragDemo
\"
: () => (/* binding */ addDragDemo)
\n
/* harmony export */ });
\n
var _this = undefined;
\n
var addDragDemo = function (stage) {
\n
var
PIC_SIZE = 200; //图片尺寸,单位像素s
\n
var GAP = 2; //位置间隔
\n
var picture1 = FYGE.Sprite.fromUrl('//yun.duiba.com.cn/aurora/assets/cd16134f2544202ed5676adbd5114286aec44347.png');
\n
stage.addChild(picture1);
\n
var picture2 = FYGE.Sprite.fromUrl('//yun.duiba.com.cn/aurora/assets/c55dcd277542a6c3e983278ae5835d89848b9bd9.png');
\n
stage.addChild(picture2);
\n
picture2.position.set(PIC_SIZE + GAP, 0);
\n
//鼠标按下起始点
\n
var startPoint;
\n
//图片起始位置
\n
var currentPictureOrigin;
\n
var onStageMove = function (currentPicture, event) {
\n
//鼠标当前位置
\n
var currentPoint = { x: event.stageX, y: event.stageY };
\n
//鼠标按下点到鼠标当前点的偏移量
\n
var mouseOffsetX = currentPoint.x - startPoint.x;
\n
var mouseOffsetY = currentPoint.y - startPoint.y;
\n
currentPicture.x = currentPictureOrigin.x + mouseOffsetX;
\n
currentPicture.y = currentPictureOrigin.y + mouseOffsetY;
\n
};
\n
var onMouseUp_pic = function (onStageMoveBinded) {
\n
//鼠标抬起后应该移出舞台移动事件,否则会重复添加事件
\n
stage.removeEventListener(FYGE.MouseEvent.MOUSE_MOVE, onStageMoveBinded, _this);
\n
};
\n
var onMouseDown_pic = function (event) {
\n
var currentPicture = event.target;
\n
var onStageMoveBinded = onStageMove.bind(_this, currentPicture);
\n
//图片鼠标弹起事件,事件触发一次即移除,否则会重复添加鼠标弹起事件
\n
currentPicture.once(FYGE.MouseEvent.MOUSE_UP, onMouseUp_pic.bind(_this, onStageMoveBinded), _this);
\n
//添加舞台移动事件,鼠标移动即触发
\n
//FYGE.MouseEvent.MOUSE_MOVE 会在鼠标移动过程中触发
\n
stage.addEventListener(FYGE.MouseEvent.MOUSE_MOVE, onStageMoveBinded, _this);
\n
//event事件对象
\n
//event.stageX,event.stageY当前鼠标在舞台的位置
\n
startPoint = { x: event.stageX, y: event.stageY };
\n
currentPictureOrigin = { x: currentPicture.x, y: currentPicture.y };
\n
stage.addChildAt(currentPicture, stage.children.length - 1);
\n
};
\n
//增加鼠标按下事件
\n
picture1.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, onMouseDown_pic, _this);
\n
picture2
.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, onMouseDown_pic, _this);
\n
};
\n\n\n
//# sourceURL=webpack:///./src/drag.ts?"
);
/***/
}),
/***/
}),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment