Code Monkey home page Code Monkey logo

Comments (3)

mohebifar avatar mohebifar commented on August 15, 2024

This is actually not possible with the current mask implementation. We currently do not have any plans for supporting masks with custom shapes. PRs are welcome though!

from react-native-copilot.

paragspacetotech avatar paragspacetotech commented on August 15, 2024

hi, i was going through this problem. you can edit the file in
/node_modules/react-native-copilot/dist/index.js

`var init_SvgMask = __esm({
position,
canvasSize
}) => {

  •  const cornerRadius = 10; // You can adjust this value based on the desired radius
     const positionX = position.x._value;
     const positionY = position.y._value;
     const sizeX = size.x._value;
     const sizeY = size.y._value;
    
  •  return `M0,0H${canvasSize.x}V${canvasSize.y}H0V0ZM${positionX},${positionY}H${positionX + sizeX}V${positionY + sizeY}H${positionX}V${positionY}Z`;
    
  • return `M0,0H${canvasSize.x}V${canvasSize.y}H0V0Z
  • M${positionX + cornerRadius}, ${positionY}
  • H${positionX + sizeX - cornerRadius}
  • Q${positionX + sizeX}, ${positionY} ${positionX + sizeX}, ${positionY + cornerRadius}
  • V${positionY + sizeY - cornerRadius}
  • Q${positionX + sizeX}, ${positionY + sizeY} ${positionX + sizeX - cornerRadius}, ${positionY + sizeY}
  • H${positionX + cornerRadius}
  • Q${positionX}, ${positionY + sizeY} ${positionX}, ${positionY + sizeY - cornerRadius}
  • V${positionY + cornerRadius}
  • Q${positionX}, ${positionY} ${positionX + cornerRadius}, ${positionY}
  • Z };

Screenshot_1698912510

from react-native-copilot.

carl0shd avatar carl0shd commented on August 15, 2024

hi, i was going through this problem. you can edit the file in /node_modules/react-native-copilot/dist/index.js

`var init_SvgMask = __esm({ position, canvasSize }) => {

  •  const cornerRadius = 10; // You can adjust this value based on the desired radius
     const positionX = position.x._value;
     const positionY = position.y._value;
     const sizeX = size.x._value;
     const sizeY = size.y._value;
    
  •  return `M0,0H${canvasSize.x}V${canvasSize.y}H0V0ZM${positionX},${positionY}H${positionX + sizeX}V${positionY + sizeY}H${positionX}V${positionY}Z`;
    
  • return `M0,0H${canvasSize.x}V${canvasSize.y}H0V0Z

  • M${positionX + cornerRadius}, ${positionY}

  • H${positionX + sizeX - cornerRadius}

  • Q${positionX + sizeX}, ${positionY} ${positionX + sizeX}, ${positionY + cornerRadius}

  • V${positionY + sizeY - cornerRadius}

  • Q${positionX + sizeX}, ${positionY + sizeY} ${positionX + sizeX - cornerRadius}, ${positionY + sizeY}

  • H${positionX + cornerRadius}

  • Q${positionX}, ${positionY + sizeY} ${positionX}, ${positionY + sizeY - cornerRadius}

  • V${positionY + cornerRadius}

  • Q${positionX}, ${positionY} ${positionX + cornerRadius}, ${positionY}

  • Z };

Screenshot_1698912510

in case anyone has a hard time copying the changes that @paragspacetotech does, this is the patch-package file

index b9127da..ef60d7b 100644
--- a/node_modules/react-native-copilot/dist/index.js
+++ b/node_modules/react-native-copilot/dist/index.js
@@ -188,11 +188,12 @@ var init_SvgMask = __esm({
       position,
       canvasSize
     }) => {
+      const cornerRadius = 12; // You can adjust this value based on the desired radius
       const positionX = position.x._value;
       const positionY = position.y._value;
       const sizeX = size.x._value;
       const sizeY = size.y._value;
-      return `M0,0H${canvasSize.x}V${canvasSize.y}H0V0ZM${positionX},${positionY}H${positionX + sizeX}V${positionY + sizeY}H${positionX}V${positionY}Z`;
+      return `M0,0H${canvasSize.x}V${canvasSize.y}H0V0ZM${positionX + cornerRadius}, ${positionY}H${positionX + sizeX - cornerRadius}Q${positionX + sizeX}, ${positionY} ${positionX + sizeX}, ${positionY + cornerRadius}V${positionY + sizeY - cornerRadius}Q${positionX + sizeX}, ${positionY + sizeY} ${positionX + sizeX - cornerRadius}, ${positionY + sizeY}H${positionX + cornerRadius}Q${positionX}, ${positionY + sizeY} ${positionX}, ${positionY + sizeY - cornerRadius}V${positionY + cornerRadius}Q${positionX}, ${positionY} ${positionX + cornerRadius}, ${positionY}Z`;
     };
     SvgMask = ({
       size,

from react-native-copilot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.