diff --git a/src/lib/threed/HomeDesign.tsx b/src/lib/threed/HomeDesign.tsx index 0860265cf..57a7c510f 100644 --- a/src/lib/threed/HomeDesign.tsx +++ b/src/lib/threed/HomeDesign.tsx @@ -641,7 +641,7 @@ const PaperCanvas = (props: any) => { initThreeDPaperPlanView(planCanvas) initPaperOrbitControls() - drawFreestyle() + // drawFreestyle() // ** // console.debug('%c PaperCanvas THREED PAPER JS: initThreeDPaperPlanView(planCanvasRef)', ccm.darkorangeAlert, planCanvasRef.current) // console.debug(`%c PaperCanvas planCanvas`, ccm.darkgreenAlert, planCanvas) @@ -6521,8 +6521,6 @@ export default function ThreeDHomeDesign({ // console.debug('PAPERprojectToView', PAPERprojectToView) threedDragDiv.style.left = PAPERprojectToView.x + planView.offsetLeft - widthT / 2 + 'px' threedDragDiv.style.top = PAPERprojectToView.y + planView.offsetTop - heightOh / 2 + 'px' - // [MM] - // threedDragDiv.style.display = 'block' } // if (draggingNewGuide) { @@ -6543,39 +6541,64 @@ export default function ThreeDHomeDesign({ } // END: document.onmousemove = function (e: any) {} + paper.tool.onMouseUp = function (e: any) { + console.debug('PAPER threedTool', threedTool) + console.debug('PAPER tool', paper.tool) - // // ** HEY HEY HEY [MM] NEEDS ATTENTION [MM] - // // ** CAN WE DO THIS WITHIN A SUB "TOOL" MODE? Yes please. - // document.onmouseup = function (e: any) { - // // ** MOVED TO threedTool.pointer - // draggingThreedIcon = false - - // // ** - // if (verticalSliderDragging) { - // verticalSliderDragging = false - // } - // if (horizontalSliderLeftDragging) { - // horizontalSliderLeftDragging = false - // } - // if (horizontalSliderRightDragging) { - // horizontalSliderRightDragging = false - // } - - // // ** [MM] CLOSER.. NOT EVEN CLOSE -- DON't DO THIS UNTIL YOU HAVE IT AS A threedTool.pointer - // if (draggingThreedItem) { - // // @ ts-expect-error - // // addThreed(e, draggingThreedItem, canvasStateThreeDVar().state.scene) - // // addThreed(e, draggingThreedItem, useCanvasStateThreeDVar.state.scene) - // void (draggingNewGuide && (draggingNewGuide = false)) - // } - - // // ** RETURN ??? - // // return ( - // // null - // // ) - // return - // } - // // END: document.onmouseup = function (e: any) {} + // ** RETURN + return + } + + // ** [MM] NEEDS ATTENTION [MM] + // ** CAN WE DO THIS WITHIN A SUB "TOOL" MODE? Yes please. + document.onmouseup = function (e: any) { + + // var PAPERscript = paper.PaperScript + // console.debug('PAPERscript', PAPERscript) + + // console.debug('PAPER threedTool', threedTool) + // console.debug('PAPER tool', paper.tool) + + // ** MOVE TO threedTool.pointer + draggingThreedIcon = false + + // ** + if (verticalSliderDragging) { + verticalSliderDragging = false + } + if (horizontalSliderLeftDragging) { + horizontalSliderLeftDragging = false + } + if (horizontalSliderRightDragging) { + horizontalSliderRightDragging = false + } + + // ** [MM] CLOSER... + // -- DON'T DO THIS UNTIL YOU HAVE IT AS A threedTool.pointer + if (draggingThreedItem) { + + var PAPERa = paper.view.viewToProject( + new paper.Point( + e.pageX - planView.offsetLeft, + e.pageY - planView.offsetTop + ) + ) + console.debug('PAPERa', PAPERa) + var PAPERprojectToView = paper.view.projectToView(PAPERa) + console.debug('PAPERprojectToView', PAPERprojectToView) + var PAPERb = paper.view.bounds + console.debug('PAPERb', PAPERb) + + // @ts-expect-error + addThreed(e, draggingThreedItem, canvasStateThreeDVar().state.scene) + // addThreed(e, draggingThreedItem, useCanvasStateThreeDVar.state.scene) + void (draggingNewGuide && (draggingNewGuide = false)) + } + + // ** RETURN + return + } + // END: document.onmouseup = function (e: any) {} }, []) // end load data useEffect (client) diff --git a/src/lib/threed/NOTES.md b/src/lib/threed/NOTES.md index a2f4c5e9e..ecdc7bdae 100644 --- a/src/lib/threed/NOTES.md +++ b/src/lib/threed/NOTES.md @@ -2,120 +2,67 @@ initThreeDPaperPlanView: tools.onMouseUp Object { tool: {…}, type: "mouseup", event: mouseup } -​ -event: mouseup { target: canvas#planCanvas, clientX: 448, clientY: 745, … } -​ -tool: Object { _index: 0, _moveCount: 51, _downCount: 5, … } -​​ -_callbacks: Object { mousedown: (1) […], mouseup: (1) […], mousedrag: (1) […], … } -​​ -_downCount: 5 -​​ -_downPoint: Object { x: 167.65618148439705, y: 387.69804816667505 } -​​ -_index: 0 -​​ -_lastPoint: Object { x: 1053.35252054596, y: 286.6378248634967 } -​​ -_moveCount: 51 -​​ -_onMouseDown: function onMouseDown(e) -​​ -_onMouseDrag: function onMouseDrag(e) -​​ -_onMouseMove: function onMouseMove(e) -​​ -_onMouseUp: function onMouseUp(e) -​​ -_point: Object { x: 1258.879491533323, y: 317.2965442925508 } -​​ -_scope: Object { settings: {…}, project: {…}, _id: 0, … } -​​ -: Object { _class: "Tool", _list: "tools", _reference: "tool", … } -​ -type: "mouseup" -​ -: Object { _class: "ToolEvent", _item: null, initialize: ToolEvent(tool, type, event), … } +​event: mouseup { target: canvas#planCanvas, clientX: 448, clientY: 745, … } +​tool: Object { _index: 0, _moveCount: 51, _downCount: 5, … } +​​_callbacks: Object { mousedown: (1) […], mouseup: (1) […], mousedrag: (1) […], … } +​​_downCount: 5 +​​_downPoint: Object { x: 167.65618148439705, y: 387.69804816667505 } +​​_index: 0 +​​_lastPoint: Object { x: 1053.35252054596, y: 286.6378248634967 } +​​_moveCount: 51 +​​_onMouseDown: function onMouseDown(e) +​​_onMouseDrag: function onMouseDrag(e) +​​_onMouseMove: function onMouseMove(e) +​​_onMouseUp: function onMouseUp(e) +​​_point: Object { x: 1258.879491533323, y: 317.2965442925508 } +​​_scope: Object { settings: {…}, project: {…}, _id: 0, … } +​​: Object { _class: "Tool", _list: "tools", _reference: "tool", … } +​type: "mouseup" +​: Object { _class: "ToolEvent", _item: null, initialize: ToolEvent(tool, type, event), … } HomeDesign.tsx:1821:12 -- _scope: Object { settings: {…}, project: {…}, _id: 0, … } -​​​ -_id: 0 -​​​ -project: Object { _index: 0, _selectionCount: 0, _updateVersion: 86, … } -​​​​ -_activeLayer: Object { _id: 2, _index: 0, _applyMatrix: true, … } -​​​​ -_children: Array [ {…} ] -​​​​ -_currentStyle: Object { _values: {}, _owner: null, _project: {…}, … } -​​​​ -_index: 0 -​​​​ -_namedChildren: Object { level_0: (1) […] } -​​​​ -_scope: Object { settings: {…}, project: {…}, _id: 0, … } -​​​​ -_selectionCount: 0 -​​​​ -_selectionItems: Object { } -​​​​ -_updateVersion: 86 -​​​​ -_view: Object { _pixelRatio: 1, _id: "planCanvas", _frameItemCount: 0, … } -​​​​ -: Object { _class: "Project", _list: "projects", _reference: "project", … } -​​​ -projects: Array [ {…} ] -​​​​ -0: Object { _index: 0, _selectionCount: 0, _updateVersion: 86, … } -​​​​ -length: 1 -​​​​ -: Array [] -​​​ -settings: Object { applyMatrix: true, insertItems: true, handleSize: 4, … } -​​​ -tool: Object { _index: 0, _moveCount: 51, _downCount: 5, … } -​​​ -tools: Array [ {…} ] +​​​_id: 0 +​​​project: Object { _index: 0, _selectionCount: 0, _updateVersion: 86, … } +​​​​_activeLayer: Object { _id: 2, _index: 0, _applyMatrix: true, … } +​​​​_children: Array [ {…} ] +​​​​_currentStyle: Object { _values: {}, _owner: null, _project: {…}, … } +​​​​_index: 0 +​​​​_namedChildren: Object { level_0: (1) […] } +​​​​_scope: Object { settings: {…}, project: {…}, _id: 0, … } +​​​​_selectionCount: 0 +​​​​_selectionItems: Object { } +​​​​_updateVersion: 86 +​​​​_view: Object { _pixelRatio: 1, _id: "planCanvas", _frameItemCount: 0, … } +​​​​: Object { _class: "Project", _list: "projects", _reference: "project", … } +​​​projects: Array [ {…} ] +​​​​0: Object { _index: 0, _selectionCount: 0, _updateVersion: 86, … } +​​​​length: 1 +​​​​: Array [] +​​​settings: Object { applyMatrix: true, insertItems: true, handleSize: 4, … } +​​​tool: Object { _index: 0, _moveCount: 51, _downCount: 5, … } +​​​tools: Array [ {…} ] -- _view: Object { _pixelRatio: 1, _id: "planCanvas", _frameItemCount: 0, … } -​​​​​ -_autoUpdate: true -​​​​​ -_bounds: Object { x: 63.6625852884355, y: -22.542103742910175, width: 1105.984915699952, … } -​​​​​ -_context: CanvasRenderingContext2D { globalAlpha: 1, globalCompositeOperation: "source-over", strokeStyle: "#000000", … } -​​​​​ -_decomposed: Object { translation: {…}, rotation: -0, scaling: {…}, … } -​​​​​ -_element: -​​​​​ -_frameItemCount: 0 -​​​​​ -_frameItems: Object { } -​​​​​ -_id: "planCanvas" -​​​​​ -_itemEvents: Object { native: {…}, virtual: {…} } -​​​​​ -_matrix: Object { _d: 0.8806630055922402, _a: 0.8806630055922402, _ty: 19.851996834603362, … } -​​​​​ -_needsUpdate: false -​​​​​ -_pixelRatio: 1 -​​​​​ -_project: Object { _index: 0, _selectionCount: 0, _updateVersion: 86, … } -​​​​​ -_requested: false -​​​​​ -_scope: Object { settings: {…}, project: {…}, _id: 0, … } -​​​​​ -_viewSize: Object { _width: 974, _height: 491, _setter: "setSize", … } +​​​​​_autoUpdate: true +​​​​​_bounds: Object { x: 63.6625852884355, y: -22.542103742910175, width: 1105.984915699952, … } +​​​​​_context: CanvasRenderingContext2D { globalAlpha: 1, globalCompositeOperation: "source-over", strokeStyle: "#000000", … } +​​​​​_decomposed: Object { translation: {…}, rotation: -0, scaling: {…}, … } +​​​​​_element: +​​​​​_frameItemCount: 0 +​​​​​_frameItems: Object { } +​​​​​_id: "planCanvas" +​​​​​_itemEvents: Object { native: {…}, virtual: {…} } +​​​​​_matrix: Object { _d: 0.8806630055922402, _a: 0.8806630055922402, _ty: 19.851996834603362, … } +​​​​​_needsUpdate: false +​​​​​_pixelRatio: 1 +​​​​​_project: Object { _index: 0, _selectionCount: 0, _updateVersion: 86, … } +​​​​​_requested: false +​​​​​_scope: Object { settings: {…}, project: {…}, _id: 0, … } +​​​​​_viewSize: Object { _width: 974, _height: 491, _setter: "setSize", … } ---