Commit e26160b3 authored by wildfirecode13's avatar wildfirecode13

init

parent 46fa1ecb
...@@ -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 */ });\nvar _this = undefined;\nvar 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 */ });\nvar _this = undefined;\nvar 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?");
/***/ }), /***/ }),
......
...@@ -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 */ });\nvar _this = undefined;\nvar 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 */ });\nvar _this = undefined;\nvar 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?");
/***/ }), /***/ }),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment